summaryrefslogtreecommitdiff
path: root/src/movesup.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-13 23:22:10 -0700
committerScott Gasch <[email protected]>2026-10-13 23:22:10 -0700
commitdad4620a92f51a1d0825fc99fa98fd2b16c0f280 (patch)
tree865a0f210b6d3ad49779617ba73a3e04c02aad4e /src/movesup.c
parent7400001fc2d43a507b54281f9860c60177860fe5 (diff)
Add alpha-side static null-move skip gate and Search() perf hoists
Reuses the joint FH% table on the iEval <= iAlpha side to skip the null-move probe attempt when it's predicted unlikely to succeed (EV-neutral: the real move loop still runs regardless). Also hoists several node-constant computations (ImproveBucket, MP split-eligibility checks) out of the per-move loop in Search(), and adds GNUmakefile overrides for sweeping NULLMOVE_SKIP_FH_CEILING_THOUSANDTHS and SKIP_SELECT_AFTER_N_MOVES from the command line. Self-play vs. head is trending positive overnight (1020 games, llr=+1.36, score=0.527) but not yet conclusive -- committing now to checkpoint the change while the match continues. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/movesup.c')
-rw-r--r--src/movesup.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/movesup.c b/src/movesup.c
index d3d2a74..4b86947 100644
--- a/src/movesup.c
+++ b/src/movesup.c
@@ -23,6 +23,18 @@ Revision History:
#include "chess.h"
+// 2026-10-13: SelectBestWithHistory's skip-selection-sort threshold --
+// see its own comment. 6 is the chosen default: swept 2,4,6,8,12,20
+// against both ECM halves at sd10 (noisy, non-monotonic, but 6/8/12
+// all looked solid) and against 1000 cross_sectional_2.ep_ positions
+// (cleaner signal at this larger, non-tactical sample -- 6/8/12 all
+// real small wins on both nps and node count; 10 was consistently the
+// worst of the four across both samples). Still overridable for
+// further sweeping.
+#ifndef SKIP_SELECT_AFTER_N_MOVES
+#define SKIP_SELECT_AFTER_N_MOVES (6)
+#endif
+
// Unlike GetAttacks (a real asm symbol in a different file, so
// chess.h's macro-swap never touches its own definition),
// ExposesCheck/FasterExposesCheck/ExposesCheckEp's mailbox
@@ -1430,6 +1442,20 @@ Return value:
ASSERT(u >= ctx->sMoveStack.uBegin[ctx->uPly]);
ASSERT(u < uEnd);
+ // 2026-10-13: sweep knob -- once we've already tried this many
+ // moves at a node the cheap eNodeType guess calls ALL (expected
+ // to search everything anyway), skip the scan/swap below entirely
+ // and just take whatever's at the front in generation order. #5
+ // hottest function in the engine by cycle share; this is the
+ // whole point of the experiment -- skip the O(remaining) scan,
+ // not shrink it. 0xFFFFFFFF (effectively disabled) is the default
+ // so baseline behavior is unchanged unless swept.
+ if ((NODE_ALL == ctx->sPlyInfo[ctx->uPly].eNodeType) &&
+ ((u - ctx->sMoveStack.uBegin[ctx->uPly]) >= SKIP_SELECT_AFTER_N_MOVES))
+ {
+ return;
+ }
+
// Flee-to-safety: a small, same-tier selection-time nudge (not a
// GOOD_MOVE promotion -- that class was retired, see generate.c's
// RETIRED comment) for a quiet move whose origin square is