mirror of
https://github.com/sockspls/badfish
synced 2025-07-12 03:59:15 +00:00
Prefetch also material tables
Prefetch both pawn and material tables in do_move() and prefetch always, not only after a pawn move or a capture. Speed up of 0,7% No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
2f1935078d
commit
6738b65be9
3 changed files with 9 additions and 10 deletions
|
@ -269,16 +269,13 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////
|
/// prefetchTables() is called in do_move() to prefetch pawn and material
|
||||||
//// Functions
|
/// hash tables data that will be needed shortly after in evaluation.
|
||||||
////
|
|
||||||
|
|
||||||
|
void prefetchTables(Key pKey, Key mKey, int threadID) {
|
||||||
|
|
||||||
/// Prefetches in pawn hash tables
|
PawnTable[threadID]->prefetch(pKey);
|
||||||
|
MaterialTable[threadID]->prefetch(mKey);
|
||||||
void prefetchPawn(Key key, int threadID) {
|
|
||||||
|
|
||||||
PawnTable[threadID]->prefetch(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ extern int get_system_time();
|
||||||
extern int cpu_count();
|
extern int cpu_count();
|
||||||
extern int input_available();
|
extern int input_available();
|
||||||
extern void prefetch(char* addr);
|
extern void prefetch(char* addr);
|
||||||
extern void prefetchPawn(Key, int);
|
extern void prefetchTables(Key pKey, Key mKey, int threadID);
|
||||||
|
|
||||||
// Debug functions
|
// Debug functions
|
||||||
extern bool dbg_show_mean;
|
extern bool dbg_show_mean;
|
||||||
|
|
|
@ -885,7 +885,6 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
|
||||||
|
|
||||||
// Update pawn hash key and prefetch in L1/L2 cache
|
// Update pawn hash key and prefetch in L1/L2 cache
|
||||||
st->pawnKey ^= zobrist[us][PAWN][from] ^ zobrist[us][PAWN][to];
|
st->pawnKey ^= zobrist[us][PAWN][from] ^ zobrist[us][PAWN][to];
|
||||||
prefetchPawn(st->pawnKey, threadID);
|
|
||||||
|
|
||||||
// Set en passant square, only if moved pawn can be captured
|
// Set en passant square, only if moved pawn can be captured
|
||||||
if ((to ^ from) == 16)
|
if ((to ^ from) == 16)
|
||||||
|
@ -938,6 +937,9 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prefetch pawn and material hash tables
|
||||||
|
prefetchTables(st->pawnKey, st->materialKey, threadID);
|
||||||
|
|
||||||
// Update incremental scores
|
// Update incremental scores
|
||||||
st->value += pst_delta(piece, from, to);
|
st->value += pst_delta(piece, from, to);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue