Skip to content

Commit 1b753ba

Browse files
committed
Support avx10.1-512 variant
It seems there's a new variant of AVX 512. Clang has a flag to enable it, so we may as well try it.
1 parent 86c2ac8 commit 1b753ba

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ if(WIN32)
6868
else()
6969
check_cxx_compiler_flag("-mavx2" HAVE_AVX2)
7070
check_cxx_compiler_flag("-mavx512f" HAVE_AVX512)
71+
check_cxx_compiler_flag("-mavx10.1-512" HAVE_AVX512_10)
7172
endif()
7273

7374

@@ -107,7 +108,7 @@ if(NOT CMAKE_APPLE_SILICON_PROCESSOR)
107108
add_subdirectory(pybind_interface/avx2)
108109
endif()
109110

110-
if(HAVE_AVX512)
111+
if(HAVE_AVX512 OR HAVE_AVX512_10)
111112
add_subdirectory(pybind_interface/avx512)
112113
endif()
113114
endif()
@@ -133,6 +134,7 @@ endif()
133134
message(STATUS "${MSG_PREFIX} host has SSE2 = ${HAVE_SSE2}")
134135
message(STATUS "${MSG_PREFIX} host has AVX2 = ${HAVE_AVX2}")
135136
message(STATUS "${MSG_PREFIX} host has AVX512 = ${HAVE_AVX512}")
137+
message(STATUS "${MSG_PREFIX} host has AVX10.1-512 = ${HAVE_AVX512_10}")
136138

137139
message(STATUS "${MSG_PREFIX} shell $PATH = $ENV{PATH}")
138140
message(STATUS "${MSG_PREFIX} shell $CUQUANTUM_ROOT = $ENV{CUQUANTUM_ROOT}")

pybind_interface/avx512/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ project(qsim)
1717

1818
IF (WIN32)
1919
add_compile_options(/arch:AVX512)
20+
ELSEIF(HAVE_AVX512_10)
21+
add_compile_options(-mavx10.1-512 -mbmi2)
2022
ELSE()
2123
add_compile_options(-mavx512f -mbmi2)
2224
ENDIF()

pybind_interface/basic/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
cmake_minimum_required(VERSION 3.31)
1616
project(qsim)
1717

18+
if(NOT WIN32)
19+
add_compile_options(-march=native)
20+
endif()
21+
1822
INCLUDE(../GetPybind11.cmake)
1923
pybind11_add_module(qsim_basic pybind_main_basic.cpp)
2024

0 commit comments

Comments
 (0)