Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Unified SIMD Dispatch Architecture

This module provides compile-time and runtime CPU feature detection and dispatch for SIMD operations.

§Architecture

The dispatch system supports two modes:

  1. Compile-Time Dispatch (#[cfg] attributes): Used when target is known
  2. Runtime Dispatch (CPUID/feature detection): For portable binaries

§Usage

use sochdb_vector::simd::dispatch::{cpu_features, simd_level, SimdLevel};

let features = cpu_features();
if features.has_avx2 {
    println!("AVX2 is available!");
}

match simd_level() {
    SimdLevel::Avx512 => println!("Using AVX-512"),
    SimdLevel::Avx2 => println!("Using AVX2"),
    SimdLevel::Neon => println!("Using NEON"),
    _ => println!("Using scalar fallback"),
}

Structs§

CpuFeatures
CPU feature flags detected at runtime.

Enums§

SimdLevel
SIMD capability level.

Functions§

cpu_features
Get detected CPU features (cached).
dispatch_info
Get a human-readable description of SIMD capabilities.
simd_available
Check if SIMD acceleration is available.
simd_level
Get best available SIMD level.