Add arm64EC pipeline. Disable all SSE usage for ARM64EC#2491
Add arm64EC pipeline. Disable all SSE usage for ARM64EC#2491cbezault wants to merge 6 commits intomicrosoft:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
CaseyCarter
left a comment
There was a problem hiding this comment.
Can't "approve" without seeing this run, but what's here so far looks good and I want to set my "last review" point.
| _Advance_bytes(_First, 16); | ||
| } while (_First != _Stop_at); | ||
| } | ||
| #endif // !defined(_M_ARM64EC) |
There was a problem hiding this comment.
If _M_ARM64EC contains only fallback, it should not be called at all; instead _USE_STD_VECTOR_ALGORITHMS should be set to 0, like for _M_HYBRID.
Maybe they should even not exist, like for _M_ARM.
There was a problem hiding this comment.
I think we should mimic the behavior of _M_HYBRID I just put this PR out as it was to get the idea out there.
There was a problem hiding this comment.
I don't agree with this; I believe that arm64EC should be treated like ARM64 for purposes of vector instructions, since it is "just" ARM64 code with an emulator-friendly ABI.
However, I'll note that we currently don't have vector algorithms for ARM64, so the outcome should be the same.
|
We really should consider creating NEON versions of all of these vector algorithms for ARM64. |
Tracked as #813 (I'm not participating in it as I don't own an ARM) |
Write all the code you like - but it will cost you an ARM and a leg! |
|
I've pushed a conflict-free merge with |
|
Ok, looks like we've got actionable build failures. Example: This looks "good" in the sense that I see |
|
Interesting, I didn't see that failure locally. |
|
On my personal machine the first Windows SDK that has softintrin.h is 10.0.20348. |
|
Currently we aren't using WinSDK 10.0.20348.0 because Clang 12 targeting ARM64 was incompatible with it. LLVM-51128 was fixed and I am 95% confident that the fix got into Clang 13.0.1. I'm uncertain whether even newer WinSDKs are affected. |
This reverts commit 4cce4e4.
|
I've pushed another merge with |
|
I believe we'll need Clang 14 and update to the latest WinSDK before this PR can make progress. (In theory Clang 13.0.1 should be sufficient, but I don't expect VS to pick up that point release.) |
|
Seems like this is unblocked because we're using a newer WinSDK now? |
|
Good catch - VS picked up Clang 13.0.1 and we were able to upgrade to the Win11 SDK 22000. I've removed the blocked label; now merge conflicts need to be resolved. |
strega-nil-ms
left a comment
There was a problem hiding this comment.
Other than that, I am of the opinion that the correct thing here is to instead say that ARM64EC ⇒ ¬_USE_STD_VECTOR_ALGORITHMS for now, until we implement vector algorithms for ARM64 in which case we should use the ARM64 vector algorithms.
To me, this means that vector_algorithms.cpp:13 should be changed:
-#if defined(_M_IX86) || defined(_M_X64)
+// equivalent to _USE_STD_VECTOR_ALGORITHMS in <xutility>
+#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID) && !defined(_M_ARM64EC)and then change xutility:24
-#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)
+#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID) && !defined(_M_ARM64EC)| add_library(libcpmt${FLAVOR_SUFFIX}_eha OBJECT ${EHA_SOURCES}) | ||
| target_compile_definitions(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE "${THIS_CONFIG_DEFINITIONS};_ANNOTATE_VECTOR") | ||
| target_compile_options(libcpmt${FLAVOR_SUFFIX}_eha PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};/EHa") | ||
| set_target_properties(libcpmt${FLAVOR_SUFFIX}_eha PROPERTIES STATIC_LIBRARY_OPTIONS "/machine:${VCLIBS_TARGET_ARCHITECTURE}") |
There was a problem hiding this comment.
libcpmt*_eha is not a static library, it's an object library (hence should not require STATIC_LIBRARY_OPTIONS)
|
@cbezault are you interested in finishing this PR? otherwise, I'll mark as draft and maybe take it up myself. |
|
Marking as draft since there's been no response. |
|
I'm interested in finishing this. I do not agree that ARM64EC should imply ARM64 for the sake of determining if we use the vector algorithms or not. In my other PR that actually adds some native ARM64 vector algorithms I found that binaries that were already running in x64 mode actually performed better when calling into x64 code with emulated SSE intrinsics. This is likely because of the overhead in translating between the x64 and ARM64EC abis as well as things like the Adjuster Thunks outlined in the ARM64EC abi doc. I'm curious to know if there is a way to provide both an ARM64EC variant of these functions and also an x64 variant in the same lib. |
|
Thanks again for working on this PR. Because we have severely limited maintainer capacity for the foreseeable future, and this PR has steadily become outdated relative to |
Add ARM64EC to the pipeline. We do this via the pre-existing
VCLIBS_TARGET_ARCHITECTUREcmake variable.To compile ARM64EC code one uses the ARM64 targeting compiler and passes
/arm64EC.We also need to explicitly pass
/machine:arm64ecto the linker.When compiling
vector_algorithms.cppsome of the intrinsics did not have specialized EC versions available. Either way we shouldn't rely on the emulation of SSE intrinsics.Resolves #2310.