Skip to content

[gmp] arm64 windows asm optimization#26764

Closed
eukarpov wants to merge 26 commits intomicrosoft:masterfrom
eukarpov:gmp-arm64-windows-asm-optimization
Closed

[gmp] arm64 windows asm optimization#26764
eukarpov wants to merge 26 commits intomicrosoft:masterfrom
eukarpov:gmp-arm64-windows-asm-optimization

Conversation

@eukarpov
Copy link
Contributor

Describe the pull request

  • What does your PR fix?

    Add arm64:windows asm optimization compatibility to improve performance

  • Which triplets are supported/not supported? Have you updated the CI baseline?

    All, No

  • Does your PR follow the maintainer guide?

    Yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

    Yes

github-actions[bot]
github-actions bot previously approved these changes Sep 12, 2022
@Neumann-A
Copy link
Contributor

the correct approach is probably to drop yasm and simply switch to clang (#23660).

@eukarpov
Copy link
Contributor Author

the correct approach is probably to drop yasm and simply switch to clang (#23660).

It looks like switch to clang requires a lot of changes.
This PR introduces a simple bash converter from gas to armasm64 and does not use yasm.

Did (#23660) pass all tests provided by gmp package?

@Neumann-A
Copy link
Contributor

#23660 can be reduced to just use vcpkg_find_acquire_program(CLANG)

@Cheney-W Cheney-W added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Sep 13, 2022
@Cheney-W
Copy link
Contributor

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for gmp have changed but the version was not updated
version: 6.2.1#14
old SHA: a84071723756ce12828e029f87fb770787d69ac7
new SHA: a48c67e5a1f83d6beb79bf191c8b4ef96e6f1be7
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

@eukarpov eukarpov changed the title [gmp] arm64 windows asm optimization [gmp] arm64 windows asm optimization DRAFT Sep 13, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for gmp have changed but the version was not updated
version: 6.2.1#14
old SHA: a48c67e5a1f83d6beb79bf191c8b4ef96e6f1be7
new SHA: 5159d4a4b0cb125910889820115601aa3ca8a6aa
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for gmp have changed but the version was not updated
version: 6.2.1#14
old SHA: a48c67e5a1f83d6beb79bf191c8b4ef96e6f1be7
new SHA: 5159d4a4b0cb125910889820115601aa3ca8a6aa
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

github-actions[bot]
github-actions bot previously approved these changes Sep 13, 2022
@eukarpov
Copy link
Contributor Author

@Neumann-A thank you for your comment. Clang from Visual Studio has been used to prepare changes in this PR. Tests and performance benchmark have not been executed yet.

@Cheney-W Cheney-W added info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. and removed requires:author-response labels Sep 14, 2022
github-actions[bot]
github-actions bot previously approved these changes Sep 14, 2022
@eukarpov eukarpov changed the title [gmp] arm64 windows asm optimization DRAFT [gmp] arm64 windows asm optimization Sep 14, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

PRs must add only one version and must not modify any published versions

When making any changes to a library, the version or port-version in vcpkg.json or CONTROL must be modified.

error: checked-in files for gmp have changed but the version was not updated
version: 6.2.1#14
old SHA: 4a8c0cd061abb65475b1ec285e61a2507064a788
new SHA: c2fccf3d63c01fc47ab821a58790ea70edd60f00
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

github-actions[bot]
github-actions bot previously approved these changes Oct 21, 2022
vcpkg_download_distfile(
ARM64PATCH
URLS https://gmplib.org/repo/gmp/raw-rev/5f32dbc41afc
FILENAME 5f32dbc41afc.patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is not a good filename for a source artifact. When we can choose names, they should tell us the port and/or origin they belong to.

github-actions[bot]
github-actions bot previously approved these changes Oct 21, 2022
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
vcpkg_add_to_path("$ENV{VCINSTALLDIR}/Tools/Llvm/bin")
set(ENV{CCAS} "clang-cl --target=arm64-pc-win32 -c")
# Avoid the x18 register since it is reserved on Darwin.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The x18 register is a platform register based on ARM64 ABI for Windows convention. It turned out that Darwin has the same issue. I would change the comment to avoid confusion why Darwin patch is used to avoid issue on ARM64 Windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine; I was just copying the upstream comment.

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
vcpkg_add_to_path("$ENV{VCINSTALLDIR}/Tools/Llvm/bin")
set(ENV{CCAS} "clang-cl --target=arm64-pc-win32 -c")
# Avoid the x18 register since it is reserved on Darwin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine; I was just copying the upstream comment.

@Cheney-W Cheney-W removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Nov 11, 2022
@Cheney-W
Copy link
Contributor

Pinging @eukarpov Could you address the review suggestions of Billy? Thanks!

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one portfile where deprecated functions are used.

Details

If you feel able to do so, please consider migrating them to the new functions:
vcpkg_install_cmake -> vcpkg_cmake_install (from port vcpkg-cmake)
vcpkg_build_cmake -> vcpkg_cmake_build (from port vcpkg-cmake)
vcpkg_configure_cmake -> vcpkg_cmake_configure (Please remove the option PREFER_NINJA) (from port vcpkg-cmake)
vcpkg_fixup_cmake_targets -> vcpkg_cmake_config_fixup (from port vcpkg-cmake-config)
vcpkg_extract_source_archive_ex -> vcpkg_extract_source_archive
vcpkg_build_msbuild -> vcpkg_install_msbuild
vcpkg_copy_tool_dependencies -> vcpkg_copy_tools
vcpkg_apply_patches should be replaced by the PATCHES arguments to the "extract" helpers (e.g. vcpkg_from_github())

In the ports that use the new function, you have to add the corresponding dependencies:

{
  "name": "vcpkg-cmake",
  "host": true
},
{
  "name": "vcpkg-cmake-config",
  "host": true
}

The following files are affected:

  • ports/gmp/portfile.cmake

@eukarpov eukarpov requested a review from BillyONeal November 11, 2022 22:18
@eukarpov
Copy link
Contributor Author

Pinging @eukarpov Could you address the review suggestions of Billy? Thanks!

Requested change has been done

@eukarpov eukarpov closed this Nov 12, 2022
@eukarpov eukarpov reopened this Nov 12, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one portfile where deprecated functions are used.

Details

If you feel able to do so, please consider migrating them to the new functions:
vcpkg_install_cmake -> vcpkg_cmake_install (from port vcpkg-cmake)
vcpkg_build_cmake -> vcpkg_cmake_build (from port vcpkg-cmake)
vcpkg_configure_cmake -> vcpkg_cmake_configure (Please remove the option PREFER_NINJA) (from port vcpkg-cmake)
vcpkg_fixup_cmake_targets -> vcpkg_cmake_config_fixup (from port vcpkg-cmake-config)
vcpkg_extract_source_archive_ex -> vcpkg_extract_source_archive
vcpkg_build_msbuild -> vcpkg_install_msbuild
vcpkg_copy_tool_dependencies -> vcpkg_copy_tools
vcpkg_apply_patches should be replaced by the PATCHES arguments to the "extract" helpers (e.g. vcpkg_from_github())

In the ports that use the new function, you have to add the corresponding dependencies:

{
  "name": "vcpkg-cmake",
  "host": true
},
{
  "name": "vcpkg-cmake-config",
  "host": true
}

The following files are affected:

  • ports/gmp/portfile.cmake

@dg0yt
Copy link
Contributor

dg0yt commented Nov 12, 2022

I'm working on fixing general cross build errors with this port (arm linux, mingw). The structural changes to the portfile go into a different direction, however I may try to integrate arm64-windows changes.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 13, 2022

I may try to integrate arm64-windows changes.

Done, #27787.

@BillyONeal
Copy link
Member

The changes in this PR were incorporated into #27787. Thanks for your contribution!

@BillyONeal BillyONeal closed this Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants