From 92fc41226f784b251f41eab7e75c13075e980a54 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Fri, 4 Sep 2026 16:46:27 -0700 Subject: Land bitboard move generation (Part A+B) and movesup.c bitboard queries; default on Implements the full board_representation/MOVEGEN_MIGRATION.md scope: bitboard-backed generators for all six not-in-check piece types plus the JumpTable-avoiding whole-node dispatch fork (_GenerateAllMovesBB), the in-check escape path (king flight + block/capture), and movesup.c's ExposesCheck/FasterExposesCheck/ExposesCheckEp/IsAttacked/ InCheck bitboard equivalents. Nine toggles total (GENERATE_{KNIGHT,KING,ROOK,BISHOP,QUEEN,PAWN}_BITBOARD, GENERATE_ESCAPES_{KING,BLOCK}_BITBOARD, EXPOSESCHECK_BITBOARD, ISATTACKED_BITBOARD), all now on by default in GNUmakefile -- DISABLE_BITBOARD_MOVEGEN=1 opts back into the mailbox path, which remains fully present and compiled either way. Correctness verified via perft (Kiwipete, Position 4), the move-set comparison harness across 20,000 random positions, all nine toggles combined cleanly (15/15 runs, after fixing a GenerateRandomLegalPosition en-passant-sentinel bug in the test harness), and sd10 on all three curated suites showing zero solve-count regression vs head_reference (the ecm_hard_quick delta traced to unrelated intervening commits). Speed: most individual generators land near parity by design (mailbox's per-square walk was already close to O(destination count)); the real, consistent wins are the dispatch-layer fork (up to 23% in dense positions) and IsAttackedBB (0.73x-0.93x of mailbox). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01AbHkVrm5KUyzLwWd3GHmo6 --- src/GNUmakefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/GNUmakefile') diff --git a/src/GNUmakefile b/src/GNUmakefile index 601a362..ab35c7e 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -17,6 +17,15 @@ # GETATTACKS_BITBOARD=1: use the bbPieces/bbPawns-backed _GetAttacksBB # instead of the asm/CROUTINES GetAttacks -- see # board_representation/MIGRATION.md section 6 +# DISABLE_BITBOARD_MOVEGEN=1: opt back into the mailbox move +# generator/escapes/ExposesCheck/IsAttacked implementations -- the +# nine GENERATE_*_BITBOARD/EXPOSESCHECK_BITBOARD/ISATTACKED_BITBOARD +# toggles (board_representation/MOVEGEN_MIGRATION.md) are on by +# default as of the 2026-09-04 correctness/no-regression sweep +# (perft, move-set comparison harness, sd10 curated-suite parity, +# match_play.py). The mailbox code is still fully present and +# compiled either way -- this flag only flips which side of each +# macro-swap wins, it doesn't remove anything. # EVERYTHING=1: everything everything everything everything # # $Id$ @@ -103,6 +112,14 @@ ifdef GETATTACKS_BITBOARD PROFILE += -DGETATTACKS_BITBOARD endif +ifndef DISABLE_BITBOARD_MOVEGEN + PROFILE += -DGENERATE_KNIGHT_BITBOARD -DGENERATE_KING_BITBOARD \ + -DGENERATE_ROOK_BITBOARD -DGENERATE_BISHOP_BITBOARD \ + -DGENERATE_QUEEN_BITBOARD -DGENERATE_PAWN_BITBOARD \ + -DGENERATE_ESCAPES_KING_BITBOARD -DGENERATE_ESCAPES_BLOCK_BITBOARD \ + -DEXPOSESCHECK_BITBOARD -DISATTACKED_BITBOARD +endif + ifdef EVERYTHING PROFILE += -DEVAL_DUMP -DEVAL_TIME -DPERF_COUNTERS -DMP -DSMP -DTEST_NULL -DDUMP_TREE -fbounds-checking else -- cgit v1.3