mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Stack allocate NNUE buffer
Passed simp STC LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 29632 W: 7772 L: 7552 D: 14308 Ptnml(0-2): 76, 3155, 8147, 3349, Id expect there to be a small speedup (bc the compiler can skip some stores) but i haven’t tried to measure it closes https://github.com/official-stockfish/Stockfish/pull/6688 No functional change
This commit is contained in:
@@ -109,17 +109,10 @@ struct NetworkArchitecture {
|
||||
alignas(CacheLineSize) typename decltype(ac_1)::OutputBuffer ac_1_out;
|
||||
alignas(CacheLineSize) typename decltype(fc_2)::OutputBuffer fc_2_out;
|
||||
|
||||
Buffer() { std::memset(this, 0, sizeof(*this)); }
|
||||
Buffer() { std::memset(ac_sqr_0_out, 0, sizeof(ac_sqr_0_out)); }
|
||||
};
|
||||
|
||||
#if defined(__clang__) && (__APPLE__)
|
||||
// workaround for a bug reported with xcode 12
|
||||
static thread_local auto tlsBuffer = std::make_unique<Buffer>();
|
||||
// Access TLS only once, cache result.
|
||||
Buffer& buffer = *tlsBuffer;
|
||||
#else
|
||||
alignas(CacheLineSize) static thread_local Buffer buffer;
|
||||
#endif
|
||||
Buffer buffer;
|
||||
|
||||
fc_0.propagate(transformedFeatures, buffer.fc_0_out);
|
||||
ac_sqr_0.propagate(buffer.fc_0_out, buffer.ac_sqr_0_out);
|
||||
|
||||
+2
-4
@@ -2035,8 +2035,7 @@ void syzygy_extend_pv(const OptionsMap& options,
|
||||
for (const auto& m : MoveList<LEGAL>(pos))
|
||||
legalMoves.emplace_back(m);
|
||||
|
||||
TB::Config config =
|
||||
TB::rank_root_moves(options, pos, legalMoves, false, time_abort);
|
||||
TB::Config config = TB::rank_root_moves(options, pos, legalMoves, false, time_abort);
|
||||
RootMove& rm = *std::find(legalMoves.begin(), legalMoves.end(), pvMove);
|
||||
|
||||
if (legalMoves[0].tbRank != rm.tbRank)
|
||||
@@ -2096,8 +2095,7 @@ void syzygy_extend_pv(const OptionsMap& options,
|
||||
[](const Search::RootMove& a, const Search::RootMove& b) { return a.tbRank > b.tbRank; });
|
||||
|
||||
// The winning side tries to minimize DTZ, the losing side maximizes it
|
||||
TB::Config config =
|
||||
TB::rank_root_moves(options, pos, legalMoves, true, time_abort);
|
||||
TB::Config config = TB::rank_root_moves(options, pos, legalMoves, true, time_abort);
|
||||
|
||||
// If DTZ is not available we might not find a mate, so we bail out
|
||||
if (!config.rootInTB || config.cardinality > 0)
|
||||
|
||||
Reference in New Issue
Block a user