]> git.sesse.net Git - stockfish/commit
Simplify pondering time management (#1899)
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 20 Jan 2019 18:14:24 +0000 (19:14 +0100)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Sun, 20 Jan 2019 18:14:24 +0000 (19:14 +0100)
commit58d3ee61757215292b48e32caec9931d901c2940
tree6a9e0ceaeddaa0a1b1414e1eb36f407923ed74b2
parent59b2486bc3d153b8946661c7a6a501f4410b4e66
Simplify pondering time management (#1899)

stopOnPonderhit is used to stop search quickly on a ponderhit. It is set by mainThread as part of its time management. However, master employs it as a signal between mainThread and the UCI thread. This is not necessary, it is sufficient for the UCI thread to signal that pondering finished, and mainThread should do its usual time-keeping job, and in this case stop immediately.

This patch implements this, removing stopOnPonderHit as an atomic variable from the ThreadPool,
and moving it as a normal variable to mainThread, reducing its scope. In MainThread::check_time() the search is stopped immediately if ponder switches to false, and the variable stopOnPonderHit is set.

Furthermore, ponder has been moved to mainThread, as the variable is only used to exchange signals between the UCI thread and mainThread.

The version has been tested locally (as fishtest doesn't support ponder):

Score of ponderSimp vs master: 2616 - 2528 - 8630 [0.503] 13774
Elo difference: 2.22 +/- 3.54

which indicates no regression.

No functional change.
src/search.cpp
src/thread.cpp
src/thread.h
src/uci.cpp