You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 90d0a5c
Browse filesBrowse the repository at this point in the historyBrowse files
perf: axis reductions split columns across cores and use the SIMD kernels (#13)
On a Zen 3 (16 cores) the axis reductions of a 1024x1024 matrix lost to
NumPy 0.23-0.43x, for two reasons:
- An axis-0 reduction ran on one core: it has a single outer slab, and
RunAxisP only split outer slabs, on the belief that a column split needs
a strided gather. A band of columns is a contiguous run of every row, so
the kernels now take a column band [lo, hi) and RunAxisP hands bands of
at least 512 columns to the workers when there are fewer slabs than
workers. Rows are combined with the elementwise SIMD add/mul from 16
columns on, element by element in axis order, so the result is
unchanged.
- A row reduction (inner == 1) was a sequential scalar loop, latency-bound.
Each row now goes through the SIMD sum/max/min. Max and min are exact;
the sum is regrouped lane-parallel, as NumPy's pairwise sum is.
Zen 3, 16 cores pinned, min of three interleaved runs:
SumAxis(0) 696 -> 186 us (0.97x NumPy 1 thread)
SumAxis(1) 531 -> 92 us (2.4x NumPy)
MaxAxis(1) 601 -> 93 us (2.0x NumPy)
New test: every RunAxisP schedule (serial, slab split, column bands for
one slab and for fewer slabs than workers, narrow fallback, row sums)
for Sum/Prod/Max/Min against a naive in-order oracle, exact except the
regrouped row sum (1e-12). Shifting the band offset makes it fail.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments