You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Perf][C++] SIMD bit-unpack kernels run as portable fallbacks in default builds; add runtime AVX2 dispatch #1073
ENABLE_SIMD only defines -DENABLE_SIMD. The library targets the portable x86-64 baseline (SSE2) and never compiles with -mavx2/-mssse3, so simde's AVX2/SSSE3 intrinsics (vpgatherqq, vpshufb, ...) compile to simde's portable fallback.
Micro-benchmark of the RLE bit-unpack (same header, only difference is -mavx2):
width 14: 99 → 644 M values/s (6.5×)
width 20: 99 → 612 M values/s (6.2×)
So the SIMD paths added in #823 / #898 (PLAIN, GORILLA, TS_2DIFF) and the RLE packers were not running real AVX2 in shipped builds.
Proposed changes
Add common/simd_dispatch.h with cpu_has_avx2() (__builtin_cpu_supports("avx2"), GCC/Clang on x86 only).
Add __attribute__((target("avx2"))) intrinsic twins of the bit-unpack kernels, dispatched at runtime; keep the simde path as the portable fallback.
Implemented for RLE and TS_2DIFF in #1072. PLAIN / GORILLA kernels can follow the same pattern.
Resolved by #1078 (commit 1848341). The RLE bit-unpack kernels now dispatch to native AVX2 intrinsics at runtime: cpp/src/common/simd_dispatch.h exposes common::cpu_has_avx2() (__builtin_cpu_supports("avx2")) and int32_packer.h / int64_packer.h pick the native kernel per packer instance instead of relying on the translation unit being compiled with -mavx2. The widths that can cross a ninth byte (59/61/62/63) keep the 128-bit buffered scalar fallback, and the simde path remains for CPUs without AVX2.
Activity
ColinLeeo commentedon Nov 16, 2026
Resolved by #1078 (commit 1848341). The RLE bit-unpack kernels now dispatch to native AVX2 intrinsics at runtime:
cpp/src/common/simd_dispatch.hexposescommon::cpu_has_avx2()(__builtin_cpu_supports("avx2")) andint32_packer.h/int64_packer.hpick the native kernel per packer instance instead of relying on the translation unit being compiled with-mavx2. The widths that can cross a ninth byte (59/61/62/63) keep the 128-bit buffered scalar fallback, and the simde path remains for CPUs without AVX2.Closing as completed in develop.