MTGBench improvement loop

Overview · Experiment index

Iteration 7: Filter priority activation definitions before cloning

state retained — instruction-count retained; awaiting workstation wall-clock confirmation
switch PHASE_PRIORITY_DEFINITION_PREFILTER_LEGACY · branch loop/it7 · base 4ec0b9ef1 · candidate 069f7c67f · took 17h 55m

Results

Verdict: MARGINAL: 0.87% fewer instructions, between 0.3% and 1%. It is sent to the PC wall-clock check instead of being kept outright. The final word is always the PC wall-clock.
Gate: 1,000 actions (screen) — -0.87% instructions, same-arm spread 0.033%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0-0.87%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy21,785,757,95521,785,156,7154,0005,446,3642,4532,365
optimized21,599,817,65021,592,649,5494,0005,399,0582,5512,523
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.
Verdict: GOOD: 1.14% fewer instructions, above the 1% bar. The final word is always the PC wall-clock.
Gate: 4,000 actions (verdict) — -1.14% instructions, same-arm spread 0.017%, equal work: yes, fingerprints match: yes-1% retain-0.3% kill0-1.14%
ArmRun 1 instructionsRun 2ActionsInstr / actioncontract msapply ms
legacy78,389,451,62678,402,641,58211,4186,866,00518,95912,387
optimized77,502,589,53377,508,919,55011,4186,788,03218,86012,945
Instruction counts are deterministic and machine-specific (aarch64 homelab). contract and apply ms are wall time under perf: indicative only, not a clean timing.
Gate: parity (7 seeds, decks rotate per seed)
coverage: 253 distinct cards cast, 35 action kinds, 41 decision kinds, 59 event kinds, max battlefield 35, max stack 5
coverage: 143 of 257 engine counters were nonzero somewhere (unioned over 7 seeds; decks rotate per seed)
parity: 1 matched, 6 matched with an engine rejection in both arms, 0 diverged, 0 arm failures; summary /data/mtgbench/edh-play/bench/reports/it7-parity-20261001-133127-parity.json
9 games ended early on an engine rejection (counted over both arms). A rejection that happens identically in both arms is a match, but those games never reach their late game, so late-game behaviour of those decks is not exercised.

Where the time went

planner: 8 minexecutor: 101 minreviewer: 1 mingate fmt: 0 mingate ir1k: 0 mingate ir4k: 2 mingate check: 34 mingate focused: 62 mingate build: 26 mingate parity: 6 minnot attributed: 830 min
planner 8mexecutor 101mreviewer 1mgate fmt 0mgate ir1k 0mgate ir4k 2mgate check 34mgate focused 62mgate build 26mgate parity 6mnot attributed 830m
executor: 15,683,398 in / 28,280 out tokensplanner: 1,707,983 in / 8,796 out tokensreviewer: 23,694 in / 1,248 out tokens

Mechanism. casting.rs:502–555 clones and resolves every printed ability before candidates.rs:4238–4400 discards non-activated, wrong-zone and mana abilities. Add a priority-specific enumerator that applies these predicates to borrowed definitions before cloning and resolving survivors. Preserve runtime-grant generation and original ability indices.

Evidence. xn5.67, docs/stage0-decision-memo.md:4904: ability::impl$1662::clone owns 3.6% of process CPU in bench/reports/uprof-xn565-20260923-owners-all.txt, including 1.3% allocator CPU in owners-alloc.txt. This bounds the clone family, not the fraction attributable to discarded priority definitions. The profile predates xn5.71 and xn5.77; these shares are historical ceilings.

Counter and kill threshold. Existing xn5.67 ability-clone owner rows: 3.6% total CPU, including 1.3% allocator CPU; nested, not additive. Expected instruction reduction: 0.5–1.2% per action at 4,000 actions, an unmeasured hypothesis. Copy and allocation savings may register only in the marginal band.

Invariant. The ordered activation domain, ability indices, payment verdicts and all three fingerprints remain identical. Cost resolution changes mana amounts without changing kind, activation zone or library-movement classification. Enumerate runtime grants before filtering so discarded definitions cannot renumber later grants. Retained candidates still use the existing legality and payment authorities.

Agent steps

RoleHarness / modelTimeExitTokens in / outNote
plannercodex / gpt-6.1-sol8m 0s01,707,983 / 8,796
executorcodex / gpt-6-luna1h 41m015,683,398 / 28,280
reviewercodex / gpt-6.1-sol1m 0s023,694 / 1,248

Gates

GateResultExitDetail
fmtpass0cargo fmt --all -- --check
ir1kpass0Ir -0.87% within +/-1%, same-arm spread 0.0332% | optimized 21,596,233,600 vs legacy 21,785,457,335 instructions; fingerprints match: True
ir4kpass0Ir -1.14% (threshold -1%), same-arm spread 0.0168% | optimized 77,505,754,542 vs legacy 78,396,046,604 instructions; fingerprints match: True
checkpass0
focusedpass0
buildpass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it7-build
paritypass0pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,13 -Actions 1000 -CargoProfile bench-fast-inc -Label it7-parity

Write-up: 2026-09-30 - Loop iteration 7: Filter priority activation definitions before cloning (rejected)

Status: rejected (loop, instruction-count gate; wall-clock not yet confirmed)

Automated loop result on homelab (aarch64). Switch PHASE_PRIORITY_DEFINITION_PREFILTER_LEGACY, mechanism class copy. Mechanism: casting.rs:502–555 clones and resolves every printed ability before candidates.rs:4238–4400 discards non-activated, wrong-zone and mana abilities. Add a priority-specific enumerator that applies these predicates to borrowed definitions before cloning and resolving survivors. Preserve runtime-grant generation and original ability indices. Invariant: The ordered activation domain, ability indices, payment verdicts and all three fingerprints remain identical. Cost resolution changes mana amounts without changing kind, activation zone or library-movement classification. Enumerate runtime grants before filtering so discarded definitions cannot renumber later grants. Retained candidates still use the existing legality and payment authorities.

gatepasseddetail
fmtyescargo fmt --all -- --check
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
ir1kyesIr -0.87% within +/-1%, same-arm spread 0.0332%
ir4kyesIr -1.14% (threshold -1%), same-arm spread 0.0168%
checkyes
focusedyes
parityNOpwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1

Wall-clock confirmation on the workstation is required before this counts as a speedup; instruction count is a screen, not a time prediction.

Write-up: 2026-10-01 - Loop iteration 7: Filter priority activation definitions before cloning (rejected)

Status: rejected (loop, instruction-count gate; wall-clock not yet confirmed)

Automated loop result on homelab (aarch64). Switch PHASE_PRIORITY_DEFINITION_PREFILTER_LEGACY, mechanism class copy. Mechanism: casting.rs:502–555 clones and resolves every printed ability before candidates.rs:4238–4400 discards non-activated, wrong-zone and mana abilities. Add a priority-specific enumerator that applies these predicates to borrowed definitions before cloning and resolving survivors. Preserve runtime-grant generation and original ability indices. Invariant: The ordered activation domain, ability indices, payment verdicts and all three fingerprints remain identical. Cost resolution changes mana amounts without changing kind, activation zone or library-movement classification. Enumerate runtime grants before filtering so discarded definitions cannot renumber later grants. Retained candidates still use the existing legality and payment authorities.

gatepasseddetail
fmtyescargo fmt --all -- --check
ir1kyesIr -0.87% within +/-1%, same-arm spread 0.0332%
ir4kyesIr -1.14% (threshold -1%), same-arm spread 0.0168%
checkyes
focusedyes
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
parityinfrapwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1
parityinfrapwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1
parityinfrapwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1
parityinfrapwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1
parityNOpwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1

Wall-clock confirmation on the workstation is required before this counts as a speedup; instruction count is a screen, not a time prediction.

Write-up: 2026-10-01 - Loop iteration 7: Filter priority activation definitions before cloning (retained)

Status: unknown (loop, instruction-count gate; wall-clock not yet confirmed)

Automated loop result on homelab (aarch64). Switch PHASE_PRIORITY_DEFINITION_PREFILTER_LEGACY, mechanism class copy. Mechanism: casting.rs:502–555 clones and resolves every printed ability before candidates.rs:4238–4400 discards non-activated, wrong-zone and mana abilities. Add a priority-specific enumerator that applies these predicates to borrowed definitions before cloning and resolving survivors. Preserve runtime-grant generation and original ability indices. Invariant: The ordered activation domain, ability indices, payment verdicts and all three fingerprints remain identical. Cost resolution changes mana amounts without changing kind, activation zone or library-movement classification. Enumerate runtime grants before filtering so discarded definitions cannot renumber later grants. Retained candidates still use the existing legality and payment authorities.

gatepasseddetail
fmtyescargo fmt --all -- --check
ir1kyesIr -0.87% within +/-1%, same-arm spread 0.0332%
ir4kyesIr -1.14% (threshold -1%), same-arm spread 0.0168%
checkyes
focusedyes
buildyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa
parityyespwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,1

Wall-clock confirmation on the workstation is required before this counts as a speedup; instruction count is a screen, not a time prediction.

generated 2026-11-28 18:17:07 · read-only · refreshes every 30 s