mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Fix avx512icl update_piece_threats bug
Thanks to MinetaS for discovering this and finding the culprit commit,
specific to this architecture. 9f42980 was subtly incorrect, leading to
spurious wrong benches on avx512icl. Because this piece of code has twice been
the source of wrong benches, I also added a brief comment explaining why it
needs to be this way, and added a sample position to bench.
closes https://github.com/official-stockfish/Stockfish/pull/6654
Bench: 2288704
This commit is contained in:
committed by
Joost VandeVondele
parent
2907ee1a90
commit
b3a810a1c4
@@ -64,6 +64,7 @@ const std::vector<std::string> Defaults = {
|
|||||||
"r3k2r/3nnpbp/q2pp1p1/p7/Pp1PPPP1/4BNN1/1P5P/R2Q1RK1 w kq - 0 16",
|
"r3k2r/3nnpbp/q2pp1p1/p7/Pp1PPPP1/4BNN1/1P5P/R2Q1RK1 w kq - 0 16",
|
||||||
"3Qb1k1/1r2ppb1/pN1n2q1/Pp1Pp1Pr/4P2p/4BP2/4B1R1/1R5K b - - 11 40",
|
"3Qb1k1/1r2ppb1/pN1n2q1/Pp1Pp1Pr/4P2p/4BP2/4B1R1/1R5K b - - 11 40",
|
||||||
"4k3/3q1r2/1N2r1b1/3ppN2/2nPP3/1B1R2n1/2R1Q3/3K4 w - - 5 1",
|
"4k3/3q1r2/1N2r1b1/3ppN2/2nPP3/1B1R2n1/2R1Q3/3K4 w - - 5 1",
|
||||||
|
"1r6/1P4bk/3qr1p1/N6p/3pp2P/6R1/3Q1PP1/1R4K1 w - - 1 42",
|
||||||
|
|
||||||
// Positions with high numbers of changed threats
|
// Positions with high numbers of changed threats
|
||||||
"k7/2n1n3/1nbNbn2/2NbRBn1/1nbRQR2/2NBRBN1/3N1N2/7K w - - 0 1",
|
"k7/2n1n3/1nbNbn2/2NbRBn1/1nbRQR2/2NBRBN1/3N1N2/7K w - - 0 1",
|
||||||
|
|||||||
+4
-2
@@ -1131,7 +1131,9 @@ void Position::update_piece_threats(Piece pc,
|
|||||||
if constexpr (PutPiece)
|
if constexpr (PutPiece)
|
||||||
{
|
{
|
||||||
dts->threatenedSqs |= threatened;
|
dts->threatenedSqs |= threatened;
|
||||||
dts->threateningSqs |= s;
|
// A bit may only be set if that square actually produces a threat, so we
|
||||||
|
// must guard setting the square accordingly
|
||||||
|
dts->threateningSqs |= Bitboard(bool(threatened)) << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirtyThreat dt_template{pc, NO_PIECE, s, Square(0), PutPiece};
|
DirtyThreat dt_template{pc, NO_PIECE, s, Square(0), PutPiece};
|
||||||
@@ -1142,7 +1144,7 @@ void Position::update_piece_threats(Piece pc,
|
|||||||
|
|
||||||
if constexpr (PutPiece)
|
if constexpr (PutPiece)
|
||||||
{
|
{
|
||||||
dts->threatenedSqs |= s;
|
dts->threatenedSqs |= Bitboard(bool(all_attackers)) << s; // same as above
|
||||||
dts->threateningSqs |= all_attackers;
|
dts->threateningSqs |= all_attackers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user