mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 20:57:10 +00:00
Branchless correction history with to_sq_unchecked
Add Move::to_sq_unchecked() that bypasses the is_ok() assertion, for use in branchless code paths where invalid moves are masked out. passed STC: LLR: 2.93 (-2.94,2.94) <0.00,2.00> Total: 92384 W: 24052 L: 23665 D: 44667 Ptnml(0-2): 265, 10229, 24831, 10588, 279 https://tests.stockfishchess.org/tests/view/6974dfc798dc5fff1dba5b74 closes https://github.com/official-stockfish/Stockfish/pull/6569 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
7f85cfbfa2
commit
542c30c292
+8
-7
@@ -114,13 +114,14 @@ void update_correction_history(const Position& pos,
|
||||
shared.nonpawn_correction_entry<WHITE>(pos).at(us).nonPawnWhite << bonus * nonPawnWeight / 128;
|
||||
shared.nonpawn_correction_entry<BLACK>(pos).at(us).nonPawnBlack << bonus * nonPawnWeight / 128;
|
||||
|
||||
if (m.is_ok())
|
||||
{
|
||||
const Square to = m.to_sq();
|
||||
const Piece pc = pos.piece_on(m.to_sq());
|
||||
(*(ss - 2)->continuationCorrectionHistory)[pc][to] << bonus * 127 / 128;
|
||||
(*(ss - 4)->continuationCorrectionHistory)[pc][to] << bonus * 59 / 128;
|
||||
}
|
||||
// Branchless: use mask to zero bonus when move is not ok
|
||||
const int mask = int(m.is_ok());
|
||||
const Square to = m.to_sq_unchecked();
|
||||
const Piece pc = pos.piece_on(to);
|
||||
const int bonus2 = (bonus * 127 / 128) * mask;
|
||||
const int bonus4 = (bonus * 59 / 128) * mask;
|
||||
(*(ss - 2)->continuationCorrectionHistory)[pc][to] << bonus2;
|
||||
(*(ss - 4)->continuationCorrectionHistory)[pc][to] << bonus4;
|
||||
}
|
||||
|
||||
// Add a small random component to draw evaluations to avoid 3-fold blindness
|
||||
|
||||
Reference in New Issue
Block a user