summaryrefslogtreecommitdiff
path: root/src/split.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-14 12:41:05 -0700
committerScott Gasch <[email protected]>2026-10-14 12:41:05 -0700
commitdc77f67396cd99aea4ac1567f55ca3d8c6825fb7 (patch)
treee24c44a1c668de86c78e285d0bd8b4592e055d39 /src/split.c
parentbb2d7a9cce6275fcfb038c8a3ab248ba3cf2c827 (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/split.c')
-rw-r--r--src/split.c20
1 files changed, 19 insertions, 1 deletions
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;