official-stockfish / Stockfish

A free and strong UCI chess engine
https://stockfishchess.org/
GNU General Public License v3.0
11.38k stars 2.25k forks source link

PV depth increasing and decreasing (sorting bug?) #1787

Closed hero2017 closed 5 years ago

hero2017 commented 5 years ago

I happen across this position in a game and I'm thinking this is either a SF bug or gui but I've been using Aquarium for a decade and never saw this. Notice the depth below goes from d=31 to d=32 then back down to d=31. Then it reaches d=33 and goes down to 32 then skips and goes to d=34. This is with the latest SF (reduce depth after fail high).

Sorry about the formatting (looks better in notepad) but I couldn't improve the view and had to settle to insert it as a quote...this is the PV directly from the infinite analysis tree window in Aquarium (best to view from bottom to top):

[FEN "r4rk1/2pnqppp/p2bpn2/1p2N3/3P1B2/1N4P1/PP2PPKP/R1QR4 b - - 0 17"]

[+0.11] d=38 17...Nd5 18.Na5 Rac8 19.Nac6 Qe8 20.Bd2 f5 21.Nxd7 Qxd7 22.Qc2 Qf7 23.f3 Rce8 24.Ne5 Qh5 25.Rac1 c5 26.Nd7 Rf7 27.dxc5 Rxd7 28.cxd6 Rxd6 29.Qb3 Qf7 30.e4 fxe4 31.fxe4 Nb6 32.Bb4 Rxd1 33.Qxd1 Nc4 34.Qf3 Qxf3+ 35.Kxf3 Nxb2 36.Rc6 a5 37.Bc3 Nc4 38.Ke2 Rb8 39.Rxe6 b4 40.Be5 Nxe5 41.Rxe5(0:02:23) 2878096kN [+0.09] d=38 17...Nd5 18.Na5 Qe8 19.Qc6 Bxe5 20.Bxe5 f6 21.Bf4 Qf7 22.Nb7 Ra7 23.Nc5 Nxc5 24.dxc5 Raa8 25.Rd2 Nxf4+ 26.gxf4 Rad8 27.Rad1 Rxd2 28.Rxd2 Qg6+ 29.Kf1 Qb1+(0:01:53) 2263076kN [+0.00] d=36 17...Nd5 18.Na5 Qe8 19.Qc6 Bxe5 20.Bxe5 f6 21.Bf4 Qf7 22.Nb7 Ra7 23.Nc5 Nxc5 24.dxc5 Raa8 25.Rd2 Nxf4+ 26.gxf4 Rad8 27.Rad1 Rxd2 28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e5 22.dxe5 Bxe5 23.Rd2 Bxf4 24.gxf4 Qe6 25.Qxc7 Rae8 26.Qc3 Qh6 27.Qf3 Rd8 28.Rad1 Rxd2 29.Rxd2 Qg6+ 30.Qg3(0:00:15) 323364kN [+0.17] d=32 17...Nd5 18.Na5 Qe8 19.Nd3 N7b6 20.Qc2 Nxf4+ 21.Nxf4 e5 22.dxe5 Bxe5 23.Rd2 Bxf4 24.gxf4 Qe6 25.Qxc7 Rae8 26.Qc3 Qh6 27.Qf3 Rd8 28.Rad1 Rxd2 29.Rxd2 Qg6+ 30.Qg3 Qe6(0:00:14) 285086kN [+0.09] d=32 17...Nd5 18.Na5 Qe8 19.Nd3 N7b6 20.Qc2 Nxf4+ 21.Nxf4 e5 22.dxe5 Bxe5 23.Rd2 Bxf4 24.gxf4 Qe6 25.Qxc7 Rae8 26.Qc3 Qh6 27.Qf3 Rd8 28.Rad1 Rxd2 29.Rxd2 Qg6+ 30.Qg3 Qe6 31.Qe3(0:00:12) 251799kN [+0.00] d=31 17...Nd5 18.Na5 Qe8 19.Nd3 N7b6 20.Qc2 Nxf4+ 21.Nxf4 e5 22.dxe5 Bxe5 23.Rd2 Bxf4 24.gxf4 Qe6 25.Qxc7 Rae8 26.Qc3 Qh6 27.Qf3 Rd8 28.Rad1 Rxd2 29.Rxd2 Qg6+ 30.Qg3 Qe6 31.Qe3 Qg6+(0:00:08) 181478kN

Now I suppose that's expected behaviour with the latest patch but that just feels weird.

anshulongithub commented 5 years ago

@vondele will this patch affect the functioning of your randomization patch cuz now main thread is having a different depth than the rest and filling the TT with it? Some of the positions that @ssj100 and @crossbr mentioned are not getting resolved as they were before. Is this something to be concerned about or what can be done to make sure that the original behavior of the randomization patch is not affected by this patch?

vondele commented 5 years ago

At the moment, I don't know how this interacts with randomization patch. I assume we'll find out.

I'll prepare a patch for some of the other issues mentioned in this thread, but I'm waiting for some running tests.

xoto10 commented 5 years ago

My guess is that because the randomization patch adds randomness (or at least pseudo...) the exact details of which positions it helps will change with subsequent releases. I expect it still works, but the detail of which positions are helped (and which are not) has changed.

vondele commented 5 years ago

should all be back to normal with the latest merge.

hero2017 commented 5 years ago

pb00068 I use Aquarium 2018 GUI. Of course, I do not mean an instantaneous continuation from the same depth, when I continue the variant manually, but a very rapid increase in it (in a matter of seconds high values are reached, close to the reached value initially).

I use Aquarium 2018 too and when I start an engine in the same position where I've already searched with infinite analysis and depth/score is saved in tree then it doesn't continue from same depth. It always takes me about the same time to reach the same depth I reached previously. Are you loading/saving hash first with a SF clone like Raub? Even that doesn't work for me, at least not with > 8 GB hash.

snicolet commented 5 years ago

Closing the issue for now after https://github.com/official-stockfish/Stockfish/commit/3f1eb85a1ceb1b408f8f51cb82064b69e095399d has been merged.