You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tsfile.apache.org by co...@apache.org on 2026/05/31 07:25:47 UTC
(tsfile) branch colin_tsfile_dataframe_init updated: lower default TSFILE_TARGET_ARCH from skylake-avx512 to haswell
This is an automated email from the ASF dual-hosted git repository.
ColinLeeo pushed a commit to branch colin_tsfile_dataframe_init
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/colin_tsfile_dataframe_init by this push:
new c0d4d384d lower default TSFILE_TARGET_ARCH from skylake-avx512 to haswell
c0d4d384d is described below
commit c0d4d384d51b35714c23b1c445f01f9c0daf7022
Author: ColinLee <sh...@163.com>
AuthorDate: Sun May 31 15:22:47 2026 +0800
lower default TSFILE_TARGET_ARCH from skylake-avx512 to haswell
cibuildwheel builds inside a manylinux_2_28 docker container that
runs on whatever runner GitHub Actions hands out. Those runners are
generally Haswell/Broadwell vintage (AVX2 yes, AVX-512 no), so a
wheel compiled with -march=skylake-avx512 SIGILLs during the post-
build "python -c 'import tsfile'" smoke test (exit code 132).
The hand-written SIMD in this codebase is all 256-bit:
$ grep -r simde_mm512_ cpp/src # 0 matches
$ grep -r simde_mm256_ cpp/src # 78 matches
so dropping the target from skylake-avx512 to haswell costs nothing
for the explicit batch decoders -- simde still maps to native AVX2
intrinsics. The only thing we lose is gcc's auto-vectorizer being
allowed to emit 512-bit code on its own, which is a minor win at
best for the I/O-bound decode hot path.
Verified on Fit15 (Linux x86_64):
-O3 -march=haswell -flto applied, 493 C++ tests pass,
libtsfile.so contains 282 vpermq / 54 vpaddd (AVX2 SIMD live)
and zero vmovdqu64 / vpermi2b / vpermt2b / vpopcnt[dq]
(no AVX-512-only instructions, won't SIGILL on AVX2-only hosts).
Anyone targeting Skylake-AVX512 specifically can still flip the knob:
cmake -DTSFILE_TARGET_ARCH=skylake-avx512
or build natively on the deployment host:
cmake -DENABLE_NATIVE_ARCH=ON
---
cpp/CMakeLists.txt | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 0131787ac..79a7954ee 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -98,27 +98,36 @@ message("CMAKE BUILD TYPE " ${CMAKE_BUILD_TYPE})
# binary that gets shipped to a different machine (e.g. an Ice Lake
# build host emits AVX-512 VBMI/VPOPCNTDQ that SIGILL on Skylake).
#
-# - The intended deployment target is Skylake-SP / Cascade Lake servers
-# (AVX-512 F/CD/BW/DQ/VL, no VBMI, no VPOPCNTDQ), so the Linux x86_64
-# default targets that explicitly. This also defines __AVX2__ and
-# __AVX512F__ at compile time, which lets simde's batch-decode
-# intrinsics (simde_mm256_*) fall through to real SIMD instructions
-# instead of scalar emulation.
+# - The default target is "haswell" (AVX2 + FMA + BMI2 + POPCNT),
+# which is what every server CPU since 2013 supports. That's the
+# lowest level at which simde batch decoders compile to real SIMD
+# (the codebase has 78 simde_mm256_* / simde__m256 sites and no
+# 512-bit ones, so AVX-512 isn't needed for the hand-written
+# vector paths). It also matches manylinux_2_28 / cibuildwheel
+# test runners, which often only have AVX2 -- a higher target
+# would SIGILL during the wheel's import smoke test.
#
-# - Anyone who wants host-specific codegen can flip ENABLE_NATIVE_ARCH
-# on; that overrides TSFILE_TARGET_ARCH.
+# - Anyone with a stricter deployment target (e.g. Skylake-SP /
+# Cascade Lake with full AVX-512 baseline, or AMD Zen 4 with
+# AVX-512 + VNNI) can pass -DTSFILE_TARGET_ARCH=skylake-avx512 to
+# widen what gcc autovectorizes; that's strictly faster on those
+# hosts but won't run on AVX2-only test runners.
#
-# - Setting TSFILE_TARGET_ARCH to an empty string falls back to the
-# compiler's portable baseline (-march=x86-64), which only emits
-# SSE2.
+# - ENABLE_NATIVE_ARCH=ON forces -march=native, overriding the value
+# above. Only safe when the build host's ISA is a subset of every
+# machine the artifact will be loaded on (i.e. local dev builds).
+#
+# - TSFILE_TARGET_ARCH="" disables -march entirely, falling back to
+# the compiler's portable baseline (typically SSE2 on x86-64);
+# simde then emulates AVX2 paths with scalar code.
option(ENABLE_NATIVE_ARCH
"Add -march=native (binary will run only on the build host's CPU family)"
OFF)
option(ENABLE_LTO
"Add -flto to Release builds (link-time optimisation)"
ON)
-set(TSFILE_TARGET_ARCH "skylake-avx512" CACHE STRING
- "x86_64 -march= target used when ENABLE_NATIVE_ARCH is OFF (e.g. skylake-avx512, haswell). Empty for portable baseline.")
+set(TSFILE_TARGET_ARCH "haswell" CACHE STRING
+ "x86_64 -march= target used when ENABLE_NATIVE_ARCH is OFF (e.g. haswell, skylake-avx512). Empty for portable baseline.")
if (NOT MSVC)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")