X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftt.cpp;h=f2313eabf1c72eee350de8cdda7038519944d222;hb=cd4604b05c2d61928b26ab50c5864c36ef1d3785;hp=49dae31d70ffb5b634709e339c7815d8d5e5184d;hpb=6f1475b6fcd3e3728d800e622ab7a22265fb8ca4;p=stockfish diff --git a/src/tt.cpp b/src/tt.cpp index 49dae31d..f2313eab 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -25,13 +25,14 @@ #include #include #include +#include #include "movegen.h" #include "tt.h" /// This is the number of TTEntry slots for each position -static const int ClusterSize = 4; +static const int ClusterSize = 5; //// @@ -153,6 +154,17 @@ TTEntry* TranspositionTable::retrieve(const Key posKey) const { return NULL; } +/// TranspositionTable::prefetch looks up the current position in the +/// transposition table and load it in L1/L2 cache. This is a non +/// blocking function and do not stalls the CPU waiting for data +/// to be loaded from RAM, that can be very slow. When we will +/// subsequently call retrieve() the TT data will be already +/// quickly accessible in L1/l2 CPU cache. + +void TranspositionTable::prefetch(const Key posKey) const { + + _mm_prefetch((char*)first_entry(posKey), _MM_HINT_T0); +} /// TranspositionTable::first_entry returns a pointer to the first /// entry of a cluster given a position. The low 32 bits of the key