docs: step 2 (Edge/Node split) in mcgs-log: gates, arena split, NPS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rektdieandclaude committed 2026-11-16 20:06:09 +01:00
1 parent fb1b8a5b93
commit 5424e1a1ce
1 file changed
+107
+107
View File
@@ -6,6 +6,7 @@ only from results the owner provides.
| step | branch | commit | bench | SPRT (link, TC, bounds) | outcome | | step | branch | commit | bench | SPRT (link, TC, bounds) | outcome |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 1 | `mcgs-stats` | `bec9871` | 663779 (normal and `STATS=1` builds) | none (never merged) | measurement only; the branch stays on its own | | 1 | `mcgs-stats` | `bec9871` | 663779 (normal and `STATS=1` builds) | none (never merged) | measurement only; the branch stays on its own |
| 2 | `mcgs-step2-split` | `fb1b8a5` | 663779 (identical to main) | | |
## Step 1 measurements ## Step 1 measurements
@@ -274,3 +275,109 @@ row, which is consistent with the counters being right.
- The no-GC figure decides which arena fills first. Step 2 should size for it, - The no-GC figure decides which arena fills first. Step 2 should size for it,
or for the middlegame value, and check that the 5000 ms Hash 64 runs do not or for the middlegame value, and check that the 5000 ms Hash 64 runs do not
hit GC on the node arena first. hit GC on the node arena first.
## Step 2: Edge/Node split (`mcgs-step2-split`)
Code at `fb1b8a5`, on top of `mcgs-plan` (`479f6cf`). Commits:
- `18911b0` tests: add `tests/fischer.epd` (sha256 `4bc384f2…70b3cd`, checked);
- `6629525` the split itself;
- `226106e` the `verify` command (VERIFY builds only);
- `fb1b8a5` the arena-split comment.
What changed: 16-byte `Edge` and 32-byte `Node` in two arenas (plan 3.2), lazy
node creation, edge visits kept equal to child visits, selection and root
decisions on edges, root index as a member, and mark → forwarding → slide →
remap compaction for both arenas with the tree-exact threshold. `key`/`check` are
set at node creation, and `u`/`base` are set by pruning. Nothing reads them yet.
`draws` stays 0. Path draws still live in `node.state`.
**Arena split: 8 edges per node** (edge arena 128 of every 160 bytes). All of the
following are local single runs at 5 s, Hash 64, on the 16 bench positions. GC runs:
| | main | 4 | 6 | 8 | 13 | 20 |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| GC runs | 200 | 217 | 183 | 184 | 184 | 249 |
- 13 (the no-GC growth ratio) cut middlegame collections further. It gave 2–3× more
in positions 11, 12 and 15, where the node arena fills first.
- 8 stays near main in every phase.
- Step 4 re-measures this split once the graph exists.
Deviations from the plan's wording:
- `src/uci.cpp` gains the VERIFY-only `verify` command.
- VERIFY builds also run `verify_tree` at the end of every search, not only on
the next search. Otherwise a single `go` would never be checked.
- `verify_tree` additionally recomputes each node's state from its position and
its path, including repetition. That is exact while the search is a tree.
- Check (b) identifies nodes by move path, not by key, because a tree has
several nodes per key.
- `info string reused N nodes` now counts positions, not child slots.
### Gates (all on the owner's machine, 2026-11-16)
- **Build:** `make -j EXE=rigby-dev` and the VERIFY build, zero warnings.
- **Bench:** `663779`, identical to main.
- **Perft:**
- `perftsuite`: all passed (590,175,385 nodes);
- `perftfile tests/fischer.epd 5`: 960 positions, 0 failed, 17,614,927,759 nodes, 53 s.
- **Reuse sequence**, Hash 256, `go nodes 50000`, 10 moves (best move plus the
second PV move): every `bestmove` and every `info depth` line (depth, seldepth,
score, nodes, PV) identical to main. Only `nps`, `time`, `hashfull` and the
`reused N` count differ.
- **VERIFY searches**, all clean (`tree verified` after every reroot, GC and
search, no abort):
- the `go nodes 200000` positions of section 6, including the 960 start with
`UCI_Chess960 true`;
- forced GC with `go nodes 300000`: Hash 1 gave 144 collections (startpos) and
121 (960); Hash 2 gave 82 and 63;
- the reuse sequence with the VERIFY build at Hash 64, at Hash 1 (28–36
collections per move) and from the 960 start.
- Under GC the output differs from main because the bytes per node differ.
That is expected.
- **`verify`:**
- (a) 96,434 random plies over 7 standard and 960 FENs, incremental key = FEN key;
- (b) three forced collections (to 1/2, 1/4, 1/8) and a reroot on 4
positions, all survivors identical.
- **Smoke:**
- `go nodes 1`, `go nodes 2`, `go depth 1` on the section 6 positions (plus
the perpetual-check bench position and two no-move positions): output
identical to main;
- cutechess-ob: 100 games of dev vs main at 2+0.02, Hash 16, UHO book, and 20
games of the VERIFY build against itself at `nodes=20000`. All games ended by
mate, the 50-move rule, repetition or insufficient material. There were no
illegal moves, disconnects, time forfeits or aborts. Not strength evidence.
- **Note:** on `6k1/5ppp/8/8/8/8/5PPP/3R2K1 w - - 0 1` both main and step 2 play
`g1f1` at 200k nodes, not `Rd8#`. White is a rook up, every move already has
Q ≈ 0.996, and the mate (Q = 1) barely stands out. This was there before the
split.
### NPS versus main (local, noisy machine)
The machine had other load (about 40 % CPU from other applications), so main and
step 2 were run interleaved.
| measurement | main | step 2 | ratio |
| --- | ---: | ---: | ---: |
| `bench` nps, 5 alternating runs each (mean) | 3,443,510 | 3,356,540 | 0.975 |
| playouts/s, 5 s per bench position, Hash 64, interleaved per position, 2 rounds | 610,987 | 545,670 | **0.893** |
| the same at Hash 1024 (no GC), 1 round | 778,216 | 679,995 | 0.874 |
- The loss grows with tree size (−2.5 % on bench's 5000-playout trees, −11 to
−13 % at 5 s). It is the same without GC, so it is in the playout, not in
compaction.
- Likely cause: selection now loads every visited child node, scattered over
the node arena, where it used to read sibling Q values from one contiguous
block.
- A software prefetch of those nodes and `alignas(32)` nodes were each tried and
each measured within noise (+0.5 %, +0.7 %). Both were dropped.
- Variant 5b (edge-Q cache) is the plan's answer to this cost.
- The drop is over 3 %, so the plan's LTC condition applies.
### SPRT (owner)
- STC Non-Regression `[-5.00, 0.00]`, 8.0+0.08, Threads=1, Hash=64,
`UHO_Lichess_4852_v1.epd`: link and outcome to be filled in.
- LTC Non-Regression `[-5.00, 0.00]`, 40.0+0.40, Threads=1, Hash=256 (NPS drop
> 3 %): link and outcome to be filled in.