Replace hint_common_parent_position() by backwards accumulator updates

Only calls to `evaluate()` now trigger NNUE accumulator updates. To make
sure that we are likely to find parent positions from which to update
the accumulators we perform a backwards NNUE update whenever we compute
the accumulator from scratch for some position.

passed STC
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 39680 W: 10474 L: 10164 D: 19042
Ptnml(0-2): 171, 4068, 11042, 4398, 161
https://tests.stockfishchess.org/tests/view/67a27f26eb183d11c65945be

passed LTC
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 337308 W: 86408 L: 85550 D: 165350
Ptnml(0-2): 276, 30551, 106126, 31441, 260
https://tests.stockfishchess.org/tests/view/67a287efeb183d11c65945ee

then simplified:
STC
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 28608 W: 7641 L: 7413 D: 13554
Ptnml(0-2): 132, 3036, 7744, 3256, 136
https://tests.stockfishchess.org/tests/view/67a4703719f522d3866d3345

LTC
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 200226 W: 51026 L: 50990 D: 98210
Ptnml(0-2): 170, 18468, 62799, 18508, 168
https://tests.stockfishchess.org/tests/view/67a4f255229c1a170cc08964

The version in this PR is a bit different from the simplified version,
but it's compile-time changes only.

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

No functional change
This commit is contained in:
Carlos Esparza
2025-02-24 19:01:23 +01:00
committed by Disservin
parent fa6c30af81
commit e9997afb1c
7 changed files with 92 additions and 77 deletions
-4
View File
@@ -41,7 +41,6 @@
#include "nnue/network.h"
#include "nnue/nnue_accumulator.h"
#include "nnue/nnue_common.h"
#include "nnue/nnue_misc.h"
#include "position.h"
#include "syzygy/tbprobe.h"
#include "thread.h"
@@ -759,7 +758,6 @@ Value Search::Worker::search(
else if (excludedMove)
{
// Providing the hint that this node's accumulator will be used often
Eval::NNUE::hint_common_parent_position(pos, networks[numaAccessToken], refreshTable);
unadjustedStaticEval = eval = ss->staticEval;
}
else if (ss->ttHit)
@@ -768,8 +766,6 @@ Value Search::Worker::search(
unadjustedStaticEval = ttData.eval;
if (!is_valid(unadjustedStaticEval))
unadjustedStaticEval = evaluate(pos);
else if (PvNode)
Eval::NNUE::hint_common_parent_position(pos, networks[numaAccessToken], refreshTable);
ss->staticEval = eval = to_corrected_static_eval(unadjustedStaticEval, correctionValue);