mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-23 13:17:12 +00:00
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
62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
/*
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
Copyright (C) 2004-2025 The Stockfish developers (see AUTHORS file)
|
|
|
|
Stockfish is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Stockfish is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef NNUE_MISC_H_INCLUDED
|
|
#define NNUE_MISC_H_INCLUDED
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
|
|
#include "../types.h"
|
|
#include "nnue_architecture.h"
|
|
|
|
namespace Stockfish {
|
|
|
|
class Position;
|
|
|
|
namespace Eval::NNUE {
|
|
|
|
struct EvalFile {
|
|
// Default net name, will use one of the EvalFileDefaultName* macros defined
|
|
// in evaluate.h
|
|
std::string defaultName;
|
|
// Selected net name, either via uci option or default
|
|
std::string current;
|
|
// Net description extracted from the net file
|
|
std::string netDescription;
|
|
};
|
|
|
|
|
|
struct NnueEvalTrace {
|
|
static_assert(LayerStacks == PSQTBuckets);
|
|
|
|
Value psqt[LayerStacks];
|
|
Value positional[LayerStacks];
|
|
std::size_t correctBucket;
|
|
};
|
|
|
|
struct Networks;
|
|
struct AccumulatorCaches;
|
|
|
|
std::string trace(Position& pos, const Networks& networks, AccumulatorCaches& caches);
|
|
|
|
} // namespace Stockfish::Eval::NNUE
|
|
} // namespace Stockfish
|
|
|
|
#endif // #ifndef NNUE_MISC_H_INCLUDED
|