mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-22 18:17:02 +08:00
On main thread: reduce depth after fail high
This helps resolving consecutive FH's during aspiration more efficiently STC: http://tests.stockfishchess.org/tests/view/5bc857920ebc592439f85765 LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 4992 W: 1134 L: 980 D: 2878 Elo +10.72 LTC: http://tests.stockfishchess.org/tests/view/5bc868050ebc592439f857ef LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 8123 W: 1363 L: 1210 D: 5550 Elo +6.54 No-Regression test with 8 threads, tc=15+0.15: http://tests.stockfishchess.org/tests/view/5bc874ca0ebc592439f85938 LLR: 2.94 (-2.94,2.94) [-3.00,1.00] Total: 24740 W: 3977 L: 3863 D: 16900 Elo +1.60 This was a cooperation between me and Michael Stembera: -me recognizing SF having problems with resolving FH's efficiently at high depths, thus starting some tests based on consecutive FH's. -mstembera picking up the idea with first success at STC & LTC (so full credits to him!) -me suggesting how to resolve the issues pinpointed by S.G on PR #1768 and finally restricting the logic to the main thread so that it don't regresses at multi-thread. bench: 3314347
This commit is contained in:
committed by
Stéphane Nicolet
parent
bc3b148d57
commit
081af90805
@@ -368,6 +368,7 @@ void Thread::search() {
|
||||
|
||||
size_t pvFirst = 0;
|
||||
pvLast = 0;
|
||||
Depth adjustedDepth = rootDepth;
|
||||
|
||||
// MultiPV loop. We perform a full root search for each PV line
|
||||
for (pvIdx = 0; pvIdx < multiPV && !Threads.stop; ++pvIdx)
|
||||
@@ -401,9 +402,11 @@ 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;
|
||||
while (true)
|
||||
{
|
||||
bestValue = ::search<PV>(rootPos, ss, alpha, beta, rootDepth, false);
|
||||
adjustedDepth = std::max(ONE_PLY, rootDepth - failedHighCnt * ONE_PLY);
|
||||
bestValue = ::search<PV>(rootPos, ss, alpha, beta, adjustedDepth, false);
|
||||
|
||||
// Bring the best move to the front. It is critical that sorting
|
||||
// is done with a stable algorithm because all the values but the
|
||||
@@ -425,7 +428,7 @@ void Thread::search() {
|
||||
&& multiPV == 1
|
||||
&& (bestValue <= alpha || bestValue >= beta)
|
||||
&& Time.elapsed() > 3000)
|
||||
sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl;
|
||||
sync_cout << UCI::pv(rootPos, adjustedDepth, alpha, beta) << sync_endl;
|
||||
|
||||
// In case of failing low/high increase aspiration window and
|
||||
// re-search, otherwise exit the loop.
|
||||
@@ -436,12 +439,17 @@ void Thread::search() {
|
||||
|
||||
if (mainThread)
|
||||
{
|
||||
failedHighCnt = 0;
|
||||
failedLow = true;
|
||||
Threads.stopOnPonderhit = false;
|
||||
}
|
||||
}
|
||||
else if (bestValue >= beta)
|
||||
{
|
||||
beta = std::min(bestValue + delta, VALUE_INFINITE);
|
||||
if (mainThread)
|
||||
++failedHighCnt;
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -455,15 +463,15 @@ void Thread::search() {
|
||||
|
||||
if ( mainThread
|
||||
&& (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000))
|
||||
sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl;
|
||||
sync_cout << UCI::pv(rootPos, adjustedDepth, alpha, beta) << sync_endl;
|
||||
}
|
||||
|
||||
if (!Threads.stop)
|
||||
completedDepth = rootDepth;
|
||||
completedDepth = adjustedDepth;
|
||||
|
||||
if (rootMoves[0].pv[0] != lastBestMove) {
|
||||
lastBestMove = rootMoves[0].pv[0];
|
||||
lastBestMoveDepth = rootDepth;
|
||||
lastBestMoveDepth = adjustedDepth;
|
||||
}
|
||||
|
||||
// Have we found a "mate in x"?
|
||||
|
||||
Reference in New Issue
Block a user