GH-50527: [C++] Remove ARROW_SSE4_2_FLAG for x86 MSVC#50526
Conversation
The SSE4.2 flag is invalid in for the MSVC x86 compiler. https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
|
|
| # x86/amd64 compiler flags, msvc/gcc/clang | ||
| if(MSVC) | ||
| set(ARROW_SSE4_2_FLAG "/arch:SSE4.2") | ||
| set(ARROW_SSE4_2_FLAG "") |
There was a problem hiding this comment.
Can we do this only for x86 environment?
This disables SSE 4.2 on x64 environment too.
There was a problem hiding this comment.
SSE4.2 appears to behave identically for x64. The official Microsoft documentation lists SSE4.2 as valid flag for msvc-180, but the compiler begs to disagree. I am having trouble finding documentation to support this, but building with x64 does produce the same nuisance warnings as with x86. This appears to be because SSE2 and its extensions are implicitly targeted as the baseline. Here is the relevant usage line on my machine:
Command> "C:\Program Files\Microsoft Visual Studio\18\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe" /? 2>nul | findstr "arch:"
[Output]
/arch:<AVX|AVX2|AVX512> minimum CPU architecture requirements, one of:
Next week I will expand the scope of testing to see if there is any MSVC version that supports the SSE4.2 flag without warnings.
The SSE4.2 flag is invalid for the MSVC x86 compiler.
https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86
Rationale for this change
MSVC x86 builds generate hundreds of nuisance warnings that resemble:
cl : Command line warning D9002 : ignoring unknown option '/arch:SSE4.2'
This change aligns the flag with Microsoft documentation to remove the warnings.
What changes are included in this PR?
Simple replacement of the MSVC-specific flag "/arch:SSE4.2" with an empty string. This matches a working configuration prior to ~July 2025, at which time the flag seems to have been erroneously edited while adding xsimd definitions below.
Are these changes tested?
Yes - using cmake version 3.29.6 and a VC18 compiler.
Are there any user-facing changes?
No. This only affects developers building the source code and has no impact on the Apache Arrow libraries.