mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Properly initialize the TT in a multithreaded way again
This commit is contained in:
parent
ba06671aa9
commit
7f09d06b83
2 changed files with 7 additions and 4 deletions
|
@ -75,9 +75,11 @@ uint8_t TTEntry::relative_age(const uint8_t generation8) const {
|
|||
// measured in megabytes. Transposition table consists
|
||||
// of clusters and each cluster consists of ClusterSize number of TTEntry.
|
||||
void TranspositionTable::resize(size_t mbSize, ThreadPool& threads) {
|
||||
aligned_large_pages_free(table);
|
||||
|
||||
clusterCount = mbSize * 1024 * 1024 / sizeof(Cluster);
|
||||
|
||||
table = make_unique_large_page<Cluster[]>(clusterCount);
|
||||
table = static_cast<Cluster*>(aligned_large_pages_alloc(clusterCount * sizeof(Cluster)));
|
||||
|
||||
if (!table)
|
||||
{
|
||||
|
|
7
src/tt.h
7
src/tt.h
|
@ -96,6 +96,7 @@ class TranspositionTable {
|
|||
static constexpr int GENERATION_MASK = (0xFF << GENERATION_BITS) & 0xFF;
|
||||
|
||||
public:
|
||||
~TranspositionTable() { aligned_large_pages_free(table); }
|
||||
void new_search() {
|
||||
// increment by delta to keep lower bits as is
|
||||
generation8 += GENERATION_DELTA;
|
||||
|
@ -115,9 +116,9 @@ class TranspositionTable {
|
|||
private:
|
||||
friend struct TTEntry;
|
||||
|
||||
size_t clusterCount;
|
||||
LargePagePtr<Cluster[]> table;
|
||||
uint8_t generation8 = 0; // Size must be not bigger than TTEntry::genBound8
|
||||
size_t clusterCount;
|
||||
Cluster* table = nullptr;
|
||||
uint8_t generation8 = 0; // Size must be not bigger than TTEntry::genBound8
|
||||
};
|
||||
|
||||
} // namespace Stockfish
|
||||
|
|
Loading…
Add table
Reference in a new issue