Skip to content

Commit 01f4294

Browse files
committed
ci: disable native cpu tuning for portable artifacts
1 parent 53adb95 commit 01f4294

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ jobs:
117117
-DCMAKE_PREFIX_PATH=${{ matrix.deps_path }} \
118118
-DTPCH_ENABLE_ORC=${{ matrix.enable_orc }} \
119119
-DTPCH_ENABLE_LANCE=${{ matrix.enable_lance }} \
120+
-DTPCH_ENABLE_NATIVE_OPTIMIZATIONS=OFF \
120121
-DTPCH_ENABLE_ASYNC_IO=ON \
121122
-DTPCH_ENABLE_ASAN=OFF \
122123
-DTPCH_BUILD_TESTS=${{ matrix.enable_tests }}

CMakeLists.txt

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ option(TPCH_USE_PREBUILT_LANCE_FFI "Use pre-compiled Lance FFI library when avai
3030
option(TPCH_ENABLE_PERF_COUNTERS "Enable performance counters instrumentation" OFF)
3131
option(TPCH_ENABLE_MOLD "Enable mold linker if available (incompatible with GTest in this project)" ON)
3232
option(TPCDS_ENABLE "Enable TPC-DS data generation (tpcds_benchmark executable)" OFF)
33+
option(TPCH_ENABLE_NATIVE_OPTIMIZATIONS "Enable host-specific CPU optimizations such as -march=native" ON)
3334

3435
# Compiler configuration
3536
include(cmake/CompilerWarnings.cmake)
@@ -38,30 +39,38 @@ include(cmake/CompilerWarnings.cmake)
3839
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
3940
# Enable aggressive optimizations with SIMD support
4041
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
41-
add_compile_options(-O3 -march=native)
42+
add_compile_options(-O3)
43+
44+
if(TPCH_ENABLE_NATIVE_OPTIMIZATIONS)
45+
add_compile_options(-march=native)
46+
endif()
4247

4348
# Enable auto-vectorization and report optimizations
4449
add_compile_options(
4550
-ftree-vectorize # Enable loop vectorization
4651
-fopt-info-vec-optimized # Report successful vectorizations
4752
)
4853

49-
# Check for AVX2 support (preferred)
50-
include(CheckCXXCompilerFlag)
51-
check_cxx_compiler_flag("-mavx2" COMPILER_SUPPORTS_AVX2)
54+
if(TPCH_ENABLE_NATIVE_OPTIMIZATIONS)
55+
# Check for AVX2 support (preferred)
56+
include(CheckCXXCompilerFlag)
57+
check_cxx_compiler_flag("-mavx2" COMPILER_SUPPORTS_AVX2)
5258

53-
if(COMPILER_SUPPORTS_AVX2)
54-
message(STATUS "Enabling AVX2 SIMD optimizations")
55-
add_compile_options(-mavx2 -mfma)
56-
else()
57-
# Fallback to SSE4.2 (required for SIMD string utils)
58-
check_cxx_compiler_flag("-msse4.2" COMPILER_SUPPORTS_SSE42)
59-
if(COMPILER_SUPPORTS_SSE42)
60-
message(STATUS "Enabling SSE4.2 SIMD optimizations")
61-
add_compile_options(-msse4.2)
59+
if(COMPILER_SUPPORTS_AVX2)
60+
message(STATUS "Enabling AVX2 SIMD optimizations")
61+
add_compile_options(-mavx2 -mfma)
6262
else()
63-
message(WARNING "No SIMD support detected - performance will be degraded")
63+
# Fallback to SSE4.2 (required for SIMD string utils)
64+
check_cxx_compiler_flag("-msse4.2" COMPILER_SUPPORTS_SSE42)
65+
if(COMPILER_SUPPORTS_SSE42)
66+
message(STATUS "Enabling SSE4.2 SIMD optimizations")
67+
add_compile_options(-msse4.2)
68+
else()
69+
message(WARNING "No SIMD support detected - performance will be degraded")
70+
endif()
6471
endif()
72+
else()
73+
message(STATUS "Host-specific CPU optimizations disabled (TPCH_ENABLE_NATIVE_OPTIMIZATIONS=OFF)")
6574
endif()
6675
endif()
6776
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")

0 commit comments

Comments
 (0)