Skip to content

Commit e7d2b09

Browse files
Disservinvondele
authored andcommitted
SE depth scaling using the previous depth
This patch makes the SE depth condition more robust and allows it to scale with completed depth from a previous search. At long TC this patch is almost equivalent to official-stockfish#4016 which had VLTC: https://tests.stockfishchess.org/tests/view/626abd7e8707aa698c0093a8 Elo: 2.35 +-1.5 (95%) LOS: 99.9% Total: 40000 W: 10991 L: 10720 D: 18289 Ptnml(0-2): 8, 3534, 12648, 3799, 11 nElo: 5.47 +-3.4 (95%) PairsRatio: 1.08 VLTC multicore: https://tests.stockfishchess.org/tests/view/6272a6afc8f14123163c1997 LLR: 2.94 (-2.94,2.94) <0.50,3.00> Total: 86808 W: 24165 L: 23814 D: 38829 Ptnml(0-2): 11, 7253, 28524, 7606, 10 however, it is now also gaining at LTC: LTC: https://tests.stockfishchess.org/tests/view/627e7cb523c0c72a05b651a9 LLR: 2.94 (-2.94,2.94) <0.50,3.00> Total: 27064 W: 7285 L: 7046 D: 12733 Ptnml(0-2): 8, 2446, 8390, 2675, 13 and should have nearly no influence at STC as depth 27 is rarely reached. It was noticed that initializing the threshold with MAX_PLY, had an adverse effect, possibly because the first move is sensitive to this. closes official-stockfish#4021 closes official-stockfish#4016 Bench:
1 parent c079acc commit e7d2b09

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ marotear
125125
Matt Ginsberg (mattginsberg)
126126
Matthew Lai (matthewlai)
127127
Matthew Sullivan (Matt14916)
128+
Max A. (Disservin)
128129
Maxim Molchanov (Maxim)
129130
Michael An (man)
130131
Michael Byrne (MichaelB7)

src/search.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ void Thread::search() {
504504

505505
mainThread->previousTimeReduction = timeReduction;
506506

507+
for (Thread* th : Threads)
508+
th->previousDepth = completedDepth;
509+
507510
// If skill level is enabled, swap best PV line with the sub-optimal one
508511
if (skill.enabled())
509512
std::swap(rootMoves[0], *std::find(rootMoves.begin(), rootMoves.end(),
@@ -1061,7 +1064,7 @@ namespace {
10611064
// a reduced search on all the other moves but the ttMove and if the
10621065
// result is lower than ttValue minus a margin, then we will extend the ttMove.
10631066
if ( !rootNode
1064-
&& depth >= 4 + 2 * (PvNode && tte->is_pv())
1067+
&& depth >= 4 - (thisThread->previousDepth > 27) + 2 * (PvNode && tte->is_pv())
10651068
&& move == ttMove
10661069
&& !excludedMove // Avoid recursive singular search
10671070
/* && ttValue != VALUE_NONE Already implicit in the next condition */

src/thread.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ void Thread::clear() {
6060
counterMoves.fill(MOVE_NONE);
6161
mainHistory.fill(0);
6262
captureHistory.fill(0);
63-
63+
previousDepth = 0;
64+
6465
for (bool inCheck : { false, true })
6566
for (StatsType c : { NoCaptures, Captures })
6667
{

src/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Thread {
6969
Position rootPos;
7070
StateInfo rootState;
7171
Search::RootMoves rootMoves;
72-
Depth rootDepth, completedDepth, depth;
72+
Depth rootDepth, completedDepth, depth, previousDepth;
7373
Value rootDelta;
7474
CounterMoveHistory counterMoves;
7575
ButterflyHistory mainHistory;

0 commit comments

Comments
 (0)