mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 03:26:24 +08:00
Post-merge fixes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
16
src/thread.h
16
src/thread.h
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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] != '#')
|
||||
|
||||
Reference in New Issue
Block a user