slate-simd 0.0.1

SIMD distance kernels (AVX-512/AVX2/NEON/scalar) with runtime dispatch for Slate-ANN
Documentation

slate-simd

SIMD distance kernels for Slate-ANN with runtime CPU-feature dispatch.

Provides L2², inner-product, and cosine distance over f32, plus asymmetric f32-query vs narrow-stored kernels ([distance_f16], [distance_i8]) that widen the on-disk representation inside the SIMD reduction so narrow stores skip a decode-to-f32 pass. Four implementation tiers are selected at runtime — AVX-512, AVX2+FMA, ARM NEON, and a portable scalar fallback (also the correctness oracle for the vectorized paths).

Ranking convention

Mirrors [slate_core::Metric]: all distances rank by ascending score (smaller = closer).

  • [l2_sq] — squared Euclidean (no sqrt; preserves ordering).
  • [inner_product] — negated dot product (−⟨a,b⟩).
  • [cosine] — 1 − cos(a,b) over raw inputs; [cosine_normalized] is the cheaper 1 − ⟨a,b⟩ for pre-normalized inputs.

Safety model

Vectorized kernels use #[target_feature] intrinsics (unsafe). They are only ever invoked behind the runtime dispatcher in [dispatch], which confirms CPU support before selecting a tier. The public API below is entirely safe and validates that input slices have equal length.

Populated in Phase 1 (f32 kernels + dispatch); narrow-store kernels added in the Phase-9.5 deferred clean-ups.