From b01fdb596a196f966549f7132c042ab67962fbbd Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Wed, 12 Jun 2024 13:23:26 +0200 Subject: [PATCH] Fix upperbound/lowerbound output in multithreaded case In case a stop is received during multithreaded searches, the PV of the best thread might be printed without the correct upperbound/lowerbound indicators. This was due to the pvIdx variable being incremented after receiving the stop. passed STC: https://tests.stockfishchess.org/tests/view/666985da602682471b064d08 LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 196576 W: 51039 L: 50996 D: 94541 Ptnml(0-2): 760, 22545, 51603, 22652, 728 closes https://github.com/official-stockfish/Stockfish/pull/5391 Bench: 1160467 --- src/search.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index 91b3c789..af0ab400 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -299,7 +299,7 @@ void Search::Worker::iterative_deepening() { searchAgainCounter++; // MultiPV loop. We perform a full root search for each PV line - for (pvIdx = 0; pvIdx < multiPV && !threads.stop; ++pvIdx) + for (pvIdx = 0; pvIdx < multiPV; ++pvIdx) { if (pvIdx == pvLast) { @@ -390,6 +390,9 @@ void Search::Worker::iterative_deepening() { // below pick a proven score/PV for this thread (from the previous iteration). && !(threads.abortedSearch && rootMoves[0].uciScore <= VALUE_TB_LOSS_IN_MAX_PLY)) main_manager()->pv(*this, threads, tt, rootDepth); + + if (threads.stop) + break; } if (!threads.stop)