PHASE_LITERAL_MANA_CONTEXT_LEGACY · branch loop/it38 · base 4ec0b9ef1 · candidate 2c8e426d5 · took 2h 11m| Arm | Run 1 instructions | Run 2 | Actions | Instr / action | contract ms | apply ms |
|---|---|---|---|---|---|---|
| legacy | 21,554,883,633 | 21,555,060,291 | 4,000 | 5,388,743 | 2,488 | 2,379 |
| optimized | 21,504,306,247 | 21,509,140,657 | 4,000 | 5,376,681 | 2,374 | 2,287 |
perf: indicative only, not a clean timing.| Hardware counters (optimized / legacy) | Value | Reading |
|---|---|---|
| cycles, minimum of the repeats | -2.25% — cycles-neutral (same-arm spread 4.32%) | same within noise |
| IPC (instructions per cycle, higher is better) | 1.011 / 0.987 | same |
| backend stall / frontend stall (share of cycles) | 17.3% / 17.7% · 43.8% / 44.2% | same |
| L1D / L2D refills per 1k instructions (cache misses) | 12.95 / 13.02 · 11.26 / 11.55 | same |
| branch mispredicts per 1k instructions | 5.819 / 5.811 | same |
| Arm | Run 1 instructions | Run 2 | Actions | Instr / action | contract ms | apply ms |
|---|---|---|---|---|---|---|
| legacy | 77,476,846,163 | 77,474,047,159 | 11,418 | 6,785,378 | 18,998 | 12,563 |
| optimized | 77,199,778,359 | 77,203,214,869 | 11,418 | 6,761,385 | 19,552 | 12,370 |
perf: indicative only, not a clean timing.| Hardware counters (optimized / legacy) | Value | Reading |
|---|---|---|
| cycles, minimum of the repeats | +1.33% — cycles-neutral (same-arm spread 2.67%) | same within noise |
| IPC (instructions per cycle, higher is better) | 0.890 / 0.909 | same |
| backend stall / frontend stall (share of cycles) | 21.0% / 21.2% · 44.2% / 43.6% | same |
| L1D / L2D refills per 1k instructions (cache misses) | 17.48 / 17.52 · 13.83 / 13.66 | same |
| branch mispredicts per 1k instructions | 5.165 / 4.834 | more |
Mechanism. In mana_sources.rs:emit_source_rows, literal production currently builds a complete ResolvedAbility just to determine its output. In mana_abilities.rs:produce_mana_from_ability, every recipient gets a cloned and recursively rebound ability chain. Add a shared context-free production path for Fixed, Mixed, and Colorless with QuantityExpr::Fixed. Use the existing production resolver without an ability context for these exact shapes; retain the full context path for every other shape.
Evidence. xn5.67, docs/stage0-decision-memo.md:L4904, reports auto_tap_mana_sources_inner at 18.1% inclusive CPU and continue_mana_ability_cost_payment_in_node at 16.7%. Its owners-alloc report attributes 1.3% CPU to ability::impl$1662::clone. These are overlapping family ceilings, not an isolated measurement of the proposed copies. The profile predates subsequent loop changes; the removable literal-output subset remains unmeasured.
Counter and kill threshold. Existing xn5.67 mana-execution and ability-clone profile rows bound the containing work. Expected instruction reduction: 0.6–1.3% per action at 4,000 actions, a hypothesis rather than a measured result. Copy savings may land in the marginal band. Apply the loop's unchanged tiers: >=1% retained pending wall-clock; 0.3–1% marginal; <0.3%, regression, or fingerprint mismatch dropped.
Invariant. For the allowlisted production shapes, output depends only on literal descriptor fields; controller, targets, scoped player, chosen X, and cost-paid snapshots cannot affect it. Preserve mana sequence, atomic combinations, overrides, restrictions, events, replacement processing, and sub-chain execution. Permanent differential tests must compare both paths with hostile ability contexts and prove dynamic/X/cost-paid production takes the legacy context path.
| Role | Harness / model | Time | Exit | Tokens in / out | Note |
|---|---|---|---|---|---|
| planner | codex / gpt-6.1-sol | 11m 18s | 0 | 4,583,241 / 14,271 | |
| executor | codex / gpt-6-luna | 40m 21s | 0 | 8,173,426 / 15,036 | |
| reviewer | codex / gpt-6.1-sol | 0m 50s | 0 | 21,149 / 1,144 | |
| executor | codex / gpt-6-luna | 35m 32s | 0 | 6,372,108 / 17,009 | |
| reviewer | codex / gpt-6.1-sol | 0m 50s | 0 | 23,612 / 1,038 |
| Gate | Result | Exit | Detail |
|---|---|---|---|
| fmt | pass | 0 | cargo fmt --all -- --check |
| build | pass | 0 | pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fast-inc -Label it38-build |
| ir1k | pass | 0 | Ir -0.24% within +/-1%, same-arm spread 0.0329% | optimized 21,505,170,129 vs legacy 21,557,067,295 instructions; fingerprints match: True |
| ir4k | FAIL | 0 | Ir -0.36% within +/-1%, same-arm spread 0.0275% | optimized 77,202,383,084 vs legacy 77,482,079,795 instructions; fingerprints match: True |
| check | pass | 0 | |
| focused | pass | 0 | |
| parity | pass | 0 | pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode parity -Seeds 1,2,3,5,7,11,13 -Actions 1000 -CargoProfile bench-fast-inc -Label it38-parity |
Status: unknown (loop, instruction-count gate; wall-clock not yet confirmed)
Automated loop result on homelab (aarch64). Switch PHASE_LITERAL_MANA_CONTEXT_LEGACY, mechanism class copy. Mechanism: In mana_sources.rs:emit_source_rows, literal production currently builds a complete ResolvedAbility just to determine its output. In mana_abilities.rs:produce_mana_from_ability, every recipient gets a cloned and recursively rebound ability chain. Add a shared context-free production path for Fixed, Mixed, and Colorless with QuantityExpr::Fixed. Use the existing production resolver without an ability context for these exact shapes; retain the full context path for every other shape. Invariant: For the allowlisted production shapes, output depends only on literal descriptor fields; controller, targets, scoped player, chosen X, and cost-paid snapshots cannot affect it. Preserve mana sequence, atomic combinations, overrides, restrictions, events, replacement processing, and sub-chain execution. Permanent differential tests must compare both paths with hostile ability contexts and prove dynamic/X/cost-paid production takes the legacy context path.
| gate | passed | detail |
|---|---|---|
| fmt | yes | cargo fmt --all -- --check |
| build | yes | pwsh -NoProfile -File scripts/bench_phase.ps1 -Mode build -CargoProfile bench-fa |
| ir1k | yes | Ir -0.24% within +/-1%, same-arm spread 0.0329% |
| ir4k | marginal: workstation check | Ir -0.36% within +/-1%, same-arm spread 0.0275% |
| check | yes | |
| focused | yes | |
| parity | yes | pwsh -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:14 · read-only · refreshes every 30 s