From: Joost VandeVondele Date: Thu, 13 Jun 2019 20:32:23 +0000 (+0200) Subject: Fix progress issue with shuffling extensions X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=59f1d0c7dd3fcca307a18ff493ce07e290754a2b Fix progress issue with shuffling extensions Fixes issues #2126 and #2189 where no progress in rootDepth is made for particular fens: 8/8/3P3k/8/1p6/8/1P6/1K3n2 b - - 0 1 8/1r1rp1k1/1b1pPp2/2pP1Pp1/1pP3Pp/pP5P/P5K1/8 w - - 79 46 the cause are the shuffle extensions. Upon closer analysis, it appears that in these cases a shuffle extension is made for every node searched, and progess can not be made. This patch implements a fix, namely to limit the number of extensions relative to the number of nodes searched. The ratio employed is 1/4, which fixes the issues seen so far, but it is a heuristic, and I expect that certain positions might require an even smaller fraction. The patch was tested as a bug fix and passed: STC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 56601 W: 12633 L: 12581 D: 31387 http://tests.stockfishchess.org/tests/view/5d02b37a0ebc5925cf09f6da LTC: LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 52042 W: 8907 L: 8837 D: 34298 http://tests.stockfishchess.org/tests/view/5d0319420ebc5925cf09fe57 Furthermore, to confirm that the shuffle extension in this form indeed still brings Elo, one more test at VLTC was performed: VLTC: LLR: 2.96 (-2.94,2.94) [0.00,3.50] Total: 142022 W: 20963 L: 20435 D: 100624 http://tests.stockfishchess.org/tests/view/5d03630d0ebc5925cf0a011a Bench: 3961247 --- diff --git a/src/search.cpp b/src/search.cpp index 047a0892..9919b0cc 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -932,7 +932,7 @@ moves_loop: // When in check, search starts from here else if ( PvNode && pos.rule50_count() > 18 && depth < 3 * ONE_PLY - && ss->ply < 3 * thisThread->rootDepth / ONE_PLY) // To avoid too deep searches + && ++thisThread->shuffleExts < thisThread->nodes.load(std::memory_order_relaxed) / 4) // To avoid too many extensions extension = ONE_PLY; // Passed pawn extension diff --git a/src/thread.cpp b/src/thread.cpp index 2f1237a3..e5043b6e 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -191,7 +191,7 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states, for (Thread* th : *this) { - th->nodes = th->tbHits = th->nmpMinPly = 0; + th->shuffleExts = th->nodes = th->tbHits = th->nmpMinPly = 0; th->rootDepth = th->completedDepth = DEPTH_ZERO; th->rootMoves = rootMoves; th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th); diff --git a/src/thread.h b/src/thread.h index 114769d2..c11d1787 100644 --- a/src/thread.h +++ b/src/thread.h @@ -59,7 +59,7 @@ public: Pawns::Table pawnsTable; Material::Table materialTable; - size_t pvIdx, pvLast; + size_t pvIdx, pvLast, shuffleExts; int selDepth, nmpMinPly; Color nmpColor; std::atomic nodes, tbHits, bestMoveChanges;