From dfa176fc7ee795b69fa72ea1322486a8d8b0647a Mon Sep 17 00:00:00 2001 From: Daniel Monroe Date: Sun, 25 May 2025 12:58:01 -0700 Subject: [PATCH] Small tt verify simplification Also fix probcut comment Passed non-regression STC LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 69728 W: 18080 L: 17909 D: 33739 Ptnml(0-2): 161, 7157, 20044, 7354, 148 https://tests.stockfishchess.org/tests/view/68324b116ec7634154f9b478 closes https://github.com/official-stockfish/Stockfish/pull/6094 No functional change --- src/search.cpp | 14 +++----------- src/types.h | 8 ++++---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 14f235b5..c6f61ec9 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -701,18 +701,12 @@ Value Search::Worker::search( do_move(pos, ttData.move, st); Key nextPosKey = pos.key(); auto [ttHitNext, ttDataNext, ttWriterNext] = tt.probe(nextPosKey); - ttDataNext.value = - ttHitNext ? value_from_tt(ttDataNext.value, ss->ply + 1, pos.rule50_count()) - : VALUE_NONE; undo_move(pos, ttData.move); + // Check that the ttValue after the tt move would also trigger a cutoff if (!is_valid(ttDataNext.value)) return ttData.value; - - if (ttData.value >= beta && -ttDataNext.value >= beta) - return ttData.value; - - if (ttData.value <= alpha && -ttDataNext.value <= alpha) + if ((ttData.value >= beta) == (-ttDataNext.value >= beta)) return ttData.value; } else @@ -916,9 +910,7 @@ Value Search::Worker::search( if (depth >= 3 && !is_decisive(beta) // If value from transposition table is lower than probCutBeta, don't attempt - // probCut there and in further interactions with transposition table cutoff - // depth is set to depth - 3 because probCut search has depth set to depth - 4 - // but we also do a move before it. So effective depth is equal to depth - 3. + // probCut there && !(is_valid(ttData.value) && ttData.value < probCutBeta)) { assert(probCutBeta < VALUE_INFINITE && probCutBeta > beta); diff --git a/src/types.h b/src/types.h index 5d767215..d40e1e29 100644 --- a/src/types.h +++ b/src/types.h @@ -63,10 +63,10 @@ #error "Stockfish requires GCC 9.3 or later for correct compilation" #endif -// Enforce minimum Clang version -#if defined(__clang__) && (__clang_major__ < 10) - #error "Stockfish requires Clang 10.0 or later for correct compilation" -#endif + // Enforce minimum Clang version + #if defined(__clang__) && (__clang_major__ < 10) + #error "Stockfish requires Clang 10.0 or later for correct compilation" + #endif #define ASSERT_ALIGNED(ptr, alignment) assert(reinterpret_cast(ptr) % alignment == 0)