Expand description
SIMD-accelerated batch arithmetic operations.
All public functions in this module are slice-iterating wrappers
over the 4-lane kernels in crate::asm_presets. The inner kernels
emit explicit AVX2 / FMA instructions via core::arch::asm! — there
is no reliance on the compiler’s auto-vectorizer (simd_review §1).
Each wrapper:
- Checks AVX2 availability once per process via
HAS_AVX2. - Splits the input into 4-element chunks aligned to the kernel width.
- Calls the kernel per chunk.
- Processes the trailing 0..3 elements with the scalar fallback, guaranteeing bit-identical results across vectorized / scalar paths.
Feature detection is hoisted out of the per-chunk inner loop using a
OnceLock<bool> — is_x86_feature_detected! touches an MMIO-mapped
CPUID leaf on x86_64 and should not be called on every inner iteration.
Enums§
- Batch
Error - Reasons a batch arithmetic operation cannot proceed.
Functions§
- batch_
abs - Batch element-wise absolute value:
result[i] = |inp[i]|. - batch_
add - Batch element-wise addition:
result[i] = lhs[i] + rhs[i]. - batch_
add_ scalar - Batch scalar addition:
result[i] = lhs[i] + scalar. - batch_
cmp_ eq - Batch IEEE-754 equality:
mask[i] = 0xFFiflhs[i] == rhs[i], else0x00. NaN never equals NaN. - batch_
coef_ merge - Batch symbolic coefficient merge:
out[i] = (coef_a[i] * coef_b[i]) * (var_x[i] * var_y[i]). - batch_
div - Batch element-wise division:
result[i] = lhs[i] / rhs[i]. - batch_
eval - Evaluates a JIT-compiled expression for each row of
var_sets. - batch_
eval_ parallel - Parallel variant of
batch_evalthat splits rows into chunks and evaluates each chunk on a separate fiber from thedtactruntime pool. - batch_
fma - Batch fused multiply-add:
out[i] = lhs[i] * rhs[i] + addend[i]with single-rounding semantics when FMA is available. - batch_
mul - Batch element-wise multiplication:
result[i] = lhs[i] * rhs[i]. - batch_
neg - Batch element-wise negation:
result[i] = -inp[i]. - batch_
pow - Batch element-wise
pow:result[i] = base[i] ^ exp[i]. - batch_
sqrt - Batch element-wise square root:
result[i] = sqrt(inp[i]). - batch_
sub - Batch element-wise subtraction:
result[i] = lhs[i] - rhs[i].