summaryrefslogtreecommitdiff
path: root/src/board_representation/MIGRATION.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/board_representation/MIGRATION.md')
-rw-r--r--src/board_representation/MIGRATION.md66
1 files changed, 50 insertions, 16 deletions
diff --git a/src/board_representation/MIGRATION.md b/src/board_representation/MIGRATION.md
index f8bccb1..57ca7f9 100644
--- a/src/board_representation/MIGRATION.md
+++ b/src/board_representation/MIGRATION.md
@@ -14,10 +14,14 @@ references accordingly; where useful, dropped content is preserved
inline as a note rather than deleted, so a future session designing
the separate migration doesn't have to rediscover it from git history.
-**Status: sections 1-2 (`bbPieces`) and section 3 (`bbPieces`/`bbPawns`-backed
-`_WhoAttacksSquareBB`/`_GetAttacksBB`, not yet wired into the
-`GetAttacks` macro) implemented, verified, and committed. Sections 4
-(partially done, folded into section 3's own testing)-8 not started.**
+**Status: sections 1-3 (`bbPieces`/`bbPawns`-backed
+`_WhoAttacksSquareBB`/`_GetAttacksBB`) and section 6 (the
+`GETATTACKS_BITBOARD` toggle, `_GetAttacksBB` now reachable from real
+search when enabled) implemented, verified, and committed. Section 4
+items 1-3 done (folded into sections 3/6's own testing); items 4-5 and
+sections 5's second half/7 -- the whole-engine curated-suite and
+`match_play.py` gates -- not started, now genuinely unblocked since
+section 6 exists. Section 8 not started.**
See the per-section status notes below for specifics.
Context: a prior pass of this session added occupancy-bitboard-driven
@@ -444,10 +448,10 @@ sequence.
above -- also fixed a latent `bbPieces`/`bbPawns` maintenance gap in
`GenerateRandomLegalPosition` found while running this.
3. **`precommit_check.sh`** as always, for the crash/assert layer.
- **DONE** for `_GetAttacksBB`'s current (not-yet-wired-in) state --
- clean. Should be re-run once section 6's toggle actually flips
- `GetAttacks` to the bitboard implementation, since nothing has
- exercised that live yet.
+ **DONE**, both without and with section 6's toggle
+ (`GETATTACKS_BITBOARD=1`) -- clean in both configurations, the
+ latter run confirming `_GetAttacksBB` live end-to-end in real
+ search, not just the isolated harness.
4. **SEE-value diffing at the position level**: since `SEE()` returns a
single integer per move (not a board eval), the equivalent of the
Eval work's "150-position score-identity diff" is a diagnostic
@@ -503,16 +507,46 @@ visible in isolation. Two tiers, both required before wiring in:
to production wiring again. Not started -- requires section 6's
toggle to exist first.
-## 6. Dual-support / toggle strategy
+## 6. Dual-support / toggle strategy -- DONE
Same `#define` pattern already established for the Eval occupancy work
-(`ROOK_OCCUPANCY_EVAL` et al.): `GETATTACKS_BITBOARD`, flipping which
-implementation `chess.h`'s `GetAttacks` macro/prototype resolves to
-(alongside the existing `CROUTINES` old/new(asm) switch -- this becomes a
-three-way choice: `SlowGetAttacks` (C mailbox), asm `GetAttacks` (x86/x64
-mailbox), `_GetAttacksBB` (new)). Not started -- `_GetAttacksBB` is
-still a side-by-side PoC, called only from the test/bench harness, not
-reachable from the `GetAttacks` macro yet.
+(`ROOK_OCCUPANCY_EVAL` et al.): `GETATTACKS_BITBOARD` (`GNUmakefile`
+build flag, `-DGETATTACKS_BITBOARD`), flipping which implementation
+`chess.h`'s `GetAttacks` macro resolves to -- a three-way choice
+alongside the existing `CROUTINES` switch: `_GetAttacksBB` (new,
+bitboard) if `GETATTACKS_BITBOARD` is defined, else `SlowGetAttacks`
+(C mailbox) if `CROUTINES` is defined, else the real asm `GetAttacks`
+(x86/x64 mailbox, the default). `_GetAttacksBB` is now reachable from
+every real `GetAttacks` call site (`generate.c`'s check-detection
+call, `see.c`'s `SEE()`, `searchsup.c`) when the flag is set, not just
+the test/bench harness.
+
+**Found and fixed while wiring this up**: `testsee.c`'s own
+`TestGetAttacks`/benchmark code calls the identifier `GetAttacks` to
+mean "the real asm/CROUTINES baseline" -- but once the macro can
+resolve to `_GetAttacksBB`, those same calls would silently become
+`_GetAttacksBB` compared against itself, turning the correctness sweep
+and the "asm vs. new" benchmark into false-positive no-ops. Fixed with
+a local `#undef GetAttacks` right after `#include "chess.h"` in
+`testsee.c`, so the harness always reaches the true baseline
+implementation regardless of which implementation is live in
+production -- the harness's job is validating the new implementation
+against a fixed reference, not testing the engine's current
+configuration against itself.
+
+**Verified with the toggle live**: `gmake TEST=1 GETATTACKS_BITBOARD=1`
+-- self-test suite passes (including the corrected benchmark, still
+reporting real asm vs. `_GetAttacksBB` correctly, same ~0.52-0.92x
+numbers as section 3), and a real `Search()` call in the self-test
+suite completed normally with `_GetAttacksBB` live in `SEE()`/move
+generation's check-detection path, not just the isolated harness.
+`precommit_check.sh GETATTACKS_BITBOARD=1` (env-var propagation into
+`gmake` verified directly by grepping the resulting build logs for
+`-DGETATTACKS_BITBOARD`) -- both the `TEST=1` self-test and `DEBUG=1`
+smoke test (10 random ECM positions, `sd 4`) pass clean with the
+bitboard implementation live end-to-end. Default build (no flag)
+confirmed unaffected -- `GetAttacks` still resolves to the real asm
+function unless the flag is explicitly passed.
`bbPieces`/`bbPawns` maintenance itself is **always on** regardless of
this toggle -- it's cheap enough that gating it adds complexity for no