mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Revert "Cache line aligned TT"
This reverts commit 083fe58124
It seems to break Android build
No functional change.
This commit is contained in:
parent
06b9140e5c
commit
293c44bc09
4 changed files with 11 additions and 11 deletions
|
@ -237,8 +237,10 @@ void prefetch(char* addr) {
|
||||||
|
|
||||||
# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
# if defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
||||||
_mm_prefetch(addr, _MM_HINT_T0);
|
_mm_prefetch(addr, _MM_HINT_T0);
|
||||||
|
_mm_prefetch(addr+64, _MM_HINT_T0); // 64 bytes ahead
|
||||||
# else
|
# else
|
||||||
__builtin_prefetch(addr);
|
__builtin_prefetch(addr);
|
||||||
|
__builtin_prefetch(addr+64);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/tt.cpp
12
src/tt.cpp
|
@ -39,18 +39,18 @@ void TranspositionTable::set_size(size_t mbSize) {
|
||||||
if (hashMask == size - ClusterSize)
|
if (hashMask == size - ClusterSize)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(mem);
|
hashMask = size - ClusterSize;
|
||||||
mem = malloc(size * sizeof(TTEntry) + (CACHE_LINE_SIZE - 1));
|
delete [] table;
|
||||||
if (!mem)
|
table = new (std::nothrow) TTEntry[size];
|
||||||
|
|
||||||
|
if (!table)
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to allocate " << mbSize
|
std::cerr << "Failed to allocate " << mbSize
|
||||||
<< "MB for transposition table." << std::endl;
|
<< "MB for transposition table." << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
table = (TTEntry*)((size_t(mem) + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1));
|
clear(); // Operator new is not guaranteed to initialize memory to zero
|
||||||
hashMask = size - ClusterSize;
|
|
||||||
clear(); // Newly allocated block of memory is not initialized
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
3
src/tt.h
3
src/tt.h
|
@ -85,7 +85,7 @@ class TranspositionTable {
|
||||||
static const unsigned ClusterSize = 4; // A cluster is 64 Bytes
|
static const unsigned ClusterSize = 4; // A cluster is 64 Bytes
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~TranspositionTable() { free(mem); }
|
~TranspositionTable() { delete [] table; }
|
||||||
void new_search() { generation++; }
|
void new_search() { generation++; }
|
||||||
|
|
||||||
TTEntry* probe(const Key key) const;
|
TTEntry* probe(const Key key) const;
|
||||||
|
@ -98,7 +98,6 @@ public:
|
||||||
private:
|
private:
|
||||||
uint32_t hashMask;
|
uint32_t hashMask;
|
||||||
TTEntry* table;
|
TTEntry* table;
|
||||||
void* mem;
|
|
||||||
uint8_t generation; // Size must be not bigger then TTEntry::generation8
|
uint8_t generation; // Size must be not bigger then TTEntry::generation8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,10 @@
|
||||||
# include <xmmintrin.h> // Intel and Microsoft header for _mm_prefetch()
|
# include <xmmintrin.h> // Intel and Microsoft header for _mm_prefetch()
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#define CACHE_LINE_SIZE 64
|
|
||||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||||
# define CACHE_LINE_ALIGNMENT __declspec(align(CACHE_LINE_SIZE))
|
# define CACHE_LINE_ALIGNMENT __declspec(align(64))
|
||||||
#else
|
#else
|
||||||
# define CACHE_LINE_ALIGNMENT __attribute__ ((aligned(CACHE_LINE_SIZE)))
|
# define CACHE_LINE_ALIGNMENT __attribute__ ((aligned(64)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
Loading…
Add table
Reference in a new issue