diff options
| author | Scott Gasch <[email protected]> | 2026-10-14 12:36:24 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-10-14 12:36:24 -0700 |
| commit | bb2d7a9cce6275fcfb038c8a3ab248ba3cf2c827 (patch) | |
| tree | fd340778cf077ec53df1b144bf191ee8ae8188ea /annotate_pgns/nnue_model.py | |
| parent | 2d7d182d4ab518d9f48c5b8cef0c5f664ed9ba3f (diff) | |
Extract Search()'s per-move kernel into SearchOneMove (searchsup.c)
UNIFY_SEARCH.md step 2: pull the per-move body out of Search()'s move
loop (search.c) -- SEE, MakeMove, extension, LMP/LMR eligibility and
decision, PVS search with re-search-on-fail-high, UnmakeMove -- into
a standalone function, SearchOneMove (searchsup.c), called from
Search() in place of the inline block. HelpSearch() (split.c) is
deliberately untouched for now; unifying it onto this same kernel is
UNIFY_SEARCH.md's later step.
Not extracted (stays in Search(), per UNIFY_SEARCH.md's "what should
NOT be extracted"): move acquisition/selection, result publication
(iAlpha/mvBest bookkeeping, UpdatePV, hash storage), and the
split-launch decision. The split-launch check (StartParallelSearch)
runs BEFORE this kernel would be called for that move, unaffected.
MOVE_KERNEL_RESULT (chess.h) replaces the old goto/continue control
flow a called function can't use: SEARCHED (made, searched, unmade;
*piScore valid), PRUNED (LMP fired, never made), ILLEGAL (MakeMove
refused mv -- previously silent fall-through with no uLegalMoves
bump), ABORTED (WE_SHOULD_STOP_SEARCHING fired after the move was
already made/searched/unmade -- *piScore is a real partial result).
fFullWindow is an explicit parameter, not inferred from the
iBestScore==-INFINITY_SCORE sentinel the inline code used -- that
sentinel is only safe because HelpSearch() currently never calls
this code at all. Once HelpSearch() also calls SearchOneMove (a
later step), its own first move off the shared pool would never be
this sentinel's "node's actual first move" in the first place, so
making the caller state it explicitly removes a trap that wouldn't
assert if violated.
FORCEINLINE across the search.c/searchsup.c boundary, no new shared
header -- matches this project's own existing convention (WouldGiveCheck,
generate.c, non-static FORCEINLINE, called from half a dozen .c files,
"one of the most called codepaths... speed of the essence") rather than
needing search_inline.h as UNIFY_SEARCH.md originally sketched. Verified
actual inlining, not just assumed it: `nm`/objdump on the final linked
typhoon binary show no SearchOneMove symbol and no call instruction
anywhere -- same as WouldGiveCheck/ComputeMoveExtension/
CanWeReduceOrPruneMove, all of which inline away entirely under this
build's -flto, while non-inlined functions (Search, HelpSearch) still
show up as expected. Confirms the long parameter list costs nothing at
runtime (no call/ret/stack-marshaling survives once genuinely inlined).
Diagnostic locals crossing the old inline-block boundary resolved per
their actual #ifdef gating (checked, not assumed): fIsLeftoverMove/
fMoveIsPruneReduceEligible and the four uThisMove*Bucket values are
read only under #ifdef PERF_COUNTERS post-kernel, so they're OUT
params gated the same way; fThisMoveIsCountermoveMatch/uCMEvidenceBucket
are caller-computed before the kernel and never mutated by it, so
plain IN params under MOVE_ORDERING_EVIDENCE_COLLECTION;
fThisMoveJointExtraEligible/uThisMoveJointExtraTier never cross the
boundary at all (every consumer is inside the kernel), so they became
pure kernel-locals, dropped from Search()'s own declarations entirely.
Verification: precommit_check.sh passes. Bit-identical node counts
(per UNIFY_SEARCH.md's step-2 gate) confirmed at sd10/--cpus 1 against
the pre-extraction baseline (head_reference/pre_unification_sd10_cpus1/)
across all 191 positions in the three curated suites, zero differences
-- a pure refactor, exactly as required at this stage.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'annotate_pgns/nnue_model.py')
0 files changed, 0 insertions, 0 deletions
