Expand description
CPU reference microkernels — one per KernelClass.
These serve two roles at once (plan §3 + §5 step 4):
- The panel’s CPU measurement — each is the representative microkernel timed to give the CPU’s per-class throughput row.
- The correctness reference — any GPU/NPU/vendor kernel for a class must match its CPU reference within the class tolerance before it may be the default. “A faster wrong answer is a regression.”
They are plain, correct, scalar/rayon implementations over caller-owned slices.
The CPU path is always present and never hard-fails (plan §7).
Functions§
- allpairs_
potential AllPairs: total pairwise inverse-distance potentialΣ_{i<j} 1/|p_i − p_j|over 3-D points (pts.len()==3·n). A representative N-body reduction.- axpb
ElementwiseMap: fusedy = a·x + bover a large vector.- fft_
radix2 Fft: in-place iterative radix-2 Cooley–Tukey FFT of a complex signal held as parallelre/imslices.re.len()==im.len()must be a power of two.inverse=falseis the forward transform (no 1/N scaling — matches the textbook DFT the tests check against).- gemv
DenseLinear: GEMVy = W·x,Wrow-majorn×n.y.len()==n,x.len()==n.- monte_
carlo_ pi Divergent: a branch-heavy Monte-Carlo step — estimate π by the fraction ofstepsdeterministic-LCG samples landing inside the unit circle (×4). The branch (inside ? ... : ...) is the divergence this class represents. Deterministic so it is reproducible as a correctness reference.- prefix_
sum Scan: inclusive prefix sumy[i] = Σ_{k≤i} x[k].y.len()==x.len().- reduce_
sum Reduction: sum of a large vector (pairwise/parallel; deterministic enough for the tolerance gate).- stencil3
Stencil: 1-D 3-point Laplaciany[i] = x[i-1] - 2·x[i] + x[i+1], with the ends clamped (one-sided zero).y.len()==x.len().