|
io-chess
UCI chess engine
|
The main Transposition Table. More...
#include <TT.h>

Public Member Functions | |
| TranspositionTable ()=default | |
| ~TranspositionTable () | |
| void | resize (size_t mb) |
| Resizes the Transposition Table to the specified capacity in Megabytes. | |
| void | clear () |
| Clears the contents of the Transposition Table. | |
| void | newSearch () |
| Increments the internal age generation to age out older entries. | |
| void | setDisabled (bool disabled) |
| void | setNumThreads (int n) |
| int | hashfull () const |
| Calculates the utilization of the Transposition Table (per-mille). | |
| void | prefetch (uint64_t key) const |
| Issues a memory prefetch instruction for the cluster corresponding to the key. | |
| bool | probe (uint64_t key, int depth, int &score, Move &bestMove, int &entryDepth, Bound &entryBound) const |
| Fully probes the TT for a search entry matching the key. | |
| Move | probeMove (uint64_t key) const |
| Lightly probes the TT just to extract the best move (for move ordering). | |
| std::optional< int > | probeScore (uint64_t key) const |
| Lightly probes the TT to extract only the score (for pruning heuristics). | |
| bool | probeEval (uint64_t key, int16_t &score) const |
| Probes the dedicated static evaluation slot. | |
| void | storeEval (uint64_t key, int16_t score) |
| Stores a static evaluation in the dedicated slot. | |
| void | store (uint64_t key, int depth, int score, Bound bound, Move bestMove, int staticEval=0) |
| Stores search results into the best slot in the cluster. | |
| void | dumpToFile (const std::string &filename) const |
| bool | saveFullToFile (const std::string &filename) const |
| bool | loadFullFromFile (const std::string &filename) |
Private Member Functions | |
| size_t | index (uint64_t key) const |
| int | ageDiff (uint8_t entryAge) const |
Private Attributes | |
| Cluster * | table_ = nullptr |
| Pointer to the heap-allocated clusters. | |
| size_t | clusterCount_ = 0 |
| Number of available clusters. | |
| size_t | indexMask_ = 0 |
| Bitmask for fast modulo addressing. | |
| uint8_t | currentAge_ = 0 |
| Current generation age (used to age out old entries). | |
| bool | disableTT_ = false |
| Flag to disable the TT entirely. | |
| int | numThreads_ = 1 |
| Number of threads sharing the table. | |
| bool | usingHugePages_ = false |
| True if the memory was allocated via HugePages. | |
The main Transposition Table.
Manages allocation, probing, and replacement of clusters using a lockless architecture suitable for SMP search.
|
default |
| TranspositionTable::~TranspositionTable | ( | ) |
|
inlineprivate |

| void TranspositionTable::clear | ( | ) |
Clears the contents of the Transposition Table.

| void TranspositionTable::dumpToFile | ( | const std::string & | filename | ) | const |
| int TranspositionTable::hashfull | ( | ) | const |
Calculates the utilization of the Transposition Table (per-mille).
|
inlineprivate |

| bool TranspositionTable::loadFullFromFile | ( | const std::string & | filename | ) |
|
inline |
Increments the internal age generation to age out older entries.
| void TranspositionTable::prefetch | ( | uint64_t | key | ) | const |
Issues a memory prefetch instruction for the cluster corresponding to the key.

| bool TranspositionTable::probe | ( | uint64_t | key, |
| int | depth, | ||
| int & | score, | ||
| Move & | bestMove, | ||
| int & | entryDepth, | ||
| Bound & | entryBound ) const |
Fully probes the TT for a search entry matching the key.

| bool TranspositionTable::probeEval | ( | uint64_t | key, |
| int16_t & | score ) const |
Probes the dedicated static evaluation slot.

| Move TranspositionTable::probeMove | ( | uint64_t | key | ) | const |
Lightly probes the TT just to extract the best move (for move ordering).

| std::optional< int > TranspositionTable::probeScore | ( | uint64_t | key | ) | const |
Lightly probes the TT to extract only the score (for pruning heuristics).

| void TranspositionTable::resize | ( | size_t | mb | ) |
Resizes the Transposition Table to the specified capacity in Megabytes.

| bool TranspositionTable::saveFullToFile | ( | const std::string & | filename | ) | const |
|
inline |
|
inline |
| void TranspositionTable::store | ( | uint64_t | key, |
| int | depth, | ||
| int | score, | ||
| Bound | bound, | ||
| Move | bestMove, | ||
| int | staticEval = 0 ) |
Stores search results into the best slot in the cluster.
Implements a replacement scheme based on depth and age.

| void TranspositionTable::storeEval | ( | uint64_t | key, |
| int16_t | score ) |
Stores a static evaluation in the dedicated slot.

|
private |
Number of available clusters.
|
private |
Current generation age (used to age out old entries).
|
private |
Flag to disable the TT entirely.
|
private |
Bitmask for fast modulo addressing.
|
private |
Number of threads sharing the table.
|
private |
Pointer to the heap-allocated clusters.
|
private |
True if the memory was allocated via HugePages.