From a75e45b37e8d2d92b77b4295de2519712c0d7d51 Mon Sep 17 00:00:00 2001 From: joergoster Date: Mon, 12 Oct 2015 08:41:29 +0200 Subject: [PATCH] Simplify altering the search depth of the helper threads As a side-effect, the old iterative deepening loop logic is being restored. bench: 8116244 (after rebasing on new master) --- src/search.cpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index ea54c44c..d31befca 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -372,27 +372,12 @@ void Thread::search(bool isMainThread) { multiPV = std::min(multiPV, rootMoves.size()); // Iterative deepening loop until requested to stop or target depth reached - while (true) + while (++depth < DEPTH_MAX && !Signals.stop && (!Limits.depth || depth <= Limits.depth)) { - // Set up our new depth - - // The main thread modifies other threads rootDepth, if it is <= main - // thread depth. The new depth will take effect after the other thread - // returns to id_loop(). - if (isMainThread) - { - ++depth; - for (Thread* th : Threads) - if (th != this && th->depth <= depth) - th->depth = depth + Depth(int(3 * log(1 + th->idx))); - } - else - // This can cause a thread to search with the same depth for many iterations + // Set up our new depth for the helper threads + if (!isMainThread) depth = Threads.main()->depth + Depth(int(3 * log(1 + this->idx))); - if (depth >= DEPTH_MAX || Signals.stop || (Limits.depth && depth > Limits.depth)) - break; - // Age out PV variability metric if (isMainThread) BestMoveChanges *= 0.5; @@ -479,7 +464,7 @@ void Thread::search(bool isMainThread) { // Sort the PV lines searched so far and update the GUI std::stable_sort(rootMoves.begin(), rootMoves.begin() + PVIdx + 1); - if (this != Threads.main()) + if (!isMainThread) break; if (Signals.stop)