Speculative prefetch

Idea by Peter Oesterlund.
Implemented and tested by Joerg Oester

STC 3 threads
ELO: 3.19 +-2.1 (95%) LOS: 99.9%
Total: 40000 W: 7576 L: 7209 D: 25215

LTC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 22026 W: 3829 L: 3619 D: 14578

STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 7291 W: 1531 L: 1404 D: 4356

No functional change

Resolves #61
This commit is contained in:
joergoster
2014-10-02 22:19:14 +01:00
committed by Joona Kiiski
parent e60cdca9b0
commit 82d065b011
3 changed files with 22 additions and 0 deletions

View File

@@ -1015,6 +1015,21 @@ void Position::undo_null_move() {
sideToMove = ~sideToMove;
}
// Position::hash_after_move() updates the hash key needed for the speculative prefetch.
// It doesn't recognize special moves like castling, en-passant and promotions.
Key Position::hash_after_move(Move m) const {
int from = from_sq(m);
int to = to_sq(m);
Piece p = board[from];
Piece capP = board[to];
Key ret = st->key ^ Zobrist::side;
if (capP != NO_PIECE)
ret ^= Zobrist::psq[color_of(capP)][type_of(capP)][to];
ret ^= Zobrist::psq[color_of(p)][type_of(p)][to];
ret ^= Zobrist::psq[color_of(p)][type_of(p)][from];
return ret;
}
/// Position::see() is a static exchange evaluator: It tries to estimate the
/// material gain or loss resulting from a move.