Lab / experiment
Four accumulators didn't help
Splitting the accumulator in Weft's SAD kernel into two and four chains, the textbook fix for a dependency chain, gave 356.3, 356.2 and 356.6 ns. Completely flat.
Compilers & SIMD, Negative resultsWeft- Machine
- Apple M5 Max, 128-bit NEON
- 1 accumulator chain
- 356.3 ns
- 2 accumulator chains
- 356.2 ns
- 4 accumulator chains
- 356.6 ns
The textbook says a single accumulator makes every iteration wait on the previous add, so split it into two or four chains and let the out-of-order core overlap them. I built that into Weft's SAD kernel and measured it.
| Accumulator chains | ns per call |
|---|---|
| 1 | 356.3 |
| 2 | 356.2 |
| 4 | 356.6 |
The accumulator wasn't what the core was waiting on. Each iteration first runs a twelve-op chain to widen the pixel lanes, and that chain is the bottleneck. The split code stays in behind a flag.