smaller tt entry | bench 150493

This commit is contained in:
rektdie committed 2026-10-03 23:06:31 +02:00
1 parent 3b79f22ec7
commit 56b00e290d
3 files changed
+21 -9

No files matched your search

+14 -3
View File
@@ -19,9 +19,16 @@ public:
}
};
constexpr U64 hashKeyMask = 0xFFFF;
// only the lowest bits of the hashkey are stored, the rest is only used for indexing
inline uint16_t PackHashKey(U64 &hashKey) {
return uint16_t(hashKey & hashKeyMask);
}
class TTEntry {
public:
U64 hashKey = 0;
uint16_t hashKey = 0;
int16_t score = 0;
Move bestMove = Move();
uint8_t depth = 0;
@@ -46,6 +53,8 @@ public:
TTEntry alwaysReplace;
};
static_assert(sizeof(TTEntry) == 10);
// 1024 MB
constexpr U64 maxHash = (1024 * 1000000) / sizeof(TTBucket);
// 8 MB
@@ -84,9 +93,11 @@ public:
TTEntry GetEntry(U64 &hashKey) {
TTBucket *current = &table[hashKey % table.size()];
if (current->depthPreferred.hashKey == hashKey) {
const uint16_t packedKey = PackHashKey(hashKey);
if (current->depthPreferred.hashKey == packedKey) {
return current->depthPreferred;
} else if (current->alwaysReplace.hashKey == hashKey) {
} else if (current->alwaysReplace.hashKey == packedKey) {
return current->alwaysReplace;
}