Simplify away completedDepth

Recent changes to this part of the code mean that the variable `completedDepth` is no longer neeeded. The only *functional* part of this patch is the effect on the thread voting formula. Basically, compared to master this patch raises the depth weight in the formula uniformly by 1. For very, very low depths this may have a tiny effect on thread selection compared to master. But in general we expect this patch to have no effect on game play at STC and LTC.

Passed STC SMP non-reg:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 284808 W: 72944 L: 72994 D: 138870
Ptnml(0-2): 351, 32192, 77370, 32138, 353
https://tests.stockfishchess.org/tests/view/69eddd011e5788938e86a075

closes https://github.com/official-stockfish/Stockfish/pull/6793

No functional change
This commit is contained in:
Robert Nurnberg @ elitebook
2026-05-04 08:31:44 +02:00
committed by Joost VandeVondele
parent 4055a9fb27
commit 7e754e17dd
3 changed files with 7 additions and 9 deletions
+3 -5
View File
@@ -461,8 +461,6 @@ bool Search::Worker::iterative_deepening() {
if (!threads.stop) if (!threads.stop)
{ {
completedDepth = rootDepth;
if (lastIterationPV.empty() || rootMoves[0].pv[0] != lastIterationPV[0]) if (lastIterationPV.empty() || rootMoves[0].pv[0] != lastIterationPV[0])
lastBestMoveDepth = rootDepth; lastBestMoveDepth = rootDepth;
@@ -525,9 +523,9 @@ bool Search::Worker::iterative_deepening() {
fallingEval = std::clamp(fallingEval, 0.581, 1.655); fallingEval = std::clamp(fallingEval, 0.581, 1.655);
// If the bestMove is stable over several iterations, reduce time accordingly // If the bestMove is stable over several iterations, reduce time accordingly
timeReduction = std::clamp( timeReduction =
interpolate(double(completedDepth - lastBestMoveDepth), 5.0, 18.0, 0.65, 1.55), 0.65, std::clamp(interpolate(double(rootDepth - lastBestMoveDepth), 5.0, 18.0, 0.65, 1.55),
1.55); 0.65, 1.55);
double reduction = (1.5 + mainThread->previousTimeReduction) / (2.255 * timeReduction); double reduction = (1.5 + mainThread->previousTimeReduction) / (2.255 * timeReduction);
+1 -1
View File
@@ -380,7 +380,7 @@ class Worker {
Position rootPos; Position rootPos;
StateInfo rootState; StateInfo rootState;
RootMoves rootMoves; RootMoves rootMoves;
Depth rootDepth, completedDepth; Depth rootDepth;
Value rootDelta; Value rootDelta;
PVMoves lastIterationPV; PVMoves lastIterationPV;
+3 -3
View File
@@ -332,8 +332,8 @@ void ThreadPool::start_thinking(const OptionsMap& options,
th->worker->limits = limits; th->worker->limits = limits;
th->worker->nodes = th->worker->tbHits = th->worker->bestMoveChanges = 0; th->worker->nodes = th->worker->tbHits = th->worker->bestMoveChanges = 0;
th->worker->nmpMinPly = 0; th->worker->nmpMinPly = 0;
th->worker->rootDepth = th->worker->completedDepth = 0; th->worker->rootDepth = 0;
th->worker->rootMoves = rootMoves; th->worker->rootMoves = rootMoves;
th->worker->rootPos.set(pos.fen(), pos.is_chess960(), &th->worker->rootState); th->worker->rootPos.set(pos.fen(), pos.is_chess960(), &th->worker->rootState);
th->worker->rootState = setupStates->back(); th->worker->rootState = setupStates->back();
th->worker->tbConfig = tbConfig; th->worker->tbConfig = tbConfig;
@@ -360,7 +360,7 @@ Thread* ThreadPool::get_best_thread() const {
// Vote according to score and depth, and select the best thread // Vote according to score and depth, and select the best thread
auto thread_voting_value = [minScore](Thread* th) { auto thread_voting_value = [minScore](Thread* th) {
return (th->worker->rootMoves[0].score - minScore + 14) * int(th->worker->completedDepth); return (th->worker->rootMoves[0].score - minScore + 14) * int(th->worker->rootDepth);
}; };
for (auto&& th : threads) for (auto&& th : threads)