docs(cookbook): §307 — the brute-force-statement-orders lever has a BYTE-EVIDENCED BOUND (12/12 permutations byte-identical on func_8001BC6C, corroborated on func_80021284); a fan-out copy's priority is rank_for_schedule-internal, unreachable from source order — recognise the all-same-closeness tell and route to the permuter. Plus t5_distill_args --novel-only (P31 S63 T5.5)

This commit is contained in:
Drew T
2026-08-26 21:33:45 -06:00
parent b1a0d49a52
commit 926fc3f1c0
3 changed files with 66 additions and 5 deletions
+7 -3
View File
@@ -2,7 +2,7 @@
> **Generated by `tools/cookbook_index.py` — do not hand-edit** (R33). Regenerate after adding a cookbook section.
>
> `docs/matching-cookbook.md` is ~716 KB / 913 sections. Grepping it blind is how three P30 wave-1 agents each "discovered" an idiom that was already written down. **Start here, then read the section.** A section appears under every symptom it addresses.
> `docs/matching-cookbook.md` is ~716 KB / 914 sections. Grepping it blind is how three P30 wave-1 agents each "discovered" an idiom that was already written down. **Start here, then read the section.** A section appears under every symptom it addresses.
**How to use:** name what you SEE in the diff (a stolen delay slot, an extra `la`, a swapped register pair, a `conflicting types` error), find that symptom below, read those sections first. If nothing fits, THEN grind — and add a section when you win.
@@ -85,7 +85,7 @@
- **ADDENDUM** — to §253 — SECOND byte-proven card (upgrade from single-observation), and the placement face: postfix-in-condition parks the RMW store in the branch delay slot <sub>L29251</sub>
- **§306** — A HAZARD `nop` IN FRONT OF A DIV-RESULT STORE IS A STATEMENT-ORDER DEFECT: THE INDEPENDENT TRAILING STATEMENT MUST BE WRITTEN *BEFORE* THE DIVISION-CONSUMING ONE (P31 S62 T4; byte-proven func_8017E7D0) <sub>L29789</sub>
### instruction scheduling (57)
### instruction scheduling (58)
- **§3-T2** — Source statement order drives instruction scheduling <sub>L78</sub>
- **§3** — When a diff is pure scheduling → decomp-permuter (harness built, Phase 6) <sub>L107</sub>
@@ -144,6 +144,7 @@
- **§284** — COMBINE CAN REASSOCIATE TWO SEQUENTIAL BITWISE-AND MASKS INTO ONE AGAINST THE PRE-MASK VALUE; AN ASM IN/OUT FENCE RIGHT AFTER THE FIRST MASK BLOCKS IT (P31, wave dd, `func_8018087C`, ov_SC04_020, byte-proven) (P31 S60; waves #, byte-proven) <sub>L28989</sub>
- **§298** — THE SHARED-TAIL POSITION DIAGNOSTIC: A FOLDED TAIL *BETWEEN* SWITCH ARMS MEANS PER-ARM DUPLICATED STATEMENTS, NOT A HOISTED POST-SWITCH STATEMENT (P31 S61; waves g0e/g0f, `func_80181B68`, ov_SC06_016, byte-proven 68/68) <sub>L29457</sub>
- **§299** — TWO INDEPENDENT EXTRACTION CHAINS EMIT CONTIGUOUSLY INSIDE ONE EXPRESSION; ONLY A STATEMENT BOUNDARY MAKES THE SCHEDULER INTERLEAVE THEM (P31 S61; wave m0a, `func_8003A404`, main, byte-proven 8/8) <sub>L29482</sub>
- **§307** — THE BRUTE-FORCE-THE-STATEMENT-ORDERS LEVER HAS A BOUND: A FAN-OUT COPY'S PRIORITY IS SCHEDULER-INTERNAL, AND NO SOURCE ORDER REACHES IT (P31 S63; byte-evidenced NEGATIVE result, main wave) <sub>L29854</sub>
### register allocation & pins (102)
@@ -637,7 +638,7 @@
- **ADDENDUM** — to §127 — the -O0 constant-offset fold keys on the MEMBER-ACCESS tree shape, not on the index being constant <sub>L29085</sub>
- **ADDENDUM** — to §261a — FOUR MORE -O0 DIALS BEYOND THE RELOAD COUNT (boot.c + md_MAIN_011/003, wave m0a/g0a/g0f, byte-proven) <sub>L29113</sub>
### family propagation & sweeps (107)
### family propagation & sweeps (108)
- **§8d** — Templating a body INTO a TU must not CHANGE its declaration environment — demote the carried data externs (Phase 26 session 8, byte-proven on `func_8015AE2C` ×133) <sub>L483</sub>
- **§11** — Cross-binary dedup & code-sharing (Phase 11 — "one match unlocks many") <sub>L908</sub>
@@ -746,6 +747,7 @@
- **ADDENDUM** — to §127 — the -O0 constant-offset fold keys on the MEMBER-ACCESS tree shape, not on the index being constant <sub>L29085</sub>
- **§296** — THE FRAME CHECK OUTRANKS THE ATLAS LEVER: READ PROLOGUE/EPILOGUE BEFORE DRAFTING ANY C — A REAL TELL CAN LIVE INSIDE AN UNREACHABLE FRAGMENT (P31 S61; wave m0a, 16 cards byte-proven; extends §179-C) <sub>L29371</sub>
- **§297** — ONE GIV SERVING MIXED-WIDTH LOADS *AND* A STORE NEEDS STRUCT-MEMBER SPELLING; CAST/INDEX SPELLINGS RE-SPLIT THE PSEUDO (P31 S61; wave m0a, `func_800347C8`, main, byte-proven 31/31) <sub>L29414</sub>
- **§307** — THE BRUTE-FORCE-THE-STATEMENT-ORDERS LEVER HAS A BOUND: A FAN-OUT COPY'S PRIORITY IS SCHEDULER-INTERNAL, AND NO SOURCE ORDER REACHES IT (P31 S63; byte-evidenced NEGATIVE result, main wave) <sub>L29854</sub>
### integration / TU plumbing (60)
@@ -2297,6 +2299,7 @@
- **§305** — "CARVE-REFUSED" AT GATE TIME IS THREE NAMED, DETERMINISTIC CLASSES — NONE OF THEM A CARVE (P31 S62 T3; 28 resolver drafts autopsied 28/28) <sub>L29737</sub>
- **§306** — A HAZARD `nop` IN FRONT OF A DIV-RESULT STORE IS A STATEMENT-ORDER DEFECT: THE INDEPENDENT TRAILING STATEMENT MUST BE WRITTEN *BEFORE* THE DIVISION-CONSUMING ONE (P31 S62 T4; byte-proven func_8017E7D0) <sub>L29789</sub>
- **§306a** — T4 DISTILL ADDENDA (P31 S62; four byte-proven refinements to existing laws, verified against the book by an independent verifier; each names its parent §) <sub>L29816</sub>
- **§307** — THE BRUTE-FORCE-THE-STATEMENT-ORDERS LEVER HAS A BOUND: A FAN-OUT COPY'S PRIORITY IS SCHEDULER-INTERNAL, AND NO SOURCE ORDER REACHES IT (P31 S63; byte-evidenced NEGATIVE result, main wave) <sub>L29854</sub>
---
@@ -3222,3 +3225,4 @@ Notes routinely quote that as a section id. This table resolves it. Grep bait: `
| L29737 | §305 | "CARVE-REFUSED" AT GATE TIME IS THREE NAMED, DETERMINISTIC CLASSES — NONE OF THEM A CARVE |
| L29789 | §306 | A HAZARD `nop` IN FRONT OF A DIV-RESULT STORE IS A STATEMENT-ORDER DEFECT: THE INDEPENDENT |
| L29816 | §306a | T4 DISTILL ADDENDA (P31 S62; four byte-proven refinements to existing laws, verified again |
| L29854 | §307 | THE BRUTE-FORCE-THE-STATEMENT-ORDERS LEVER HAS A BOUND: A FAN-OUT COPY'S PRIORITY IS SCHED |
+43
View File
@@ -29850,3 +29850,46 @@ same address in another overlay is usually unrelated code. `api_agent.prior_draf
candidate only when the symbols it references overlap the target `.s`'s relocations (law 1c); the
haiku arm re-run on its misses with the filtered packs banked 2 more. Read "warm start" as "a body
whose symbols are this .s's symbols", never as "a body with this name".
## §307 — THE BRUTE-FORCE-THE-STATEMENT-ORDERS LEVER HAS A BOUND: A FAN-OUT COPY'S PRIORITY IS SCHEDULER-INTERNAL, AND NO SOURCE ORDER REACHES IT (P31 S63; byte-evidenced NEGATIVE result, main wave)
**Why this is here.** `docs/cookbook-index.md` L22 sends every "same instruction multiset, one contiguous
window, loads/registers ROTATED inside it" residual to the **cheapest lever: brute-force the N independent
statement orders** (`gcc-2.7.2-map/sched.md` §S1/§S4). That lever is real and cheap — but it is NOT
universal, and until now nothing recorded where it stops. Two functions in the S63 main wave each
exhausted it and stayed NEAR, which is worth more banked than re-discovered.
**The shape it cannot reach.** A value in a register is (a) COPIED to preserve it across an imminent
reuse of the same hardreg, and (b) also the source of a sibling one-shot derivation. The target computes
the derivation directly from the original register (the two chains run parallel from `$v0`); gcc-2.7.2
emits the *preserving copy first* and then chains the derivation through the copy.
target: addu $t0,$v0,$zero / addiu $t7,$v0,-0xA0 <- both read $v0
gcc: addu $t0,$v0,$zero / addiu $t7,$t0,-0xA0 <- second chains through the copy
**Byte evidence — `func_8001BC6C` (main, 69 ins).** The agent hard-pinned every temp to its exact target
hardreg (`$2`–`$15`), got the first 9 instructions byte-exact, then ran **all 12 permutations** of the two
independent-statement groups through `match_one`: **every permutation produced byte-identical output**,
closeness pinned at 61. An opaque-`__asm__` barrier around the first group moved closeness 61 → 58 but
never removed the extra instruction. The same swap recurs at a second, independent site in the same
function (the `D_800B9A02`/`D_800A6610` pair) — i.e. it is a rule of the scheduler, not an accident of
one window. **Corroborating instance — `func_80021284` (main, 220 ins, closeness 25):** 7 head
instructions where no source order wins both the `%hi`/`%lo` pair placement and the `lw` position
(12 orders measured), plus 18 in a trailing if-block where local-alloc swaps two splice masks
`$a0`↔`$a1` (6 statement orders AND bitfield-vs-explicit-mask all byte-identical).
**THE LAW.** When the residual is a fan-out copy scheduled ahead of a sibling derivation from the same
source register, `rank_for_schedule`'s priority — not the LUID order the C statement sequence controls —
decides it. Statement order is then a *constant function* of the output: the permutation sweep is
provably inert, and each permutation still costs a compile.
**WHAT TO DO INSTEAD.** (1) Recognise the tell — permutations that all return the SAME closeness are the
signature; stop after the first 2–3, not after N!. (2) Register pins do not help either: pinning fixes
*which* register, not the scheduler's ready-list priority (both functions were already fully pinned).
(3) Route it to the permuter/T6 wall track, which searches a space source order cannot express. This is
the §3-The/`rank_for_schedule` family, and it is the case those entries did not yet cover.
**Cross-link:** cookbook-index L22 (the brute-force lever) now has a documented BOUND — check §307
before spending a permutation sweep; §5a/§34's `__asm__("")` fence moves closeness here but does not
close it, which is itself the discriminator between a delay-slot-filler residual (fence works) and a
ready-list-priority residual (fence only perturbs).
+16 -2
View File
@@ -25,6 +25,12 @@ def main():
help="the drafting run's transcript dir (holds journal.jsonl + agent-*.jsonl); repeatable")
ap.add_argument('--label', default='', help="provenance string for the cookbook header, e.g. 'P31 S63 t5a'")
ap.add_argument('--all-arms', action='store_true')
ap.add_argument('--novel-only', action='store_true',
help="select only transcripts whose agent NOTE carries a novelty signal (says the "
"cookbook lacks the lever, or names a lever/negative result). The t5a run measured "
"the base rate: 34 distilled -> 16 trivial, 5 novelty claims -> 1 ADDENDUM, so "
"distilling every banked transcript spends ~30x the tokens for the same book. "
"The FULL denominator is always printed (R41); this filter is reported, not hidden.")
ap.add_argument('--out', default='')
a = ap.parse_args()
if len(a.wave) != len(a.wfdir):
@@ -61,8 +67,16 @@ def main():
if not hit or not os.path.exists(hit[0]):
missing.append('%s/%s/%s' % (os.path.basename(wave), arm, fn)); continue
out.append({'fn': fn, 'arm': arm, 'transcript': hit[0], 'note': hit[1]})
print('waves %d; banked %d (union-gated %d); transcripts found %d; label %r'
% (len(a.wave), tot_banked, tot_union, len(out), a.label))
NOVEL = ('not in the cookbook', 'not in cookbook', 'cookbook did not have', "cookbook does not",
'NEW IDIOM', 'NEW:', 'NEW fact', 'the cookbook does not cover', 'does not yet cover',
'negative result', 'addendum', 'Cookbook-worthy', 'no cookbook lever', 'unlocked it')
n_all = len(out)
if a.novel_only:
out = [r for r in out if any(k.lower() in (r['note'] or '').lower() for k in NOVEL)]
print('waves %d; banked %d (union-gated %d); transcripts found %d; selected %d%s; label %r'
% (len(a.wave), tot_banked, tot_union, n_all, len(out),
' by novelty signal (%d NOT distilled — no signal in their note)' % (n_all - len(out)) if a.novel_only else '',
a.label))
if missing:
print('NO TRANSCRIPT for %d banked draft(s) — NOT distilled (R32, reported not skipped): %s'
% (len(missing), ' '.join(missing[:20])))