From 91736f7b4f2d137f933ce44e68d8abe9ef0f3732 Mon Sep 17 00:00:00 2001 From: anematode Date: Sun, 17 May 2026 20:48:12 +0200 Subject: [PATCH] Compute correction_value before TT lookup Passed single-threaded STC with 128MB hash https://tests.stockfishchess.org/tests/view/6a04a6348d9bd4cd7cd69124 LLR: 2.93 (-2.94,2.94) <0.00,2.00> Total: 103808 W: 26400 L: 26007 D: 51401 Ptnml(0-2): 205, 11212, 28711, 11537, 239 Passed standard SMP STC https://tests.stockfishchess.org/tests/view/6a054f528d9bd4cd7cd69225 LLR: 2.95 (-2.94,2.94) <0.00,2.00> Total: 80392 W: 20580 L: 20221 D: 39591 Ptnml(0-2): 79, 8872, 21942, 9217, 86 Entering `do_move`, `correction_value` and the TT lookup are always done together, but the TT lookup happens first. Swapping the order allows the execution of `correction_value` to overlap with the in-flight TT prefetch. closes https://github.com/official-stockfish/Stockfish/pull/6822 No functional change --- src/search.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 5e4b4ca2b..36bfbdd85 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -752,6 +752,8 @@ Value Search::Worker::search( ss->statScore = 0; (ss + 2)->cutoffCnt = 0; + const auto correctionValue = correction_value(*this, pos, ss); + // Step 4. Transposition table lookup excludedMove = ss->excludedMove; posKey = pos.key(); @@ -764,8 +766,8 @@ Value Search::Worker::search( ttCapture = ttData.move && pos.capture_stage(ttData.move); // Step 5. Static evaluation of the position - Value unadjustedStaticEval = VALUE_NONE; - const auto correctionValue = correction_value(*this, pos, ss); + Value unadjustedStaticEval = VALUE_NONE; + // Skip early pruning when in check if (ss->inCheck) ss->staticEval = eval = (ss - 2)->staticEval;