Prefetch next weight tile in accumulator updates
Prefetches the next tile of each weight row while the current tile is being added in the accumulator update. The tile loops walk all changed rows together and the hardware prefetcher doesn't keep up with that many rows.
Follow-up to #7287. Only compiled in where it helped:
- rows longer than two tiles, so not avx512 (my first version lost there)
- builds with fast pext, so not the avx2 build. zen 1/2 only get avx2 builds, and vondele measured #7287 at -1.85% on his 3950X (-0.16% with the pext gate, where it's the same code as master)
So avx2, avx512 and everything else compile to the same code as master, only bmi2 and avxvnni change.
Rebased on the accumulator rewrite, and dropped the end-of-row check as mstembera suggested (prefetch never faults), so no tile index gets passed around anymore.
Passed STC on bmi2/avxvnni workers:
https://tests.stockfishchess.org/tests/view/6af2eeb28e7fb2e78bc1cd1a
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 34496 W: 8829 L: 8540 D: 17127
Ptnml(0-2): 30, 3584, 9738, 3859, 37
Rebased once more after that test, master only got a new net and an unrelated search.cpp change in between.
Earlier tests:
before the rebase: https://tests.stockfishchess.org/tests/view/6aee442e20cd2dc3f03d21ff
#7287 version, passed on all archs: https://tests.stockfishchess.org/tests/view/6aeb4c0520cd2dc3f03d1ce4
first version, failed: https://tests.stockfishchess.org/tests/view/6aea67e920cd2dc3f03d1b09
Local speed vs master, Ryzen 7 7735HS (zen 3+), bmi2 build, base and patch running at the same time: +1.6% +-0.2% with one process per core, +1.6% +-0.9% with all 16 threads busy. Smaller than before the rebase (+2.9% in the same session), the accumulator rewrite took part of it. With vs without the end-of-row check: 0.00% +-0.11%.
closes https://github.com/official-stockfish/Stockfish/pull/7294
No functional change