-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Movegen speedup via king attack info #638
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ddobbelaere
changed the title
[WIP] Movegen speedup
[WIP] Movegen speedup via king attack info
Jan 1, 2019
This was referenced Jan 1, 2019
Closed
ddobbelaere
changed the title
[WIP] Movegen speedup via king attack info
Movegen speedup via king attack info
Jan 2, 2019
This PR is ready for review. |
On my machine chessboard_test with uncommented tests:
With this PR
Looks good! (for the reference, uncommented lines: --- a/src/chess/board_test.cc
+++ b/src/chess/board_test.cc
@@ -94,7 +94,7 @@ int Perft(const ChessBoard& board, int max_depth, bool dump = false,
}
} // namespace
-/* TEST(ChessBoard, MoveGenStartingPos) {
+TEST(ChessBoard, MoveGenStartingPos) {
ChessBoard board;
board.SetFromFen(ChessBoard::kStartposFen);
@@ -105,7 +105,7 @@ int Perft(const ChessBoard& board, int max_depth, bool dump = false,
EXPECT_EQ(Perft(board, 4), 197281);
EXPECT_EQ(Perft(board, 5), 4865609);
EXPECT_EQ(Perft(board, 6), 119060324);
-} */
+}
TEST(ChessBoard, MoveGenKiwipete) {
ChessBoard board;
@@ -116,7 +116,7 @@ TEST(ChessBoard, MoveGenKiwipete) {
EXPECT_EQ(Perft(board, 2), 2039);
EXPECT_EQ(Perft(board, 3), 97862);
EXPECT_EQ(Perft(board, 4), 4085603);
-// EXPECT_EQ(Perft(board, 5), 193690690);
+ EXPECT_EQ(Perft(board, 5), 193690690);
}
TEST(ChessBoard, MoveGenPosition3) {
@@ -151,7 +151,7 @@ TEST(ChessBoard, MoveGenPosition5) {
EXPECT_EQ(Perft(board, 2), 1486);
EXPECT_EQ(Perft(board, 3), 62379);
EXPECT_EQ(Perft(board, 4), 2103487);
-// EXPECT_EQ(Perft(board, 5), 89941194);
+ EXPECT_EQ(Perft(board, 5), 89941194);
}
TEST(ChessBoard, MoveGenPosition6) { ) |
mooskagh
approved these changes
Jan 5, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Various movegen optimizations centered around the introduction of precomputed king attack info (attacking lines, pinned pieces, double check detection) that is used to speedup several parts of legal move detection (for all moves).
Unconditional speedup for random backend up to 6% (tested with LTO builds on Linux Fedora 29 64-bit,
gcc 8.2.1
).The following measurements all share the command line
lc0 benchmark --backend=random --smart-pruning-factor=0 --nodes=1000000 --nncache=1000000
. A 95% confidence interval for the average of the last reported nps value over 25 runs is given for the starting position, the opening position https://lichess.org/editor/rn2kb1r/pp3ppp/2p1pnb1/8/3P1N1q/4B1N1/PPPQ1PPP/R3KB1R_b_KQkq_-_5_9 and the endgame position https://lichess.org/editor/8/2R2P2/1p4K1/6R1/1r6/5rP1/1k6/2q5_w_-_-_0_55 .The measurements are performed on an Intel Core i5-5300U CPU @ 2.30GHz with 4 cores and L1d cache: 32K, L1i cache: 32K, L2 cache: 256K, L3 cache: 3072K.
For 1 search thread:
6a639b6
For 2 search threads:
6a639b6