Skip to main content

which_kernel

Function which_kernel 

Source
pub fn which_kernel() -> &'static str
Available on crate features testing only.
Expand description

Return the kernel a distance call would dispatch to right now, as a short identifier: "scalar", "avx2", or "neon".

This accessor exists so the differential SIMD-vs-scalar test can prove the dispatcher actually routed to the host’s SIMD kernel before gathering “SIMD” samples — without this, a runtime detection regression that silently fell back to scalar would let the test pass vacuously (scalar-vs-scalar comparison).

Built only under cfg(any(test, feature = "testing")). Not part of the stable public surface — the return type and strings are testing-internals and may change.

Internally delegates to the crate-private select_kernel, the same function the real dispatch path uses, so the test cannot disagree with reality.

§Examples

// On any host the accessor returns one of "scalar", "avx2", "neon".
let kernel = iqdb_distance::which_kernel();
assert!(matches!(kernel, "scalar" | "avx2" | "neon"));