diff options
| author | Scott Gasch <[email protected]> | 2026-10-15 15:21:26 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-10-15 15:21:26 -0700 |
| commit | 2bf4eb27a473089b9b30726a678fbac27d0f8a69 (patch) | |
| tree | 23e7271eab238cf2fa97128d902c0c828e7d1583 /tests/ecm_confident_sample2.ep_ | |
| parent | ac7572166bd24868fcaf5980a91bb82fe61ba677 (diff) | |
NNUE accumulator incremental maintenance: MakeMove/UnmakeMove hookup
Wires the live NNUE accumulator (SEARCHER_THREAD_CONTEXT.sNnueAccum[2],
added in the previous commit) into real incremental maintenance,
hooked directly into the piece-movement primitives rather than
re-deriving move type from MOVE in a separate pass:
- chess.h: shared HalfKAv2_hm feature-index formula/constants
(NnueFeatureIndex and friends), moved here from nnuefeatures.c so
the reference dump and the real hot-path code can never drift
apart. Prototypes for NnueAccumAddFeature/RemoveFeature/Recompute
and the (still placeholder, zero-initialized) embedding table.
LiftPiece/PlacePiece/SlidePiece/SlidePawn/SlidePieceWithoutSigs
signatures gain an NNUE_ACCUMULATOR sNnueAccum[2] parameter.
- nnueaccum.c (new): the embedding table storage and the three
accumulator operations. Written as straight-line 256-float loops,
structured for -O3 -ffast-math auto-vectorization on this box's
AVX2+FMA target; explicit SIMD intrinsics and real weight loading
are separate, deliberately deferred follow-ups.
- move.c: all 8 Lift/Place/Slide(WithoutSigs) primitives now keep
sNnueAccum incrementally correct for both perspectives on every
call -- except when the piece is a king, where each primitive skips
its own-color perspective entirely (that perspective needs a full
recompute, not a delta, since every HalfKAv2_hm feature in it is
own-king-relative; computing an incremental update for it only to
discard it unread would be wasted work). MakeMove backs up that
perspective into the current ply's PLY_INFO.sNnueAccumBackup before
a king moves (castling or a plain step) and overwrites it via
NnueAccumRecompute once the board reflects the final position;
UnmakeMove restores it from the same backup slot. DEBUG builds tag
the backup with the color it belongs to and poison it after
consumption, release builds carry no overhead for either.
- nnuefeatures.c: now a thin board-walking wrapper around the shared
chess.h formula instead of its own duplicated copy.
- testmove.c: TestLiftPlaceSlidePiece passes a local (unread) dummy
accumulator pair -- the only caller of these primitives outside
move.c, and it never needed NNUE awareness, just a real argument.
Verified via the full precommit_check.sh (all 4 gates, including the
new combined DEBUG=1 TEST=1 self-test, which exercises MakeMove/
UnmakeMove heavily via TestMoveGenerator's perft counts and
TestLegalMoveGenerator) -- confirms nothing crashes and no existing
invariant breaks. Does NOT yet confirm the actual property that
matters (incrementally-maintained accumulator == recompute-from-
scratch) -- no test exercises that yet; next step.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'tests/ecm_confident_sample2.ep_')
0 files changed, 0 insertions, 0 deletions
