macro_rules! simd_4acc_dot_loop {
($a_ptr:expr, $b_ptr:expr, $end:expr,
$zero:expr, $load:ident, $fmadd:ident, $add:ident, $lane:expr) => { ... };
}Expand description
4-accumulator unrolled SIMD loop for dot product (ILP optimization).
Processes 4 × lane elements per iteration using 4 independent
accumulators to hide FMA latency. Works across AVX2, AVX-512, and NEON
by accepting ISA-specific intrinsics as parameters.
Returns (combined_accumulator, updated_a_ptr, updated_b_ptr).
§Arguments
$a_ptr,$b_ptr— Starting pointers for the two input vectors$end— End pointer for the main loop (aligned to4 × lane)$zero— Zero-init expression (e.g.,_mm256_setzero_ps())$load— SIMD load intrinsic (e.g.,_mm256_loadu_ps)$fmadd— FMA intrinsic with signaturefmadd(a, b, acc) → a*b + acc$add— SIMD add intrinsic (e.g.,_mm256_add_ps)$lane— Number of f32 elements per SIMD register (4/8/16)
§Safety
Must be invoked inside an unsafe context where the specified
SIMD intrinsics are valid for the current CPU.