mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 20:57:10 +00:00
Simplify out double_inc_update
Passed STC https://tests.stockfishchess.org/tests/view/69e82e200e9667dd5a765631 LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 115424 W: 29950 L: 29822 D: 55652 Ptnml(0-2): 318, 12712, 31544, 12800, 338 Passed AVX2-only STC https://tests.stockfishchess.org/tests/view/69e953080e9667dd5a7657c0 LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 134720 W: 34773 L: 34665 D: 65282 Ptnml(0-2): 344, 14958, 36694, 14974, 390 Now that our L1 size is much smaller, the overhead of tracking diffs for `double_inc_update` is a larger share of the cost. Interestingly ces42 measured a -0.9% slowdown locally (avxvnni build). Meanwhile Torom and I find this branch to be 2% faster. I'm not sure exactly what's going on but more tests may be in order closes https://github.com/official-stockfish/Stockfish/pull/6776 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
0e78190b72
commit
1a882efc7f
+8
-7
@@ -195,8 +195,9 @@ class Position {
|
||||
void set_check_info() const;
|
||||
|
||||
// Other helpers
|
||||
template<bool PutPiece, bool ComputeRay = true>
|
||||
template<bool ComputeRay = true>
|
||||
void update_piece_threats(Piece pc,
|
||||
bool putPiece,
|
||||
Square s,
|
||||
DirtyThreats* const dts,
|
||||
Bitboard noRaysContaining = -1ULL) const;
|
||||
@@ -362,14 +363,14 @@ inline void Position::put_piece(Piece pc, Square s, DirtyThreats* const dts) {
|
||||
pieceCount[make_piece(color_of(pc), ALL_PIECES)]++;
|
||||
|
||||
if (dts)
|
||||
update_piece_threats<true>(pc, s, dts);
|
||||
update_piece_threats(pc, true, s, dts);
|
||||
}
|
||||
|
||||
inline void Position::remove_piece(Square s, DirtyThreats* const dts) {
|
||||
Piece pc = board[s];
|
||||
|
||||
if (dts)
|
||||
update_piece_threats<false>(pc, s, dts);
|
||||
update_piece_threats(pc, false, s, dts);
|
||||
|
||||
byTypeBB[ALL_PIECES] ^= s;
|
||||
byTypeBB[type_of(pc)] ^= s;
|
||||
@@ -384,7 +385,7 @@ inline void Position::move_piece(Square from, Square to, DirtyThreats* const dts
|
||||
Bitboard fromTo = from | to;
|
||||
|
||||
if (dts)
|
||||
update_piece_threats<false>(pc, from, dts, fromTo);
|
||||
update_piece_threats(pc, false, from, dts, fromTo);
|
||||
|
||||
byTypeBB[ALL_PIECES] ^= fromTo;
|
||||
byTypeBB[type_of(pc)] ^= fromTo;
|
||||
@@ -393,7 +394,7 @@ inline void Position::move_piece(Square from, Square to, DirtyThreats* const dts
|
||||
board[to] = pc;
|
||||
|
||||
if (dts)
|
||||
update_piece_threats<true>(pc, to, dts, fromTo);
|
||||
update_piece_threats(pc, true, to, dts, fromTo);
|
||||
}
|
||||
|
||||
inline void Position::swap_piece(Square s, Piece pc, DirtyThreats* const dts) {
|
||||
@@ -402,12 +403,12 @@ inline void Position::swap_piece(Square s, Piece pc, DirtyThreats* const dts) {
|
||||
remove_piece(s);
|
||||
|
||||
if (dts)
|
||||
update_piece_threats<false, false>(old, s, dts);
|
||||
update_piece_threats<false>(old, false, s, dts);
|
||||
|
||||
put_piece(pc, s);
|
||||
|
||||
if (dts)
|
||||
update_piece_threats<true, false>(pc, s, dts);
|
||||
update_piece_threats<false>(pc, true, s, dts);
|
||||
}
|
||||
|
||||
inline void Position::do_move(Move m, StateInfo& newSt, const TranspositionTable* tt = nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user