File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ elseif(APPLE AND NOT CMAKE_APPLE_SILICON_PROCESSOR)
7676 check_cpu_support ("sse4_1" CPU_SUPPORTS_SSE4 )
7777endif ()
7878
79+ # Configure LTO for compilers that support it.
80+ include (CheckIPOSupported )
81+ check_ipo_supported (RESULT HAVE_LTO )
82+
7983# ~~~~~ Configure the build ~~~~~
8084
8185if (WIN32 )
@@ -84,6 +88,10 @@ else()
8488 add_compile_options (-O3 -D_GLIBCXX_USE_CXX11_ABI=1 )
8589endif ()
8690
91+ if (HAVE_LTO)
92+ set (CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE )
93+ endif ()
94+
8795include (dev_tools/cmake/GetPybind11.cmake )
8896
8997# Always build the basic part.
Original file line number Diff line number Diff line change 1+ # Copyright 2019 Google LLC. All Rights Reserved.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # https://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ cmake_minimum_required(VERSION 3.31)
16+ project(qsim)
17+
18+ IF (WIN32)
19+ add_compile_options(/arch:AVX512)
20+ ELSEIF(HAVE_AVX512_10)
21+ add_compile_options(-mavx10.1-512 -mbmi2)
22+ ELSE()
23+ add_compile_options(-mavx512f -mbmi2)
24+ ENDIF()
25+
26+ INCLUDE(../../dev_tools/cmake/GetPybind11.cmake)
27+ pybind11_add_module(qsim_avx512 pybind_main_avx512.cpp)
28+
29+ if(OpenMP_CXX_FOUND)
30+ target_link_libraries(qsim_avx512 PUBLIC OpenMP::OpenMP_CXX)
31+ endif()
Original file line number Diff line number Diff line change @@ -57,4 +57,3 @@ pybind11_add_module(qsim_sse pybind_main_sse.cpp)
5757if (OpenMP_CXX_FOUND)
5858 target_link_libraries (qsim_sse PUBLIC pybind11::headers OpenMP::OpenMP_CXX )
5959endif ()
60-
You can’t perform that action at this time.
0 commit comments