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
|
||||
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())
|
||||
return "Final evaluation: none (in check)";
|
||||
|
|
|
@ -50,6 +50,11 @@ struct alignas(CacheLineSize) Accumulator {
|
|||
// is commonly referred to as "Finny Tables".
|
||||
struct AccumulatorCaches {
|
||||
|
||||
template<typename Networks>
|
||||
AccumulatorCaches(const Networks& networks) {
|
||||
clear(networks);
|
||||
}
|
||||
|
||||
template<IndexType Size>
|
||||
struct alignas(CacheLineSize) Cache {
|
||||
|
||||
|
|
|
@ -137,11 +137,11 @@ Search::Worker::Worker(SharedState& sharedState,
|
|||
// Unpack the SharedState struct into member variables
|
||||
thread_idx(thread_id),
|
||||
manager(std::move(sm)),
|
||||
refreshTable(),
|
||||
options(sharedState.options),
|
||||
threads(sharedState.threads),
|
||||
tt(sharedState.tt),
|
||||
networks(sharedState.networks) {
|
||||
networks(sharedState.networks),
|
||||
refreshTable(networks) {
|
||||
clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -302,15 +302,14 @@ class Worker {
|
|||
|
||||
Tablebases::Config tbConfig;
|
||||
|
||||
// Used by NNUE
|
||||
|
||||
Eval::NNUE::AccumulatorCaches refreshTable;
|
||||
|
||||
const OptionsMap& options;
|
||||
ThreadPool& threads;
|
||||
TranspositionTable& tt;
|
||||
const Eval::NNUE::Networks& networks;
|
||||
|
||||
// Used by NNUE
|
||||
Eval::NNUE::AccumulatorCaches refreshTable;
|
||||
|
||||
friend class Stockfish::ThreadPool;
|
||||
friend class SearchManager;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue