incant!() { /* proc-macro */ }Expand description
Dispatch to platform-specific SIMD variants.
§Entry Point Mode (no token yet)
Summons tokens and dispatches to the best available variant:
pub fn public_api(data: &[f32]) -> f32 {
incant!(dot(data))
}Expands to runtime feature detection + dispatch to dot_v3, dot_v4,
dot_neon, dot_wasm128, or dot_scalar.
§Explicit Tiers
Specify which tiers to dispatch to:
// Only dispatch to v1, v3, neon, and scalar
pub fn api(data: &[f32]) -> f32 {
incant!(process(data), [v1, v3, neon, scalar])
}Always include scalar in explicit tier lists — incant! always
emits a fn_scalar() call as the final fallback, and listing it
documents this dependency. Currently auto-appended if omitted;
will become a compile error in v1.0. Unknown tier names cause a
compile error. Tiers are automatically sorted into correct
dispatch order (highest priority first).
Known tiers: v1, v2, v3, v4, v4x, neon, neon_aes,
neon_sha3, neon_crc, wasm128, wasm128_relaxed, scalar.
§Passthrough Mode (already have token)
Uses compile-time dispatch via IntoConcreteToken:
#[arcane]
fn outer(token: X64V3Token, data: &[f32]) -> f32 {
incant!(inner(data) with token)
}Also supports explicit tiers:
fn inner<T: IntoConcreteToken>(token: T, data: &[f32]) -> f32 {
incant!(process(data) with token, [v3, neon, scalar])
}The compiler monomorphizes the dispatch, eliminating non-matching branches.
§Variant Naming
Functions must have suffixed variants matching the selected tiers:
_v1forX64V1Token_v2forX64V2Token_v3forX64V3Token_v4forX64V4Token(requiresavx512feature)_v4xforX64V4xToken(requiresavx512feature)_neonforNeonToken_neon_aesforNeonAesToken_neon_sha3forNeonSha3Token_neon_crcforNeonCrcToken_wasm128forWasm128Token_scalarforScalarToken