Skip to content

Build attack, geometry, PSQT and Zobrist tables at compile time - #73

Merged
nook0110 merged 8 commits into
deploy-elofrom
quality-ctables
Nov 12, 2026
Merged

nook0110 merged 8 commits into
deploy-elofrom
quality-ctables

Conversation

@nook0110

Copy link
Copy Markdown
Owner

Step 1 of the core code-quality audit: constant tables are built at compile time instead of through mutable globals and Init* calls. Search is unchanged: depthbench depth 12 × 30 positions gives 4,405,976 nodes and move hash e874be3a for base and branch; perft, all tests and the clang 23 build pass.

  • Bitboard is fully constexpr and iterable as a range of squares; template contracts use requires instead of runtime asserts.
  • King, knight and pawn attacks, between/ray geometry (bishop and rook variants merged), the PSQT mirror and the Zobrist keys are computed at compile time; the keys come from a constexpr MT19937-64 and are tested bit-identical to std::mt19937_64. The Init* calls in main, tests and tools are gone.
  • Slider attacks keep all 128 magic records and the 88,772-entry layout, but live in compile-time storage instead of a heap singleton, removing one indirection per lookup.
  • Exhaustive tests compare every new table with the old generators.

Build cost: CPU time +1.7%, peak compiler memory 0.5 → 1.1 GiB (constexpr budgets are scoped to Attacks.cpp).

🤖 Generated with Claude Code

nook0110 and others added 8 commits November 11, 2026 18:28
Add forward square iteration and enforce template-only node contracts with constexpr call-site guards. Capture exhaustive reference-table comparisons before replacing startup generators.
Generate immutable leaper, pawn, geometry and mirrored PSQT tables and remove startup initialization calls. Preserve every original Zobrist key with constexpr MT19937-64 and independently verify the original output order against the standard generator.
Preserve the original magic records and shared table layout in immutable static storage. Build and validate every entry during constant evaluation, with evaluator budgets scoped to the attack-table source file.
Integrate deploy-elo b1f1487 while preserving compile-time attack, geometry, PSQT and Zobrist tables. Adapt the new incremental-state checks to the immutable Zobrist keys.

The bench line records the CI hardware reference; both local default bench comparisons searched 1068467 nodes.

Bench: 696698
Bench: 696698

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bench: 696698

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use 32-byte magic descriptors and 64-byte boundaries for the immutable attack tables. Enforce the descriptor size at compile time while preserving the generated values and lookup arithmetic.

Validate search identity and baseline-equivalent CPU throughput with eight alternating pairs in each order. The bench line records the requested CI reference.

Bench: 696698
Bench: 696698

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nook0110
nook0110 merged commit 935d9d7 into deploy-elo Nov 12, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant