Skip to content
Open
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
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pybind_interface/decide/decide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

namespace py = pybind11;

#ifdef _WIN32
// Windows
#if defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))
// Windows with cpuid
#include <intrin.h>
#define cpuid(info, x) __cpuidex(info, x, 0)

Expand All @@ -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);
Expand Down
Loading