From 1f638f87d8afb0334bf05dda10dc13b4c7a60b62 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Fri, 4 Sep 2026 09:37:45 -0700 Subject: Add GETATTACKS_BITBOARD toggle, wiring _GetAttacksBB into real search Board-representation migration section 6: a GNUmakefile build flag (-DGETATTACKS_BITBOARD) makes chess.h's GetAttacks macro resolve to _GetAttacksBB instead of the real asm implementation (or SlowGetAttacks under CROUTINES) -- a three-way choice at the same spot the existing CROUTINES switch already lived. _GetAttacksBB is now reachable from every real call site (generate.c's check-detection call, see.c's SEE(), searchsup.c), not just the test/bench harness. Found and fixed while verifying this: testsee.c's TestGetAttacks and its benchmark call the identifier GetAttacks meaning "the real asm/CROUTINES baseline" -- once the macro could resolve to _GetAttacksBB, those calls would silently compare the new implementation against itself, turning both the correctness sweep and the benchmark into false-positive no-ops. Fixed with a local #undef GetAttacks right after #include "chess.h" in testsee.c, so the harness always validates against the true baseline regardless of which implementation is live in production. Verified: gmake TEST=1 GETATTACKS_BITBOARD=1 passes (self-test suite, corrected benchmark still reporting real asm vs. _GetAttacksBB correctly, and a real Search() call exercising _GetAttacksBB live). precommit_check.sh GETATTACKS_BITBOARD=1 clean for both the TEST=1 self-test and DEBUG=1 smoke test. Default (no flag) build confirmed unaffected -- GetAttacks still resolves to the real asm function. See board_representation/MIGRATION.md section 6 for the full writeup. Sections 4/5/7's remaining items (curated-suite sd10 comparison, match_play.py gate) are now unblocked but not yet run. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Jntky4yGUTyQVaGCXms4F2 --- src/GNUmakefile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/GNUmakefile') diff --git a/src/GNUmakefile b/src/GNUmakefile index 289f8bd..601a362 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -14,6 +14,9 @@ # USE_READLINE=1: link against the GNU readline library # SIXTYFOUR=1: make an X64 binary # CROUTINES=1: use the C versions of the asm routines [slower] +# GETATTACKS_BITBOARD=1: use the bbPieces/bbPawns-backed _GetAttacksBB +# instead of the asm/CROUTINES GetAttacks -- see +# board_representation/MIGRATION.md section 6 # EVERYTHING=1: everything everything everything everything # # $Id$ @@ -96,6 +99,10 @@ ifdef CROUTINES PROFILE += -DCROUTINES endif +ifdef GETATTACKS_BITBOARD + PROFILE += -DGETATTACKS_BITBOARD +endif + ifdef EVERYTHING PROFILE += -DEVAL_DUMP -DEVAL_TIME -DPERF_COUNTERS -DMP -DSMP -DTEST_NULL -DDUMP_TREE -fbounds-checking else -- cgit v1.3