diff --git a/docs/matching-cookbook.md b/docs/matching-cookbook.md index 710839f3c8..1d1cd2116f 100644 --- a/docs/matching-cookbook.md +++ b/docs/matching-cookbook.md @@ -37235,3 +37235,21 @@ in the next branch's slot; (2) exactly one non-void call in the function. Dial: functions return pointers/ints even when the TU declares them `void`), or a value-returning call whose result is discarded. Map corollary (sched.md): `birthing_insn_p` counts hard-reg sets; the number of value-returning calls in a function is a scheduling input. + +**§501-E — A REGISTER PIN FORBIDS THAT REGISTER TO EVERY RETRIED ALLOCNO: `regs_ever_live` seeds reload's `bad_spill_regs`, so a +`register … __asm__("$6")` on one variable can be the reason another value cannot take `$a2` (P32 T4b, `main:func_80020DA4`, +the `mflo $t0` vs `$a2` REGALLOC-PERM wall banked by a Fable agent — 100/100).** Read in the dumps and the source: the products of +`mult` are GLOBAL allocnos (`mulsi3_internal` constraint `=l`, mips.md:848; `-dl` shows "pref LO_REG", none in local-alloc's +list). `global.c` parks m3/m8/m13 in LO; reload spills LO ("Spilling reg 65") and retries them through `retry_global_alloc` +(reload1.c:3497) with `losers = forbidden_regs`, and `forbidden_regs` is seeded from `bad_spill_regs = regs_explicitly_used = +regs_ever_live` at reload entry (reload1.c:486, 3651–3660, 709). The S76 pin `register s32 e0 __asm__("$6")` made `$a2` +ever-live → forbidden at m13's retry → first-fit gave `$t0`. **Fix: unpin, and reproduce the target's LOCAL allocation with two +zero-byte launders steering `qty_compare` (local-alloc.c:1579):** `__asm__("" : "=r"(e1) : "0"(e1))` immediately before +`dst[6] = -e1` (e1's quantity 6666 → 8750, allocated before e0's 7894, holds `$v1`, so e0's first fit drops to `$a2`; placed after +e1's LOAD instead it lands inside lo1's range and flips a 2500 tie → 15), plus `__asm__("" : "=r"(p1) : "0"(p1))` between p1's +`andi` and `sll` to undo the global-allocno tie the first launder created (the `$t6/$t7/$t8` rotation). Ladder: 2 (pinned) → 37 +(unpinned) → 15 → 6 → MATCH; laundering `addr1` after its `addu` is a byte-identical alternate; a launder on the SOURCE of the +copy emits a `move` (101 ins) — launder the destination variable. **Law:** when a pinned draft sits at a 1–2-row register +permutation that every pin-set fails to move, the pin may be the wall: pins forbid their register to every retried allocno. +Remove the pin, read `-dl` for the local quantities' priorities, and steer with launders (birth/death dials) instead. Corollary +for the map (regalloc.md): `retry_global_alloc` + `bad_spill_regs`; `qty_compare` = `floor_log2(n_refs)·n_refs·size/(death−birth)`. diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index 0df0048bad..99cf39bd12 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -99,7 +99,7 @@ Scale estimate: 3–5 sessions. `func_80011380` → `.run/m3/opus/func_80011380.c`; `func_801834A4` → `.run/S71_gate14/ov_SC03_105*/`), `exclude_audit --write`, `backlog.py render`; a T3 idiom naming a wall's mechanism re-opens that row (bounded: one attempt, permuter first). Wall table into this file; cookbook §496+; decision log; accelerators. -- [ ] **T4b — crack and bank the final 15 (ADDED 2026-09-05 by Drew's directive, supersedes the kill gate: "anything that isn't the original hand-written asm or the PsyQ libs needs to be cracked and banked before we finish"; "before you spawn Fable agents, hand crack each and figure out the blocker to fix it")** (xHigh→Max recommended; Fable agents authorised AFTER the hand pass): for each of the 15 rows (8 NEAR + 7 walls) the coordinator hand-cracks — read the diff + the recorded mechanism, read the compiler (dumps + source), find the lever the record did not try, measure, bank through the verified chain (rtu in the real TU → bank.sh / gate_main) — and only then hands the leftovers to one Fable agent each (brief `.run/P32/t5x/BRIEF.md`). Plumbing landed first: `src/800_c.c` decl/extern edits byte-neutral (this commit). Work dirs `.run/P32/t4b//`. **Hand pass DONE 2026-09-05 (S83): all 15 rows read against their diffs and the compiler; 22 spellings measured (all regressions), 0 banks; every row's blocker refined to a named mechanism with the untried lever written in `.run/P32/t4b//NOTES.md` (func_80032A74: the transient caller-save area — reload1.c order proven; func_8017DF28: the block-move pseudo reuse vs reorg's branch-target hoist; func_80011380: the target's assignment shape; func_801834A4: sign-hoist vs const-hoist thresholds; …). TU plumbing for func_80039DEC/func_800391D4 committed byte-neutral (`commit:3953`). 15 Fable agents launched ~13:05 MDT (two usage-limit outages, resumed each time via SendMessage). **T4b (1): `main:func_800391D4` BANKED 143dbb89 (`commit:3956`) — a pinned wall: explicit promotion + insn_count pads 7→9 (§501); pin dropped. **T4b (2): `main:func_80039DEC` BANKED 143dbb89 (`commit:3959`) — a pinned wall: the natural switch with duplicated tails, so a2's raw copy keeps 4 refs and wins $a3 (§501-B); pins 7 → 5. **T4b (3): `md_MAIN_009:func_800CD674` BANKED d270f695 (`commit:3964`) — the $a3↔$t1 plateau: a 2-death pseudo is excluded from local_alloc; a fresh single-death pseudo for prim 4 + a zero-byte asm set on prim 3's copy against sched1's birthing boost (§501-C). **T4b (4): `ov_SC06_022:func_8017DF28` BANKED 2a7d7d4e (`commit:3966`) — a pinned wall: one value-returning call made the call a sched1 "birthing" insn (reg_n_sets[$v0]==1); a second $v0 set via RotMatrixY's real pointer-returning type (§501-D); pins 5 → 4.** Remaining 11 in flight.** +- [ ] **T4b — crack and bank the final 15 (ADDED 2026-09-05 by Drew's directive, supersedes the kill gate: "anything that isn't the original hand-written asm or the PsyQ libs needs to be cracked and banked before we finish"; "before you spawn Fable agents, hand crack each and figure out the blocker to fix it")** (xHigh→Max recommended; Fable agents authorised AFTER the hand pass): for each of the 15 rows (8 NEAR + 7 walls) the coordinator hand-cracks — read the diff + the recorded mechanism, read the compiler (dumps + source), find the lever the record did not try, measure, bank through the verified chain (rtu in the real TU → bank.sh / gate_main) — and only then hands the leftovers to one Fable agent each (brief `.run/P32/t5x/BRIEF.md`). Plumbing landed first: `src/800_c.c` decl/extern edits byte-neutral (this commit). Work dirs `.run/P32/t4b//`. **Hand pass DONE 2026-09-05 (S83): all 15 rows read against their diffs and the compiler; 22 spellings measured (all regressions), 0 banks; every row's blocker refined to a named mechanism with the untried lever written in `.run/P32/t4b//NOTES.md` (func_80032A74: the transient caller-save area — reload1.c order proven; func_8017DF28: the block-move pseudo reuse vs reorg's branch-target hoist; func_80011380: the target's assignment shape; func_801834A4: sign-hoist vs const-hoist thresholds; …). TU plumbing for func_80039DEC/func_800391D4 committed byte-neutral (`commit:3953`). 15 Fable agents launched ~13:05 MDT (two usage-limit outages, resumed each time via SendMessage). **T4b (1): `main:func_800391D4` BANKED 143dbb89 (`commit:3956`) — a pinned wall: explicit promotion + insn_count pads 7→9 (§501); pin dropped. **T4b (2): `main:func_80039DEC` BANKED 143dbb89 (`commit:3959`) — a pinned wall: the natural switch with duplicated tails, so a2's raw copy keeps 4 refs and wins $a3 (§501-B); pins 7 → 5. **T4b (3): `md_MAIN_009:func_800CD674` BANKED d270f695 (`commit:3964`) — the $a3↔$t1 plateau: a 2-death pseudo is excluded from local_alloc; a fresh single-death pseudo for prim 4 + a zero-byte asm set on prim 3's copy against sched1's birthing boost (§501-C). **T4b (4): `ov_SC06_022:func_8017DF28` BANKED 2a7d7d4e (`commit:3966`) — a pinned wall: one value-returning call made the call a sched1 "birthing" insn (reg_n_sets[$v0]==1); a second $v0 set via RotMatrixY's real pointer-returning type (§501-D); pins 5 → 4. **T4b (5): `main:func_80020DA4` BANKED 143dbb89 (`commit:3969`) — a pinned wall: the $6 pin forbade $a2 at reload's retry (regs_ever_live → bad_spill_regs); unpinned + two zero-byte launders (§501-E); pins 4 → 3; main 3 open.** Agents resumed 3 at a time (Drew) from `.run/P32/t5x/resume_queue.txt`; 10 rows remain (3 running).** - [ ] **T5 — PhaseEnd** (Max, Tier 1 — prompt R27): P7 checkbox walk; milestone demo (R22 fleet N/N, tools-health, `verbatim_check --strict`, final census, wall ledger, parked-5 dispositions via `make audit-disc`, `make report` all three metrics + main `143dbb89…` with/without SDK dirs, corrected denominators); **WAIT