diff options
| author | Scott Gasch <[email protected]> | 2026-10-14 12:41:05 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-10-14 12:41:05 -0700 |
| commit | dc77f67396cd99aea4ac1567f55ca3d8c6825fb7 (patch) | |
| tree | e24c44a1c668de86c78e285d0bd8b4592e055d39 /src | |
| parent | bb2d7a9cce6275fcfb038c8a3ab248ba3cf2c827 (diff) | |
Plumb fThreat and attack snapshots into SPLIT_INFO (prep for step 4)
UNIFY_SEARCH.md step 3: add fThreat and the two attack-snapshot
bitboards (bbMinorAttacksSnapshot/bbRookAttacksSnapshot) to SPLIT_INFO
(chess.h), populated by StartParallelSearch (split.c) from values the
originating thread already has at split-launch time, passed through
from search.c's call site.
Plumbing only -- nothing reads these fields yet (HelpSearch() still
runs its own inline copy, untouched). That's step 4: unify
HelpSearch() onto SearchOneMove, at which point it can pass these
real values instead of the zeroed snapshots and missing fThreat its
current hand-rolled gate has.
Sequenced before step 4 deliberately (not combined or left for
after): landing the plumbing first means there's no window where
HelpSearch() calls the real CanWeReduceOrPruneMove()/ShouldLatePrune()
gate with stale/zeroed snapshots -- see UNIFY_SEARCH.md's note on why
that matters for FH_TABLE_COLLECTION's sampling.
Verified: precommit_check.sh passes. Bit-identical node counts at
sd10/--cpus 1 across all three curated suites, zero change (expected
-- single-threaded path never reads these new fields). cpus 4 smoke
run across all three suites: clean exits, no crashes.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src')
| -rwxr-xr-x | src/chess.h | 19 | ||||
| -rw-r--r-- | src/search.c | 5 | ||||
| -rw-r--r-- | src/split.c | 20 |
3 files changed, 41 insertions, 3 deletions
diff --git a/src/chess.h b/src/chess.h index a985c16..3a1f842 100755 --- a/src/chess.h +++ b/src/chess.h @@ -1548,6 +1548,20 @@ typedef struct _SPLIT_INFO SCORE iBeta; // beta at split SCORE iEval; // static eval at split SCORE iImprovement; // eval improvement since ply-2 (may be negative) + FLAG fThreat; // node-wide threat extension in play at + // the split point -- CanWeReduceOrPruneMove + // needs this; populated by the originating + // thread (it already has it, computed + // before the split-launch decision), not + // recomputed by helper threads + BITBOARD bbMinorAttacksSnapshot[2]; // attack-table snapshots from the + BITBOARD bbRookAttacksSnapshot[2]; // originating thread's own Search() call, + // for EstimateHangingMaterialCp -- helper + // threads have no access to the + // originating node's pos->bbMinorAttacks/ + // bbRookAttacks (those are this-node-local, + // not replayed via mvPathToHere), so without + // this they'd degrade to all-zero snapshots NODE_TYPE eNodeType; // the split point's own node type -- // copied here rather than read off a // helper thread's own ctx->sPlyInfo, @@ -4765,7 +4779,10 @@ StartParallelSearch(IN SEARCHER_THREAD_CONTEXT *ctx, IN OUT MOVE *pmvBest, IN ULONG uMoveNum, IN INT iPositionExtend, - IN ULONG uDepth); + IN ULONG uDepth, + IN FLAG fThreat, + IN BITBOARD bbMinorAttacksSnapshot[2], + IN BITBOARD bbRookAttacksSnapshot[2]); void InitializeSearcherContext(POSITION *pos, SEARCHER_THREAD_CONTEXT *ctx); diff --git a/src/search.c b/src/search.c index 78c473c..6e9c4da 100644 --- a/src/search.c +++ b/src/search.c @@ -977,7 +977,10 @@ Search(IN SEARCHER_THREAD_CONTEXT *ctx, &mvBest, (x - 1), iPositionalExtend, - uDepth); + uDepth, + fThreat, + bbMinorAttacksSnapshot, + bbRookAttacksSnapshot); ASSERT(iAlpha < iBeta); ASSERT((IS_SAME_MOVE(pi->PV[ctx->uPly], mvBest)) || (iScore <= iAlpha) || (iScore >= iBeta)); diff --git a/src/split.c b/src/split.c index 2997661..fd65f2b 100644 --- a/src/split.c +++ b/src/split.c @@ -472,7 +472,10 @@ StartParallelSearch(IN SEARCHER_THREAD_CONTEXT *ctx, IN OUT MOVE *pmvBest, IN ULONG uMoveNum, IN INT iPositionExtend, - IN ULONG uDepth) + IN ULONG uDepth, + IN FLAG fThreat, + IN BITBOARD bbMinorAttacksSnapshot[2], + IN BITBOARD bbRookAttacksSnapshot[2]) { /** @@ -500,6 +503,16 @@ Parameters: ULONG uMoveNum : in next move number in ctx->sMoveStack INT iPositionExtend : in position based extensions for split node ULONG uDepth : in the depth we need to search to + FLAG fThreat : in whether a node-wide threat extension is in play at + the split point -- stashed into g_SplitInfo so a + future HelpSearch() can call CanWeReduceOrPruneMove's + real gate instead of its own hand-rolled approximation + BITBOARD bbMinorAttacksSnapshot[2] : in the originating thread's own + attack-table snapshots (see search.c's + fParentAttackTablesAreFresh) -- stashed into + g_SplitInfo for the same reason as fThreat; helper + threads have no other way to get a non-zero snapshot + BITBOARD bbRookAttacksSnapshot[2] : in, same as bbMinorAttacksSnapshot Return value: @@ -576,6 +589,11 @@ Return value: sizeof(POSITION)); g_SplitInfo[u].iEval = ctx->sPlyInfo[ctx->uPly].iEval; g_SplitInfo[u].iImprovement = iImprovement; + g_SplitInfo[u].fThreat = fThreat; + g_SplitInfo[u].bbMinorAttacksSnapshot[WHITE] = bbMinorAttacksSnapshot[WHITE]; + g_SplitInfo[u].bbMinorAttacksSnapshot[BLACK] = bbMinorAttacksSnapshot[BLACK]; + g_SplitInfo[u].bbRookAttacksSnapshot[WHITE] = bbRookAttacksSnapshot[WHITE]; + g_SplitInfo[u].bbRookAttacksSnapshot[BLACK] = bbRookAttacksSnapshot[BLACK]; g_SplitInfo[u].eNodeType = ctx->sPlyInfo[ctx->uPly].eNodeType; #if DEBUG g_SplitInfo[u].uSplitPly = ctx->uPly; |
