The value and policy networks run on hand-written vector kernels (src/simd.h) instead of plain loops left to the auto-vectoriser. Paths for AVX-512BW (VNNI when present), AVX2 (AVX-VNNI when present), SSE2 (SSE4.1 when present) and NEON, chosen at compile time by -march=native, plus a scalar fallback (-DRIGBY_NO_SIMD). All arithmetic is exact integer maths, so the bench is unchanged.
Value net: register-tiled refresh, single-pass update, SCReLU as v * (v * w) with mullo + madd (output weights checked to be ≤ 128 on load).
Policy net: register-tiled hidden layer over the i8 rows (1.8x faster than row by row), CReLU and pairwise product in one pass, output dot products four moves at a time.
Tried and dropped: software prefetch of the weight rows, i16 storage of the policy's first layer (both slower).
Speed on a Ryzen 9 5900X (AVX2), bench 50000: main 4.43M nps → 5.21M nps (+18%).
The value and policy networks run on hand-written vector kernels (`src/simd.h`) instead of plain loops left to the auto-vectoriser. Paths for AVX-512BW (VNNI when present), AVX2 (AVX-VNNI when present), SSE2 (SSE4.1 when present) and NEON, chosen at compile time by `-march=native`, plus a scalar fallback (`-DRIGBY_NO_SIMD`). All arithmetic is exact integer maths, so the bench is unchanged.
- Value net: register-tiled `refresh`, single-pass `update`, SCReLU as `v * (v * w)` with mullo + madd (output weights checked to be ≤ 128 on load).
- Policy net: register-tiled hidden layer over the i8 rows (1.8x faster than row by row), CReLU and pairwise product in one pass, output dot products four moves at a time.
- Tried and dropped: software prefetch of the weight rows, i16 storage of the policy's first layer (both slower).
Speed on a Ryzen 9 5900X (AVX2), `bench 50000`: main 4.43M nps → 5.21M nps (+18%).
## SPRT
https://bench.rektdie.com/test/5308/
```
Elo | 29.49 +- 11.23 (95%)
SPRT | 8.0+0.08s Threads=1 Hash=64MB
LLR | 3.13 (-2.94, 2.94) [-5.00, 0.00]
Games | N: 1618 W: 582 L: 445 D: 591
Penta | [29, 134, 388, 187, 71]
```
## Correctness
- Bench 615835 identical for the AVX2, SSE2, SSE4.1 and scalar builds, and the same as main.
- AVX-512 (skylake-avx512, icelake-server) and AVX-VNNI (alderlake) builds compile; the NEON kernels compile for aarch64 (not run).
- UCI: `uci`, `isready`, `position`, `go nodes`, `setoption PolicyFile`.
Bench: 615835
🤖 Generated with [Claude Code](https://claude.com/claude-code)
The value and policy networks now run on hand-written vector kernels
(src/simd.h) instead of plain loops left to the auto-vectoriser. Paths for
AVX-512BW (VNNI dpwssd when present), AVX2 (AVX-VNNI when present), SSE2
(SSE4.1 sign extend when present) and NEON, chosen at compile time by
-march=native, plus a scalar fallback (-DRIGBY_NO_SIMD).
All arithmetic is exact integer maths, so every path gives the same results
as before and the bench is unchanged.
Value net:
- refresh sums the feature rows in registers, one tile at a time, and
writes the accumulator once instead of once per piece
- update adds and subtracts the changed rows in one vector pass
- evaluate does SCReLU as v * (v * w) with mullo + madd; v * w fits
16 bits because the output weights are at most 32767 / QA = 128 (now
checked on load; the v1 net's largest is 127), and each half's sum fits
32 bits (static_assert)
Policy net:
- the hidden layer sums the i8 rows (sign-extended on load) into
register tiles of 8 vectors; row by row in memory was 1.8x slower
- CReLU and the pairwise product in one vector pass
- the output dot products run four moves at a time, sharing the loads of
the activations (output stage about 20% faster than one at a time)
Tried and dropped: software prefetch of the weight rows (slower), storing
the policy's first layer as i16 to skip the sign extend (slower: the
accumulation is bound by memory, not by the extend).
Measured on a Ryzen 9 5900X (AVX2), bench 50000, four runs each:
main 4.43M nps, this 5.21M nps (+18%).
Checked: bench 615835 identical for AVX2, SSE2, SSE4.1 and scalar builds;
AVX-512 (skylake-avx512, icelake-server) and AVX-VNNI (alderlake) builds
compile; the NEON kernels compile for aarch64 (not run). UCI: uci,
isready, position, go nodes, setoption PolicyFile.
Bench: 615835
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude
merged commit 2d3be1982c into main2026-11-16 15:43:58 +01:00
claude
deleted branch simd-inference2026-11-16 15:43:59 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The value and policy networks run on hand-written vector kernels (
src/simd.h) instead of plain loops left to the auto-vectoriser. Paths for AVX-512BW (VNNI when present), AVX2 (AVX-VNNI when present), SSE2 (SSE4.1 when present) and NEON, chosen at compile time by-march=native, plus a scalar fallback (-DRIGBY_NO_SIMD). All arithmetic is exact integer maths, so the bench is unchanged.refresh, single-passupdate, SCReLU asv * (v * w)with mullo + madd (output weights checked to be ≤ 128 on load).Speed on a Ryzen 9 5900X (AVX2),
bench 50000: main 4.43M nps → 5.21M nps (+18%).SPRT
https://bench.rektdie.com/test/5308/
Correctness
uci,isready,position,go nodes,setoption PolicyFile.Bench: 615835
🤖 Generated with Claude Code