From: J. Oster Date: Tue, 5 Oct 2021 10:02:25 +0000 (+0200) Subject: Time-management fix in MultiPV mode. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=371b522e9ed9cab91274ff111c0bf4b0f6ec3340 Time-management fix in MultiPV mode. When playing games in MultiPV mode we must take care to only track the best move changing for the first PV line. Otherwise, SF will spend most of its time for the initial moves after the book exit. This has been observed and reported on Discord, but can also be seen in games played in Stefan Pohl's MultiPV experiment. Tested with MultiPV=4. STC: https://tests.stockfishchess.org/tests/view/615c24b59d256038a969b990 LLR: 2.95 (-2.94,2.94) <-0.50,2.50> Total: 1744 W: 694 L: 447 D: 603 Ptnml(0-2): 32, 125, 358, 278, 79 LTC: https://tests.stockfishchess.org/tests/view/615c31769d256038a969b993 LLR: 2.94 (-2.94,2.94) <0.50,3.50> Total: 2048 W: 723 L: 525 D: 800 Ptnml(0-2): 10, 158, 511, 314, 31 closes https://github.com/official-stockfish/Stockfish/pull/3729 Bench: 5714575 --- diff --git a/src/search.cpp b/src/search.cpp index 3eb8e9e1..df4af54a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1314,9 +1314,11 @@ moves_loop: // When in check, search starts here for (Move* m = (ss+1)->pv; *m != MOVE_NONE; ++m) rm.pv.push_back(*m); - // We record how often the best move has been changed in each - // iteration. This information is used for time management and LMR - if (moveCount > 1) + // We record how often the best move has been changed in each iteration. + // This information is used for time management and LMR. In MultiPV mode, + // we must take care to only do this for the first PV line. + if ( moveCount > 1 + && !thisThread->pvIdx) ++thisThread->bestMoveChanges; } else