Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ jobs:
arch_flag: "" # ARM64 uses auto-detection
- os: ubuntu-24.04
platform: linux-x64
# FIXME: ENABLE_ZEN3 is hardcoded for the current GitHub-hosted runner (AMD EPYC 7T83).
# This should be removed once #101 is resolved.
arch_flag: "--config-settings='cmake.define.ENABLE_ZEN3=\"ON\"'"
arch_flag: "" # Use native CPU microarchitecture

steps:
- name: Checkout code
Expand Down
10 changes: 8 additions & 2 deletions cmake/option.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ option(ENABLE_SAPPHIRERAPIDS "Enable Intel Sapphire Rapids Server CPU microarchi
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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Set ENABLE_NATIVE = "OFF" in pyproject.toml under [tool.scikit-build.cmake.define]
  2. Or add --config-settings='cmake.define.ENABLE_NATIVE="OFF"' to wheel build workflows


## AMD Microarchitectures
option(ENABLE_ZEN1 "Enable AMD Zen+ Family 17h CPU microarchitecture" OFF)
option(ENABLE_ZEN2 "Enable AMD Zen 2 Family 17h CPU microarchitecture" OFF)
Expand All @@ -36,9 +38,10 @@ set(ARCH_OPTIONS
ENABLE_ZEN1 ENABLE_ZEN2 ENABLE_ZEN3
ENABLE_ARMV8A ENABLE_ARMV8.1A ENABLE_ARMV8.2A ENABLE_ARMV8.3A ENABLE_ARMV8.4A
ENABLE_ARMV8.5A ENABLE_ARMV8.6A
ENABLE_NATIVE
)

set(AUTO_DETECT_ARCH ON)
option(AUTO_DETECT_ARCH "Auto detect CPU microarchitecture" ON)
foreach(opt IN LISTS ARCH_OPTIONS)
if(${opt})
set(AUTO_DETECT_ARCH OFF)
Expand Down Expand Up @@ -122,8 +125,11 @@ if(MSVC)
return()
endif()


if(NOT AUTO_DETECT_ARCH)
if(ENABLE_NATIVE)
add_arch_flag("-march=native" NATIVE ENABLE_NATIVE)
endif()

if(ENABLE_ZEN3)
add_arch_flag("-march=znver3" ZNVER3 ENABLE_ZEN3)
endif()
Expand Down