Skip to content

Simplify TT move extension formula - #6521

Closed
FauziAkram wants to merge 1 commit into
official-stockfish:masterfrom
FauziAkram:isus1PR
Closed

Simplify TT move extension formula#6521
FauziAkram wants to merge 1 commit into
official-stockfish:masterfrom
FauziAkram:isus1PR

Conversation

@FauziAkram

Copy link
Copy Markdown
Contributor

Simplify TT move extension formula

Passed STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 110560 W: 28603 L: 28469 D: 53488
Ptnml(0-2): 303, 12146, 30254, 12268, 309
https://tests.stockfishchess.org/tests/view/6958ed4dd844c1ce7cc7e98e

No functional change

No functional change
@robertnurnberg

Copy link
Copy Markdown
Contributor

Judging by the comment, this would need a matetrack run as well.

Not sure how to check effect on retrograde analysis. @pb00068

@vondele

vondele commented Jan 4, 2026

Copy link
Copy Markdown
Member

I think this was added with the comment to make sure it stays for this reason?
Edit: but this is non-functional now?

@FauziAkram

Copy link
Copy Markdown
Contributor Author

Yes, this is non-functional.
Can someone please run a matetrack run?

@pb00067

pb00067 commented Jan 5, 2026

Copy link
Copy Markdown

Judging by the comment, this would need a matetrack run as well.

Not sure how to check effect on retrograde analysis. @pb00068

Unfortunately this patch breaks the retrograde analysis ability of SF,
tried on position FEN: 2K1k1br/3p1n1r/2p2pN1/P2p1N2/2P3pP/5B2/P2P4/8 b - - 9 9
and going backwards the moves:
immagine
startpos: 6br/1KNp1n1r/2p2p2/P1ppRP2/1kP3pP/3PBB2/PN1P4/8 w - - 0 1

@robertnurnberg

Copy link
Copy Markdown
Contributor

Thanks! Could you double-check that master is still fine?

So the patch is indeed functional, it just doesn't change bench, correct?

@pb00067

pb00067 commented Jan 5, 2026

Copy link
Copy Markdown

Thanks! Could you double-check that master is still fine?

Good catch.
Effectively also current master has problems on that particular FEN: 2K1k1br/3p1n1r/2p2pN1/P2p1N2/2P3pP/5B2/P2P4/8 b - - 9 9

P.S.: In order to re-establish the previous backward analysis capability it seems that now we need following condition:

  if (move == ttData.move && ((is_valid(ttData.value) && is_decisive(ttData.value)) || ttData.depth > 1))
           newDepth = std::max(newDepth, 1);

Edit 2: condition above sometimes work sometimes not.

@robertnurnberg

Copy link
Copy Markdown
Contributor

I think the best strategy would be to find the (simplification?) commit that broke the retrograde analysis fix you introduced and then possibly revert that (while also adding a comment in the source)?

@pb00067

pb00067 commented Jan 6, 2026

Copy link
Copy Markdown

I think the best strategy would be to find the (simplification?) commit that broke the retrograde analysis fix you introduced

Not an easy task to find it.

@robertnurnberg

Copy link
Copy Markdown
Contributor

Starting point would probably be a git-blame on the parts of the code you introduced and believe are critically important.

Alternative explanation is that your fix was not that robust in the first place? So maybe it "broke" due to some unrelated patch.

@pb00067

pb00067 commented Jan 6, 2026

Copy link
Copy Markdown

Alternative explanation is that your fix was not that robust in the first place?

Since TT entries might be overriden by other positions, no fix is really robust in that sense when relying on TT only.
In meantime I test https://tests.stockfishchess.org/tests/view/695ce092912b7ff140de60c6 which restores more or less the retrograde analysis capability we had before.

Finding a robust solution would surely require lot of more code and further research...

pb00068 added a commit to pb00068/Stockfish that referenced this pull request Jan 8, 2026
by simplifying according condition in search.cpc

Passed STC and LTC non-reg bounds:
https://tests.stockfishchess.org/tests/view/695ce092912b7ff140de60c6
LLR: 3.17 (-2.94,2.94) <-1.75,0.25>
Total: 121728 W: 31439 L: 31298 D: 58991
Ptnml(0-2): 305, 13281, 33554, 13416, 308

https://tests.stockfishchess.org/tests/view/695dfc9702d0182a589fe8e8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 56220 W: 14472 L: 14299 D: 27449
Ptnml(0-2): 30, 5326, 17219, 5511, 24

Superseeds PR official-stockfish#6521

bench: 2477446
@robertnurnberg

robertnurnberg commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

So, similarly to #6531 (comment), the comparison with master for this patch is:

Patch

> python retrocheck.py
Loaded 6554 FENs, with max(|bm|) = 126.

retrocheck started for ./stockfish on matetrackpv.epd with --nodes 1000000 --nodesFill 100000 ...
100%|##########| 97/97 [1:05:58<00:00, 40.81s/it] 


Using ./stockfish on matetrackpv.epd with --nodes 1000000 --nodesFill 100000
Engine ID:     Stockfish dev-20260104-dc58db0e
Total FENs:    6554
Found mates:   4592
Best mates:    4312

Master:

> python retrocheck.py
Loaded 6554 FENs, with max(|bm|) = 126.

retrocheck started for ./stockfish on matetrackpv.epd with --nodes 1000000 --nodesFill 100000 ...
100%|#########################################| 97/97 [1:03:31<00:00, 39.29s/it]


Using ../stockfish/src/master on matetrackpv.epd with --nodes 1000000 --nodesFill 100000
Engine ID:     Stockfish dev-20260106-c27c1747
Total FENs:    6554
Found mates:   5294
Best mates:    5063

So a quite clearly regression for retrograde analysis, from 5294 to 4592 mates found.

Edit: Numbers are now corrected, after an earlier version of retrocheck.py has been fixed.

@Disservin

Copy link
Copy Markdown
Member

based on matetrack results closing

@Disservin Disservin closed this Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants