From 56000827af401563737e7be5cf97061133d00f79 Mon Sep 17 00:00:00 2001 From: pb00067 Date: Mon, 13 Jan 2025 09:07:09 +0100 Subject: [PATCH] Simplify common hint for parent position Removes function hint_common_access_for_perspective together with it's comments, which weren't accurate anymore since merge of #5576 https://tests.stockfishchess.org/tests/view/6784c9cd460e2910c51dde39 LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 295104 W: 76702 L: 76765 D: 141637 Ptnml(0-2): 1031, 32135, 81249, 32140, 997 closes https://github.com/official-stockfish/Stockfish/pull/5780 No functional change --- src/nnue/nnue_feature_transformer.h | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/nnue/nnue_feature_transformer.h b/src/nnue/nnue_feature_transformer.h index 8649d952..14fdecd7 100644 --- a/src/nnue/nnue_feature_transformer.h +++ b/src/nnue/nnue_feature_transformer.h @@ -449,8 +449,8 @@ class FeatureTransformer { void hint_common_access(const Position& pos, AccumulatorCaches::Cache* cache) const { - hint_common_access_for_perspective(pos, cache); - hint_common_access_for_perspective(pos, cache); + update_accumulator(pos, cache); + update_accumulator(pos, cache); } private: @@ -821,31 +821,12 @@ class FeatureTransformer { entry.byTypeBB[pt] = pos.pieces(pt); } - template - void hint_common_access_for_perspective(const Position& pos, - AccumulatorCaches::Cache* cache) const { - - // Works like update_accumulator, but performs less work. - // Updates ONLY the accumulator for pos. - - // Look for a usable accumulator of an earlier position. We keep track - // of the estimated gain in terms of features to be added/subtracted. - // Fast early exit. - if ((pos.state()->*accPtr).computed[Perspective]) - return; - - StateInfo* oldest = try_find_computed_accumulator(pos); - - if ((oldest->*accPtr).computed[Perspective] && oldest != pos.state()) - update_accumulator_incremental(pos, oldest); - else - update_accumulator_refresh_cache(pos, cache); - } template void update_accumulator(const Position& pos, AccumulatorCaches::Cache* cache) const { - + if ((pos.state()->*accPtr).computed[Perspective]) + return; StateInfo* oldest = try_find_computed_accumulator(pos); if ((oldest->*accPtr).computed[Perspective] && oldest != pos.state())