fn
sum_axis_f32
void sum_axis_f32(const float * in, float * out, int outer, int reduce_dim, int inner)Reduces a single axis by summation into a packed (outer, inner) output.
For each (o, i) pair the kernel walks the reduce dimension contiguously
when inner == 1 and dispatches to Accelerate's vDSP_sve for a
vectorised compensated-sum implementation; in the strided case it falls
back to the scalar axis_reduce template with identity 0.
Math
See Also
max_axis_f32, min_axis_f32, prod_axis_f32 : Companion reductions sharing the
same (outer, reduce_dim, inner) layout convention.
Parameters
inconst float*Source buffer laid out as
(outer, reduce_dim, inner) in row-major order.outfloat*Destination buffer of shape
(outer, inner); written densely.outerstd::size_tProduct of all dimensions strictly before the reduce axis. May be
0.reduce_dimstd::size_tSize of the axis being summed. A value of
0 yields 0 per cell (the additive identity).innerstd::size_tProduct of all dimensions strictly after the reduce axis.
Notes
The contiguous fast path uses vDSP_sve which performs a vectorised
single-pass summation on Apple Silicon NEON. Numerical results may differ
from the scalar loop by a few ULP for very long reductions but are typically
stabler.