Post-merge fixes.

This commit is contained in:
Tomasz Sobczyk
2021-05-24 11:45:21 +02:00
parent 127c1f2fe2
commit a4605860c6
7 changed files with 31 additions and 17 deletions
+10 -10
View File
@@ -63,18 +63,18 @@ namespace Eval {
namespace NNUE { namespace NNUE {
string eval_file_loaded = "None"; string eval_file_loaded = "None";
UseNNUEMode useNNUE; UseNNUEMode useNNUE;
}
static UseNNUEMode NNUE::nnue_mode_from_option(const UCI::Option& mode) static UseNNUEMode nnue_mode_from_option(const UCI::Option& mode)
{ {
if (mode == "false") if (mode == "false")
return UseNNUEMode::False;
else if (mode == "true")
return UseNNUEMode::True;
else if (mode == "pure")
return UseNNUEMode::Pure;
return UseNNUEMode::False; return UseNNUEMode::False;
else if (mode == "true") }
return UseNNUEMode::True;
else if (mode == "pure")
return UseNNUEMode::Pure;
return UseNNUEMode::False;
} }
/// NNUE::init() tries to load a NNUE network at startup time, or when the engine /// NNUE::init() tries to load a NNUE network at startup time, or when the engine
+1 -1
View File
@@ -374,7 +374,7 @@ void Thread::search() {
// Start with a small aspiration window and, in the case of a fail // Start with a small aspiration window and, in the case of a fail
// high/low, re-search with a bigger window until we don't fail // high/low, re-search with a bigger window until we don't fail
// high/low anymore. // high/low anymore.
int failedHighCnt = 0; failedHighCnt = 0;
while (true) while (true)
{ {
Depth adjustedDepth = std::max(1, rootDepth - failedHighCnt - searchAgainCounter); Depth adjustedDepth = std::max(1, rootDepth - failedHighCnt - searchAgainCounter);
+15 -1
View File
@@ -76,6 +76,15 @@ public:
void wait_for_search_finished(); void wait_for_search_finished();
size_t id() const { return idx; } size_t id() const { return idx; }
void wait_for_worker_finished();
template <typename FuncT>
void set_eval_callback(FuncT&& f) { on_eval_callback = std::forward<FuncT>(f); }
void clear_eval_callback() { on_eval_callback = nullptr; }
void on_eval() { if (on_eval_callback) on_eval_callback(rootPos); }
Pawns::Table pawnsTable; Pawns::Table pawnsTable;
Material::Table materialTable; Material::Table materialTable;
size_t pvIdx, pvLast; size_t pvIdx, pvLast;
@@ -94,6 +103,11 @@ public:
CapturePieceToHistory captureHistory; CapturePieceToHistory captureHistory;
ContinuationHistory continuationHistory[2][2]; ContinuationHistory continuationHistory[2][2];
Score contempt; Score contempt;
int failedHighCnt;
bool rootInTB;
int Cardinality;
bool UseRule50;
Depth ProbeDepth;
}; };
@@ -166,7 +180,7 @@ struct ThreadPool : public std::vector<Thread*> {
execute_with_workers( execute_with_workers(
[chunk_size, end, func](Thread& th) mutable { [chunk_size, end, func](Thread& th) mutable {
const IndexT thread_id = th.thread_idx(); const IndexT thread_id = th.id();
const IndexT offset = chunk_size * thread_id; const IndexT offset = chunk_size * thread_id;
if (offset >= end) if (offset >= end)
return; return;
+2 -2
View File
@@ -257,7 +257,7 @@ namespace Stockfish::Tools
StateInfo si; StateInfo si;
auto& prng = prngs[th.thread_idx()]; auto& prng = prngs[th.id()];
// end flag // end flag
bool quit = false; bool quit = false;
@@ -693,7 +693,7 @@ namespace Stockfish::Tools
maybe_report(iter + 1); maybe_report(iter + 1);
// Write out one sfen. // Write out one sfen.
sfen_writer.write(th.thread_idx(), sfen); sfen_writer.write(th.id(), sfen);
} }
return false; return false;
+1 -1
View File
@@ -341,7 +341,7 @@ namespace Stockfish::Tools
maybe_report(iter + 1); maybe_report(iter + 1);
// Write out one sfen. // Write out one sfen.
sfen_writer.write(th.thread_idx(), sfen); sfen_writer.write(th.id(), sfen);
} }
return false; return false;
+1 -1
View File
@@ -426,7 +426,7 @@ namespace Stockfish::Tools
ps.move = search_pv[0]; ps.move = search_pv[0];
ps.padding = 0; ps.padding = 0;
out.write(th.thread_idx(), ps); out.write(th.id(), ps);
auto p = num_processed.fetch_add(1) + 1; auto p = num_processed.fetch_add(1) + 1;
if (p % 10000 == 0) if (p % 10000 == 0)
+1 -1
View File
@@ -342,7 +342,7 @@ void UCI::loop(int argc, char* argv[]) {
else if (token == "tasktest") else if (token == "tasktest")
{ {
Threads.execute_with_workers([](auto& th) { Threads.execute_with_workers([](auto& th) {
std::cout << th.thread_idx() << '\n'; std::cout << th.id() << '\n';
}); });
} }
else if (!token.empty() && token[0] != '#') else if (!token.empty() && token[0] != '#')