]> git.sesse.net Git - stockfish/commit
Allow TT entries with key16==0 to be fetched
authorSami Kiminki <skiminki@users.noreply.github.com>
Fri, 21 Aug 2020 09:12:39 +0000 (12:12 +0300)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 24 Aug 2020 10:03:28 +0000 (12:03 +0200)
commitf7b3f0e8426bbf7414d139ed9d1cfa7a98d7314d
treee98386396f18ecd788f6f7a7d8124961fcb7c2ec
parent701b2427bd84d112376ce858b66befc5b66c4bb2
Allow TT entries with key16==0 to be fetched

Fix the issue where a TT entry with key16==0 would always be reported
as a miss. Instead, we'll use depth8 to detect whether the TT entry is
occupied. In order to do that, we'll change DEPTH_OFFSET to -7
(depth8==0) to distinguish between an unoccupied entry and the
otherwise lowest possible depth, i.e., DEPTH_NONE (depth8==1).

To prevent a performance regression, we'll reorder the TT entry fields
by the access order of TranspositionTable::probe(). Memory in general
works fastest when accessed in sequential order. We'll also match the
store order in TTEntry::save() with the entry field order, and
re-order the 'if-or' expressions in TTEntry::save() from the cheapest
to the most expensive.

Finally, as we now have a proper TT entry occupancy test, we'll fix a
minor corner case with hashfull reporting. To reproduce:
- Use a big hash
- Either:
  a. Start 31 very quick searches (this wraparounds generation to 0); or
  b. Force generation of the first search to 0.
- go depth infinite

Before the fix, hashfull would incorrectly report nearly full hash
immediately after the search start, since
TranspositionTable::hashfull() used to consider only the entry
generation and not whether the entry was actually occupied.

STC:
LLR: 2.95 (-2.94,2.94) {-0.25,1.25}
Total: 36848 W: 4091 L: 3898 D: 28859
Ptnml(0-2): 158, 2996, 11972, 3091, 207
https://tests.stockfishchess.org/tests/view/5f3f98d5dc02a01a0c2881f7

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 32280 W: 1828 L: 1653 D: 28799
Ptnml(0-2): 34, 1428, 13051, 1583, 44
https://tests.stockfishchess.org/tests/view/5f3fe77a87a5c3c63d8f5332

closes https://github.com/official-stockfish/Stockfish/pull/3048

Bench: 3760677
src/tt.cpp
src/tt.h
src/types.h