From 343feee4fc4075f764acb8d3584cdac651707117 Mon Sep 17 00:00:00 2001 From: Jon Donovan Date: Mon, 6 Jul 2026 09:48:49 -0700 Subject: [PATCH 1/2] fix: support linux/arm64 builds The previous directives supported macos arm but did not correctly trigger off of macosx, this applies the same codepaths for linux arm, supporting them natively. --- CMakeLists.txt | 9 +++++++++ pybind_interface/decide/decide.cpp | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24a2a338e..03d2cd4ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,13 @@ else() message(STATUS "${MSG_PREFIX} did not detect Apple Silicon") endif() +# SSE/AVX pybind modules use x86 intrinsics; only build them on x86. +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|i386|i486|i586|i686)$") + set(QSIM_X86 TRUE) +else() + set(QSIM_X86 FALSE) +endif() + if(CMAKE_CUDA_COMPILER) enable_language(CUDA) message(STATUS "${MSG_PREFIX} found CUDA compiler " @@ -100,7 +107,9 @@ if(NOT CMAKE_APPLE_SILICON_PROCESSOR) elseif(has_hipcc) add_subdirectory(pybind_interface/hip) endif() +endif() +if(QSIM_X86) add_subdirectory(pybind_interface/sse) add_subdirectory(pybind_interface/avx512) add_subdirectory(pybind_interface/avx2) diff --git a/pybind_interface/decide/decide.cpp b/pybind_interface/decide/decide.cpp index 51cd52425..0ea07522a 100644 --- a/pybind_interface/decide/decide.cpp +++ b/pybind_interface/decide/decide.cpp @@ -16,8 +16,8 @@ namespace py = pybind11; -#ifdef _WIN32 -// Windows +#if defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64)) +// Windows with cpuid #include #define cpuid(info, x) __cpuidex(info, x, 0) @@ -35,7 +35,7 @@ enum Instructions { AVX512F = 0, AVX2 = 1, SSE4_1 = 2, BASIC = 3}; int detect_instructions() { Instructions instr = BASIC; - #if !defined(__aarch64__) || !defined(__APPLE__) + #if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(__x86_64__) || defined(__i386__) // Existing x86/x86_64 specific instruction set detection logic int info[4]; cpuid(info, 0); From 4e88c8a2a355850e7837d2f2c0a75d5a5459fb2b Mon Sep 17 00:00:00 2001 From: Jon Donovan Date: Fri, 14 Aug 2026 13:28:39 -0700 Subject: [PATCH 2/2] review comments --- CMakeLists.txt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03d2cd4ec..74dcc4b32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,13 +34,6 @@ else() message(STATUS "${MSG_PREFIX} did not detect Apple Silicon") endif() -# SSE/AVX pybind modules use x86 intrinsics; only build them on x86. -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|i386|i486|i586|i686)$") - set(QSIM_X86 TRUE) -else() - set(QSIM_X86 FALSE) -endif() - if(CMAKE_CUDA_COMPILER) enable_language(CUDA) message(STATUS "${MSG_PREFIX} found CUDA compiler " @@ -109,7 +102,8 @@ if(NOT CMAKE_APPLE_SILICON_PROCESSOR) endif() endif() -if(QSIM_X86) +# SSE/AVX pybind modules use x86 intrinsics; only build them on x86. +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|i386|i486|i586|i686)$") add_subdirectory(pybind_interface/sse) add_subdirectory(pybind_interface/avx512) add_subdirectory(pybind_interface/avx2)