Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whats the process to use Highway with an architecture older than AVX2? #2400

Open
7sharp9 opened this issue Dec 6, 2024 · 3 comments
Open

Comments

@7sharp9
Copy link

7sharp9 commented Dec 6, 2024

If I want to target a slightly older baseline, say -march=core-avx-i for example, does that cause issues?

Whats the recommended practice in this instance? Im assuming compiling with /arch:AVX2 etc is never a good idea on an older computer that might not have that support. i.e. When you are distributing the application already compiled like for commercial software. When It's important to have minimum system requirement that's inclusive of older CPU's is it ok to move the baseline back to AVX etc or is AVX really a minimum?

Thanks!

@johnplatts
Copy link
Contributor

johnplatts commented Dec 6, 2024

There are still some Intel Celeron, Pentium, and Atom CPU's that support SSE4 (including SSE4.2) but not AVX or AVX2, and some of the Intel Celeron and Pentium CPU's that don't support AVX or AVX2 were manufactured as late as 2021.

To compile for SSE4 or later targets, you can compile with the -march=nehalem -maes -mpclmul GCC/Clang compiler option or -DHWY_WANT_SSE4=1 MSVC compiler option.

@7sharp9
Copy link
Author

7sharp9 commented Dec 6, 2024

Thanks @johnplatts. Why is the clang option given as -march=nehalem -maes -mpclmul but the MSVC option -DHWY_WANT_SSE4=1 a HWY define?

Im essentially wanting to support the best baseleine for AVX+ Macs along with Apple silicon, and any Windown Intel from that same era. I I ended up with -march=core-avx-i for the Intel Macs, -march=armv8-a for Apple Silicon and /arch:AVX for Windows. Like you said theres the budget line of Intels that dont line up with a gradual timeline of improved SSE so I'll look into that option for the MSVC build. Im not sure if Apple had as much variable SSE support to warrant the -march=nehalem -maes -mpclmul option?

@johnplatts
Copy link
Contributor

Thanks @johnplatts. Why is the clang option given as -march=nehalem -maes -mpclmul but the MSVC option -DHWY_WANT_SSE4=1 a HWY define?

Visual C++ 2022 now has the -arch:SSE4.2 option which is equivalent to the GCC/Clang -msse4.2 (which is enabled by default if compiling with the -march=nehalem option). However, Visual C++ 2022 does not define a macro indicating that SSE4.2 support is enabled (unlike GCC/Clang, which defines the __SSE4_2__ macro if compiling with the -msse4.2 option).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants