Repository navigation
4PC Teams: king safety, endgame activity, mate threats, pins/X-rays and castling rights - #55
Open
KnightStackSys wants to merge 18 commits into
Open
KnightStackSys wants to merge 18 commits into
KnightStackSys wants to merge 18 commits into
Conversation
…astling rights Introduce phase-tapered king evaluation for Red/Yellow and Blue/Green; oriented shield/wing safety, hostile attack zones and mate-threat pattern penalties, true slider-ray pins and X-rays, and validated castling-right bonuses. Add nine UCI-tunable evaluation parameters and dedicated regression tests.
…red phase Replace per-king per-pawn scans and directional empty-square walks with immutable shield/storm/wing masks and slider lookup rays. Accumulate material phases/armies once per position, reuse occupancy and attack maps; keep all nine tunable king heuristics and their scale.
Benchmark pinned slider pressure, pawn-zone safety, king-zone danger and all king heuristics disabled against the tuned combination. Restore evaluation parameters afterward.
…ay rays Build slider-only team attacks alongside existing mobility maps and intersect candidate screens with these attacks. Avoid expensive directional x-ray probes when no opposing slider actually attacks friendly screening material; preserve all king-evaluation terms and existing tunables.
…uiet moves Keep check move ordering identical using conservative source/destination collinearity tests and one per-node existing-check query. Add SearchFastCheckPrefilter (default on) for A/B testing, strict ordering/metadata regression across real successor states, and same-runner NPS comparison.
Avoid full simulated-check queries for geometrically impossible quiet moves during pruning, preserving pre-existing opponent checks with a cached per-node test. Add fixed-depth score/bestmove equivalence coverage against the original ordering path.
…mark The hot-loop extension brought no measurable NPS improvement (831k vs 834k with it off) and added extra per-node attack checks. Keep the verified PV move-ordering shortcut and all faster king-evaluation features.
Add opt-in -march=native GCC/Clang or MSVC /arch:AVX2 for Release, including header-inline bitboard paths. Keep portable CI defaults and document reproducible same-machine HCE/king feature throughput tests.
…idation Cache full HCE scores for repeated Zobrist positions using private 16K-entry direct-mapped tables, invalidate each new search/variant, expose SearchEvalCache (default 1) and compare on/off with fixed-position same-runner NPS diagnostics.
Inline the unlocked cluster operation and acquire striped mutexes only for concurrent SMP, preserving synchronization. Cache replacement priority inside TT store to avoid repeat scoring.
…ation Exercise cache hits, disabled mode, side-to-move Zobrist keys and stale score avoidance when tuning weights change between searches.
Use 4PC rank/file/diagonal alignment to verify only moves that could uncover an enemy slider attack on a previously safe king; retain full tests for checks, king moves, en passant and castling. Apply in negamax and qsearch, add SearchFastKingLegality A/B option, property-style legality and depth-three score tests, and same-runner NPS diagnostic.
…izations Document A/B UCI switches, correctness boundaries and single-runner diagnostic comparisons, with explicit caution about CI variance and Elo.
Use small thread-local per-color pawn-structure cache to avoid rescanning pawns during HCE. Add SearchPawnAttackCache UCI A/B switch, score-equivalence tests across changing pawn structures and four-player move sequences, and same-runner NPS diagnostics.
Avoid full capture sorting before potential beta cutoffs when tactical lists are long. Keep PV and check-evasion ordering unchanged; add SearchQSearchLazyOrdering A/B switch, QSearch score equivalence tests, and diagnostic throughput comparison.
Full tactical sorting scored 516,048 NPS against lazy picking 512,945 NPS in the fixed fixture; keep verified thread-local pawn-attack cache instead.
…king-alignment masks Before expensive occupancy-dependent king/queen slider probes, reject directions without any geometrically aligned opponent slider. Preserve exact scores with SearchKingRayPrefilter on/off tests and same-runner throughput comparisons.
Test four moving-color perspectives and screened queen X-rays; document A/B UCI options, diagnostic 2.7% pawn cache and 5.5% ray-mask gains, reverted QSearch sorting trial and optional MSVC IPO experiment.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
King evaluation
EvalKing*options; retain all established search/eval weights, with NNUE pathway unchangedValidation
CI Linux GCC and Windows MSVC, existing regression tests and new 4PC feature tests; then tune weights and conduct paired SPRT before merging. This branch is intentionally not merged into main.
Search and HCE performance improvements
givesCheck()prefilters to PV move ordering (PV move ordering), checking discovered checks and pre-existing attacks before skipping a full simulationSearchFastCheckPrefilter(default1,0restores original slow check detection); equivalence regression checks ordered moves, gives-check metadata and depth-3 bestmove/scoreironphoenix_nps_benchwith same-runner diagnostic measurements of each king feature group and fast-check on/offBenchmark interpretation: CI runners vary in CPU, so comparisons across different runs cannot establish a precise gain. The same-runner benchmarks enable more meaningful relative comparisons. Retain/merge based on CI correctness plus independent local throughput and strength SPRT. Changes remain exclusive to this feature branch; main is untouched.
IRONPHOENIX_NATIVE_CPU=ONRelease configuration: GCC/Clang-march=native, MSVC/arch:AVX2(nonportable; default remains OFF). Seedocs/performance.mdfor Windows/Linux build instructions.Further throughput work (latest commits)
SearchEvalCachedefault 1, off at 0, benchmarked on/off.SearchFastKingLegalitydefault 1, off at 0.SearchEvalCache598,037 off vs 612,344 on NPS;SearchFastKingLegality856,053 off vs 861,818 on NPS (different CI runs; individual on/off pairs are same-runner only). Seedocs/performance.md.Do not merge on NPS alone; measure your own Release executable at Threads=1 with long repeated benches, then verify paired Elo.
mainremains unchanged.New HCE performance experiments (October 23)
SearchPawnAttackCache0/1 (default 1), bitboard-exact output, tested on changing pawn structures and legal 4-player positions. On one Linux CI runner: 510,898 NPS disabled vs 524,508 enabled (+2.7%).SearchKingRayPrefilter0/1 (default 1). Precomputed rank/file/diagonal rays skip impossible king pins and queen X-ray probes without changing scores. On one Linux CI runner: 509,880 NPS disabled vs 537,731 enabled (+5.5%). Added four-color and X-ray score-equivalence cases.mainremains untouched.These are independent single-runner diagnostics, not additive gains or guaranteed local throughput; verify Release build median NPS and paired Elo.