Skip to content

AVX-512 scoring path (next SIMD lever after AVX2) #27

Closed as not planned
Closed as not planned

Description

@ajianaz

Context

AVX2 (#11/#17) closed the biggest x86_64 gap. KScaNN confirms wider registers directly raise asymmetric-distance-computation throughput; usearch already ships AVX-512/FP16 paths. Gather-based 4-bit scoring maps cleanly to AVX-512 (32 lanes/ymm→zmm, masked gathers).

Design

  • avx512 module mirroring avx2: score_avx512 + score_avx512_8 (8-vector batch, zmm accumulators).
  • Runtime detection order: AVX-512 (checked features subset — e.g. avx512f, avx512vl, avx512bw, avx512cd for vgatherdps zmm) → AVX2 → scalar. Same fixed association order; bit-identity tests vs scalar mandatory.
  • Caution: AVX-512 downclocking on some server CPUs — measure; the win may be smaller than AVX2's. Decide by benchmark, not by default.

Acceptance

  • Kernels + bit-identity tests (AVX-512 == AVX2 == scalar == NEON)
  • Detection tests skip gracefully on non-AVX-512 CI runners (GitHub ubuntu runners mostly lack AVX-512 — consider a labeled self-hosted runner or QEMU later; Rosetta is NOT an option, see feat(core): x86_64 AVX2 scoring path (parity with NEON, bit-identity tested) #17)
  • Benchmark vs AVX2 on AVX-512 hardware before making it the default dispatch

Dependencies

After AVX2 (done) has soaked in production. Medium effort; hardware access is the main constraint.

Activity

  1. ajianaz commented on Aug 29, 2026

    @ajianaz
    ContributorAuthor

    Re-scope + honest status

    Still a valid idea for x86_64 server deployments, but two facts lower its priority:

    1. Target hardware: vecq's thesis is edge/mobile = aarch64, where AVX-512 is irrelevant. The aarch64 NEON paths are the tuned ones.
    2. Cannot be validated on the maintainer's current host (aarch64 only). The repo's bar for SIMD code is bitwise parity tests plus measured benchmarks on real hardware (merge gate). Shipping an AVX-512 kernel that was only compile-checked would violate that bar — the x86_64 4-bit path stays on the AVX2 kernel, which is bit-identical and well-measured.

    If anyone picks this up: scope is the 4-bit path (score_avx2/score_avx24 → 512-bit equivalents, zmm LUT gather via vpermi2b-style table ops), runtime-detected on top of the existing is_x86__feature_detected! gate, with the same fixed association order. The 5/6-bit wide path is NOT the place to start — it is extraction-bound on any SIMD width (see #40 ceiling analysis) until split-layout codes exist.

  2. ajianaz commented on Aug 29, 2026

    @ajianaz
    ContributorAuthor

    Closing as not-planned for now (re-scoped in the comment above): valid future lever for x86_64 server deployments, but (1) vecq's target is aarch64 edge where it is irrelevant, and (2) the repo's bar — bitwise parity + measured benchmarks on real hardware — cannot be met from the current aarch64-only maintainer host. The comment documents the exact scope (4-bit zmm path, runtime detection, fixed association order) for any contributor with AVX-512 hardware. Reopen with benchmarks when that hardware shows up.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions