Skip to content

[Perf][C++] SIMD bit-unpack kernels run as portable fallbacks in default builds; add runtime AVX2 dispatch #1073

Open

Description

@ColinLeeo

Problem

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.

Related: #1072

Activity

  1. added this to the 2.5.1 milestone on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions