build: Make USE_PORTABLE_SIMD build baseline binaries - #492
Open
Xeonacid wants to merge 1 commit into
Open
Conversation
Problem USE_PORTABLE_SIMD is currently not truly portable. On x86 it replaces -march=native with -mavx, while both build systems still define HAVE_AVX and compile FFTW's AVX codelets. Wheels or distro packages built that way can run AVX instructions on older CPUs and fail with Illegal instruction. ARM builds have the same generic distribution concern when HAVE_NEON is enabled. Solution Keep the optimized local-build behavior by default. When USE_PORTABLE_SIMD is set, stop passing -mavx, -march=native, and the AVX/NEON feature macros. Also filter AVX, SSE, and NEON FFTW SIMD sources from the CMake and legacy setup.py build paths. Result USE_PORTABLE_SIMD now produces a baseline binary suitable for distro packaging and CI distribution. Future work can add runtime SIMD feature detection and select AVX or NEON implementations only when the running CPU supports them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
USE_PORTABLE_SIMD is currently not truly portable. On x86 it replaces -march=native with -mavx, while both build systems still define HAVE_AVX and compile FFTW's AVX codelets. Wheels or distro packages built that way can run AVX instructions on older CPUs and fail with Illegal instruction. ARM builds have the same generic distribution concern when HAVE_NEON is enabled.
Solution
Keep the optimized local-build behavior by default. When USE_PORTABLE_SIMD is set, stop passing -mavx, -march=native, and the AVX/NEON feature macros. Also filter AVX, SSE, and NEON FFTW SIMD sources from the CMake and legacy setup.py build paths.
Result
USE_PORTABLE_SIMD now produces a baseline binary suitable for distro packaging and CI distribution. Future work can add runtime SIMD feature detection and select AVX or NEON implementations only when the running CPU supports them.