diff options
| author | Scott Gasch <[email protected]> | 2026-08-27 13:13:08 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2026-08-27 13:13:08 -0700 |
| commit | 2c44820a5cd952f3596dc34095a653cf461daef7 (patch) | |
| tree | abed39ed47f1c7be4aae3689bec7dbb6b7bd55b9 /src/chess.h | |
| parent | 489915f4c98c7aca3a63c0f35b83929e8331a597 (diff) | |
Remove ctx->uPositional and the EVAL_HASH subsystem; fix GetRoughEvalScore.
Finishes work left half-done in 7857096 ("Replace ctx->uPositional with
a data-calibrated Eval() return value"): that commit added Eval()'s new
piPositional out-param but never migrated GetRoughEvalScore onto it, so
GetRoughEvalScore's mid/deep-tree fallback kept reading the old
ctx->uPositional field -- a per-thread EWMA written only on full-eval
calls and never touched by the (far more common) lazy-eval path, so it
carried a stale value from whatever unrelated position last triggered a
full eval, potentially many nodes/plies away. Combined with EVAL_HASH
being long since disabled (its probe branch already dead), every
GetRoughEvalScore call past ply 4 was effectively "material + garbage."
Fixed by having GetRoughEvalScore just call Eval() directly -- its own
lazy-exit machinery already is the cheap, calibrated estimate this
function exists to provide, so there's no separate estimator to
maintain. Removed ctx->uPositional entirely (struct field, its EWMA
update in eval.c, both root.c init sites, split.c's cross-split
propagation, testeval.c's reset) along with the entire EVAL_HASH
subsystem (struct, table, Probe/StoreEvalHash, main.c's now-dead
reporting branch, the GNUmakefile flag) -- confirmed unused elsewhere
and explicitly being cut for good, not coming back in this form.
Also fixed GetRoughEvalScore's prototype being wrongly declared inside
#ifdef EVAL_HASH in chess.h even though the function itself is defined
and called unconditionally -- this was the source of the recurring
"call to undeclared function 'GetRoughEvalScore'" implicit-declaration
warning seen throughout this session's builds.
Separately, fixed QSearch to match its own documented intent: the
en-prise/trapped-piece "don't let this side stand pat" check now only
fires if the side hasn't already been allowed to stand pat earlier in
this qsearch line (matching the comment above it, which already said
this but the code never implemented it).
Verified against baseline/typhoon_baseline (pristine, pre-session) on
ecm_ringers.ep_ (4), ecm_hard_quick.ep_ (50-sample), and
ecm_confident_quick.ep_ (40) at sn=5M, --cpus 1, book disabled:
pristine baseline solves 3/50 on the hard sample; this commit solves
6/50, with the stand-pat fix and GetRoughEvalScore fix each
contributing +1 independently confirmed. No regressions on the other
two suites (4/4 and 40/40 unchanged throughout).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YGSMkwjqiCk4XhbfN7ugD2
Diffstat (limited to 'src/chess.h')
| -rwxr-xr-x | src/chess.h | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/src/chess.h b/src/chess.h index 9689189..630f090 100755 --- a/src/chess.h +++ b/src/chess.h @@ -907,7 +907,6 @@ typedef struct _SPLIT_INFO INT iPositionExtend; // positional extension SCORE iAlpha; // original alpha at split SCORE iBeta; // beta at split - ULONG uSplitPositional; // pos->uPositional at split CUMULATIVE_SEARCH_FLAGS sSearchFlags; // flags at split time // output from the split node @@ -953,38 +952,6 @@ typedef struct _PLY_INFO } PLY_INFO; -// #define EVAL_HASH -#ifdef EVAL_HASH -#define EVAL_HASH_TABLE_SIZE (2097152) // 32Mb (per thread) - -// -// bvFlags values for EVAL_HASH_ENTRY. EXACT means iEval is the real, -// fully-computed static eval. UPPER/LOWER mean the entry came from a -// lazy-eval early exit: iEval is the (uncorrected) partial score that -// would be returned and iBound is the proven bound on the true, fully -// computed eval (true score <= iBound for UPPER, true score >= iBound -// for LOWER). Because the bound is a fact about the position -- not -// about whatever alpha/beta window triggered the lazy exit -- it can -// be reused by a later probe with a different window, as long as that -// window is still resolved by the bound (mirrors HASH_FLAG_UPPER / -// HASH_FLAG_LOWER in the main hash table). -// -#define EVAL_HASH_EXACT 0x1 -#define EVAL_HASH_UPPER 0x2 -#define EVAL_HASH_LOWER 0x4 - -typedef struct _EVAL_HASH_ENTRY -{ - UINT64 u64Key; - SCORE iEval; - SCORE iBound; - UCHAR bvFlags; - ULONG uPositional; - COOR cTrapped[2]; - -} EVAL_HASH_ENTRY; -#endif - #define PAWN_HASH_TABLE_SIZE (131072) // 5.5Mb (per thread) typedef struct _PAWN_HASH_ENTRY { @@ -1014,7 +981,6 @@ PAWN_HASH_ENTRY; typedef struct _SEARCHER_THREAD_CONTEXT { ULONG uPly; // its distance from root - ULONG uPositional; // positional component of score POSITION sPosition; // the board MOVE_STACK sMoveStack; // the move stack CUMULATIVE_SEARCH_FLAGS sSearchFlags; @@ -1035,9 +1001,6 @@ typedef struct _SEARCHER_THREAD_CONTEXT SCORE iRootScore; ULONG uRootDepth; PAWN_HASH_ENTRY rgPawnHash[PAWN_HASH_TABLE_SIZE]; -#ifdef EVAL_HASH - EVAL_HASH_ENTRY rgEvalHash[EVAL_HASH_TABLE_SIZE]; -#endif CHAR szLastPV[SMALL_STRING_LEN_CHAR]; } SEARCHER_THREAD_CONTEXT; @@ -1060,7 +1023,6 @@ SEARCHER_THREAD_CONTEXT; typedef struct _LIGHTWEIGHT_SEARCHER_CONTEXT { ULONG uPly; - ULONG uPositional; POSITION sPosition; MOVE_STACK sMoveStack; CUMULATIVE_SEARCH_FLAGS sSearchFlags; @@ -2309,7 +2271,7 @@ IsDraw(SEARCHER_THREAD_CONTEXT *ctx); // search.c // #define QPLIES_OF_NON_CAPTURE_CHECKS (2) -#define FUTILITY_BASE_MARGIN (50) // + ctx->uPositional (min 100) +#define FUTILITY_BASE_MARGIN (50) #define DO_IID #define IID_R_FACTOR (TWO_PLY + HALF_PLY) @@ -3029,25 +2991,10 @@ RecognLookup(SEARCHER_THREAD_CONTEXT *ctx, SCORE *piScore, FLAG fProbeEGTB); -#ifdef EVAL_HASH -void -ClearEvalHashStats(void); - -void -ReportEvalHashStats(void); - -SCORE -ProbeEvalHash(SEARCHER_THREAD_CONTEXT *ctx, SCORE iAlpha, SCORE iBeta); - SCORE GetRoughEvalScore(IN SEARCHER_THREAD_CONTEXT *ctx, IN SCORE iAlpha, IN SCORE iBeta, IN FLAG fUseHash); -void -StoreEvalHash(SEARCHER_THREAD_CONTEXT *ctx, SCORE iScore, SCORE iBound, - UCHAR bvFlags); -#endif // EVAL_HASH - #endif // CHESS |
