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/testsee.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/testsee.c') diff --git a/src/testsee.c b/src/testsee.c index 77fd706..2106494 100644 --- a/src/testsee.c +++ b/src/testsee.c @@ -26,6 +26,19 @@ Revision History: #include "chess.h" +// This harness's job is to validate _GetAttacksBB against a fixed +// baseline (the real asm/CROUTINES implementation), not to compare +// the engine's own current GetAttacks macro target against itself -- +// but chess.h's GETATTACKS_BITBOARD toggle (board_representation/ +// MIGRATION.md section 6) can make that macro resolve to +// _GetAttacksBB. Undefine it here so every "GetAttacks(...)" call +// below always reaches the real asm/CROUTINES function (still +// declared under that name in chess.h, just no longer macro-routed), +// regardless of which implementation is live in production. +#ifdef GetAttacks +#undef GetAttacks +#endif + #ifdef TEST_BROKEN ULONG g_uRootOnMove; -- cgit v1.3