Skip to main content

Module simd

Module simd 

Source
Expand description

Pure Rust SIMD kernels for SochDB vector operations.

This module provides high-performance SIMD implementations for:

  • BPS Scan: L1 distance computation for Block Projection Sketches
  • Int8 Dot Product: Quantized dot products for reranking
  • Visibility Check: MVCC visibility bitmap generation

§Architecture

The module uses a trait-based abstraction (SimdBackend) that allows swapping between architecture-specific intrinsics (core::arch) and portable SIMD (core::simd) when it stabilizes.

§CPU Detection

Runtime CPU feature detection is used to select the optimal code path:

  • x86_64: AVX-512 > AVX2 > SSE4.1 > Scalar
  • aarch64: NEON (mandatory) + optional SVE
  • Other: Scalar fallback

§Safety

SIMD intrinsic functions are unsafe because they require specific CPU features. The dispatch layer handles feature detection and ensures that intrinsics are only called when the CPU supports them.

Re-exports§

pub use bps_scan::bps_scan;
pub use bps_scan::bps_scan_u32;
pub use dispatch::CpuFeatures;
pub use dispatch::SimdLevel;
pub use dispatch::cpu_features;
pub use dispatch::simd_level;
pub use dot_i8::dot_i8;
pub use dot_i8::dot_i8_batch;
pub use visibility::visibility_check;
pub use visibility::visibility_check_with_txn;

Modules§

bps_scan
BPS (Block Projection Sketch) L1 Distance Kernel
dispatch
Unified SIMD Dispatch Architecture
dot_i8
Int8 Dot Product Kernel
visibility
MVCC Visibility Check Kernel

Traits§

SimdBackend
Trait for SIMD backend abstraction.