mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Fix missing initialization of AccumulatorCaches in Eval::trace
Add a constructor to `AccumulatorCaches` instead of just calling `clear(networks)` to prevent similar issues from appearing in the future. fixes https://github.com/official-stockfish/Stockfish/issues/5190 closes https://github.com/official-stockfish/Stockfish/pull/5191 No functional change
This commit is contained in:
parent
886ed90ec3
commit
3502c8ae42
4 changed files with 11 additions and 7 deletions
|
@ -99,7 +99,7 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
|
||||||
// Trace scores are from white's point of view
|
// Trace scores are from white's point of view
|
||||||
std::string Eval::trace(Position& pos, const Eval::NNUE::Networks& networks) {
|
std::string Eval::trace(Position& pos, const Eval::NNUE::Networks& networks) {
|
||||||
|
|
||||||
auto caches = std::make_unique<Eval::NNUE::AccumulatorCaches>();
|
auto caches = std::make_unique<Eval::NNUE::AccumulatorCaches>(networks);
|
||||||
|
|
||||||
if (pos.checkers())
|
if (pos.checkers())
|
||||||
return "Final evaluation: none (in check)";
|
return "Final evaluation: none (in check)";
|
||||||
|
|
|
@ -50,6 +50,11 @@ struct alignas(CacheLineSize) Accumulator {
|
||||||
// is commonly referred to as "Finny Tables".
|
// is commonly referred to as "Finny Tables".
|
||||||
struct AccumulatorCaches {
|
struct AccumulatorCaches {
|
||||||
|
|
||||||
|
template<typename Networks>
|
||||||
|
AccumulatorCaches(const Networks& networks) {
|
||||||
|
clear(networks);
|
||||||
|
}
|
||||||
|
|
||||||
template<IndexType Size>
|
template<IndexType Size>
|
||||||
struct alignas(CacheLineSize) Cache {
|
struct alignas(CacheLineSize) Cache {
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,11 @@ Search::Worker::Worker(SharedState& sharedState,
|
||||||
// Unpack the SharedState struct into member variables
|
// Unpack the SharedState struct into member variables
|
||||||
thread_idx(thread_id),
|
thread_idx(thread_id),
|
||||||
manager(std::move(sm)),
|
manager(std::move(sm)),
|
||||||
refreshTable(),
|
|
||||||
options(sharedState.options),
|
options(sharedState.options),
|
||||||
threads(sharedState.threads),
|
threads(sharedState.threads),
|
||||||
tt(sharedState.tt),
|
tt(sharedState.tt),
|
||||||
networks(sharedState.networks) {
|
networks(sharedState.networks),
|
||||||
|
refreshTable(networks) {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,15 +302,14 @@ class Worker {
|
||||||
|
|
||||||
Tablebases::Config tbConfig;
|
Tablebases::Config tbConfig;
|
||||||
|
|
||||||
// Used by NNUE
|
|
||||||
|
|
||||||
Eval::NNUE::AccumulatorCaches refreshTable;
|
|
||||||
|
|
||||||
const OptionsMap& options;
|
const OptionsMap& options;
|
||||||
ThreadPool& threads;
|
ThreadPool& threads;
|
||||||
TranspositionTable& tt;
|
TranspositionTable& tt;
|
||||||
const Eval::NNUE::Networks& networks;
|
const Eval::NNUE::Networks& networks;
|
||||||
|
|
||||||
|
// Used by NNUE
|
||||||
|
Eval::NNUE::AccumulatorCaches refreshTable;
|
||||||
|
|
||||||
friend class Stockfish::ThreadPool;
|
friend class Stockfish::ThreadPool;
|
||||||
friend class SearchManager;
|
friend class SearchManager;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue