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

View File

@@ -63,18 +63,18 @@ namespace Eval {
namespace NNUE {
string eval_file_loaded = "None";
UseNNUEMode useNNUE;
}
static UseNNUEMode NNUE::nnue_mode_from_option(const UCI::Option& mode)
{
if (mode == "false")
static UseNNUEMode nnue_mode_from_option(const UCI::Option& mode)
{
if (mode == "false")
return UseNNUEMode::False;
else if (mode == "true")
return UseNNUEMode::True;
else if (mode == "pure")
return UseNNUEMode::Pure;
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

View File

@@ -374,7 +374,7 @@ void Thread::search() {
// 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 anymore.
int failedHighCnt = 0;
failedHighCnt = 0;
while (true)
{
Depth adjustedDepth = std::max(1, rootDepth - failedHighCnt - searchAgainCounter);

View File

@@ -76,6 +76,15 @@ public:
void wait_for_search_finished();
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;
Material::Table materialTable;
size_t pvIdx, pvLast;
@@ -94,6 +103,11 @@ public:
CapturePieceToHistory captureHistory;
ContinuationHistory continuationHistory[2][2];
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(
[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;
if (offset >= end)
return;

View File

@@ -257,7 +257,7 @@ namespace Stockfish::Tools
StateInfo si;
auto& prng = prngs[th.thread_idx()];
auto& prng = prngs[th.id()];
// end flag
bool quit = false;
@@ -693,7 +693,7 @@ namespace Stockfish::Tools
maybe_report(iter + 1);
// Write out one sfen.
sfen_writer.write(th.thread_idx(), sfen);
sfen_writer.write(th.id(), sfen);
}
return false;

View File

@@ -341,7 +341,7 @@ namespace Stockfish::Tools
maybe_report(iter + 1);
// Write out one sfen.
sfen_writer.write(th.thread_idx(), sfen);
sfen_writer.write(th.id(), sfen);
}
return false;

View File

@@ -426,7 +426,7 @@ namespace Stockfish::Tools
ps.move = search_pv[0];
ps.padding = 0;
out.write(th.thread_idx(), ps);
out.write(th.id(), ps);
auto p = num_processed.fetch_add(1) + 1;
if (p % 10000 == 0)

View File

@@ -342,7 +342,7 @@ void UCI::loop(int argc, char* argv[]) {
else if (token == "tasktest")
{
Threads.execute_with_workers([](auto& th) {
std::cout << th.thread_idx() << '\n';
std::cout << th.id() << '\n';
});
}
else if (!token.empty() && token[0] != '#')