1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

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)
This commit is contained in:
joergoster 2015-10-12 08:41:29 +02:00 committed by Marco Costalba
parent 7b9e83f604
commit a75e45b37e

View file

@ -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)