fix[build]: default build from source with -march=native#184
fix[build]: default build from source with -march=native#184feihongxu0824 merged 2 commits intomainfrom
Conversation
Greptile SummaryThis PR adds a new
Required action: Add Confidence Score: 1/5
Important Files Changed
Last reviewed commit: e298842 |
| option(ENABLE_EMERALDRAPIDS "Enable Intel Emerald Rapids Server CPU microarchitecture" OFF) | ||
| option(ENABLE_GRANITERAPIDS "Enable Intel Granite Rapids Server CPU microarchitecture" OFF) | ||
|
|
||
| option(ENABLE_NATIVE "Enable native CPU microarchitecture" ON) |
There was a problem hiding this comment.
Defaulting ENABLE_NATIVE to ON breaks PyPI wheel distribution. Wheels built on self-hosted runners (.github/workflows/build_wheel.yml) will use -march=native, making them CPU-specific to the build machine. Users with different CPUs will get illegal instruction errors.
Need to either:
- Set
ENABLE_NATIVE = "OFF"inpyproject.tomlunder[tool.scikit-build.cmake.define] - Or add
--config-settings='cmake.define.ENABLE_NATIVE="OFF"'to wheel build workflows
cmake/option.cmake
Outdated
| if(NOT ENABLE_NATIVE) | ||
| foreach(opt IN LISTS ARCH_OPTIONS) | ||
| if(${opt}) | ||
| set(AUTO_DETECT_ARCH OFF) | ||
| break() | ||
| endif() | ||
| endforeach() | ||
| endif() |
There was a problem hiding this comment.
When ENABLE_NATIVE=ON (default), this loop is skipped, meaning explicit architecture options like ENABLE_SKYLAKE=ON are ignored. Users must explicitly set ENABLE_NATIVE=OFF to use specific architectures. Document this priority in the build guide.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
No description provided.