From 377d77dbe922b99ee34d686e4fe180698a9b535a Mon Sep 17 00:00:00 2001 From: joergoster Date: Thu, 13 Jul 2017 16:30:03 -0700 Subject: [PATCH] Provide selective search depth info for each pv move No functional change Closes #1166 --- src/search.cpp | 10 +++++++--- src/search.h | 1 + src/thread.cpp | 3 +-- src/thread.h | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 1c000b5b..4551c39d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -383,6 +383,9 @@ void Thread::search() { // MultiPV loop. We perform a full root search for each PV line for (PVIdx = 0; PVIdx < multiPV && !Threads.stop; ++PVIdx) { + // Reset UCI info selDepth for each depth and each PV line + selDepth = 0; + // Reset aspiration window starting size if (rootDepth >= 5 * ONE_PLY) { @@ -566,8 +569,8 @@ namespace { static_cast(thisThread)->check_time(); // Used to send selDepth info to GUI - if (PvNode && thisThread->maxPly < ss->ply) - thisThread->maxPly = ss->ply; + if (PvNode && thisThread->selDepth < ss->ply) + thisThread->selDepth = ss->ply; if (!rootNode) { @@ -1043,6 +1046,7 @@ moves_loop: // When in check search starts from here if (moveCount == 1 || value > alpha) { rm.score = value; + rm.selDepth = thisThread->selDepth; rm.pv.resize(1); assert((ss+1)->pv); @@ -1525,7 +1529,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { ss << "info" << " depth " << d / ONE_PLY - << " seldepth " << pos.this_thread()->maxPly + << " seldepth " << rootMoves[i].selDepth << " multipv " << i + 1 << " score " << UCI::value(v); diff --git a/src/search.h b/src/search.h index 7c46980b..a2a02eda 100644 --- a/src/search.h +++ b/src/search.h @@ -64,6 +64,7 @@ struct RootMove { Value score = -VALUE_INFINITE; Value previousScore = -VALUE_INFINITE; + int selDepth = 0; std::vector pv; }; diff --git a/src/thread.cpp b/src/thread.cpp index 66f74b99..86fce6aa 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -35,7 +35,7 @@ ThreadPool Threads; // Global object Thread::Thread() { exit = false; - maxPly = 0; + selDepth = 0; nodes = tbHits = 0; idx = Threads.size(); // Start from 0 @@ -210,7 +210,6 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states, for (Thread* th : Threads) { - th->maxPly = 0; th->nodes = 0; th->tbHits = 0; th->rootDepth = DEPTH_ZERO; diff --git a/src/thread.h b/src/thread.h index 77517b07..35cf3efe 100644 --- a/src/thread.h +++ b/src/thread.h @@ -60,7 +60,7 @@ public: Material::Table materialTable; Endgames endgames; size_t idx, PVIdx; - int maxPly; + int selDepth; std::atomic nodes, tbHits; Position rootPos; -- 2.39.2