Commit 8334bb7
committed
simd: group_walk as a (group,row) visitor; add PowerSums power-sum fold
The private keyed-reduction walker no longer takes an i64 sink: it yields
(group, row) and each fold owns its destination. The 15 existing folds
were migrated mechanically; no public signature changes.
New: PowerSums { n: u64, sum: i64, sum_sq: u128 } (#[repr(C)], 32 bytes,
layout pinned at compile time) and masked_group_power_sums_i32 with
_via / _pair, the exact degree-0/1/2 power sums per group in one pass.
A scratch benchmark chose the shapes: the visitor costs nothing for the
existing folds, and the record beats three separate lanes at large K.
The u128 square sum is load-bearing: a u64-truncation disable run turns
the four exactness tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ho2JosrXCnZPbB7RFssrse1 parent b9f8e4e commit 8334bb7
3 files changed
Lines changed: 483 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
1 | 9 | | |
2 | 10 | | |
3 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
841 | 844 | | |
842 | 845 | | |
843 | 846 | | |
| |||
863 | 866 | | |
864 | 867 | | |
865 | 868 | | |
| 869 | + | |
866 | 870 | | |
867 | 871 | | |
868 | 872 | | |
| |||
0 commit comments