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:
parent
7b9e83f604
commit
a75e45b37e
1 changed files with 4 additions and 19 deletions
|
@ -372,27 +372,12 @@ void Thread::search(bool isMainThread) {
|
||||||
multiPV = std::min(multiPV, rootMoves.size());
|
multiPV = std::min(multiPV, rootMoves.size());
|
||||||
|
|
||||||
// Iterative deepening loop until requested to stop or target depth reached
|
// 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
|
// Set up our new depth for the helper threads
|
||||||
|
if (!isMainThread)
|
||||||
// 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
|
|
||||||
depth = Threads.main()->depth + Depth(int(3 * log(1 + this->idx)));
|
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
|
// Age out PV variability metric
|
||||||
if (isMainThread)
|
if (isMainThread)
|
||||||
BestMoveChanges *= 0.5;
|
BestMoveChanges *= 0.5;
|
||||||
|
@ -479,7 +464,7 @@ void Thread::search(bool isMainThread) {
|
||||||
// Sort the PV lines searched so far and update the GUI
|
// Sort the PV lines searched so far and update the GUI
|
||||||
std::stable_sort(rootMoves.begin(), rootMoves.begin() + PVIdx + 1);
|
std::stable_sort(rootMoves.begin(), rootMoves.begin() + PVIdx + 1);
|
||||||
|
|
||||||
if (this != Threads.main())
|
if (!isMainThread)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (Signals.stop)
|
if (Signals.stop)
|
||||||
|
|
Loading…
Add table
Reference in a new issue