WIP: b-bucket: a per-bucket scope for the decode levers, the audit of what is bucket-dependent, and the weighted verdict #283

Draft
Grok wants to merge 10 commits from free/b-bucket into master
Owner

Draft on purpose: this branch is a WIP track; the card screen (bench/queues/b-bucket-screen.txt) is
the coordinator's to run, and a draft PR skips the CI card job.

What

Three deliverables for the owner's 2026-10-20 ask ("give more weight to B4 at 32k … ideally we could
also dynamically run different optimized path, as what works for B1 might be totally different for
what works well for B4 or B8"):

  1. Audit — docs/analysis/per-bucket-levers-20261020.md: every measured lever whose per-cell
    result depends on the batch bucket, split into path-driven and acceptance-driven, with the
    per-cell deltas from the records (tools: tools/ttx/percell.py, tools/ttx/bucket_scan.py).
  2. Mechanism — QWEN36_BUCKET_FLAGS="4,8:FLAG_A=1;1:FLAG_B=2": a per-bucket scope for the decode
    levers that are read per call, applied while a bucket's decode programs are compiled and its trace
    captured. Off by default and byte-identical; a mapping that names a latched flag is refused at
    boot; a new ttx lint rule checks the mapping against the served bucket_flags.py and requires
    every flag it names to be read by a file the arm stages.
  3. Judging rule — docs/DEV-LOOP.md §4b and tools/ttx/sweep-verdict.py --weighted: the
    weighted score (B4/32k 3, B8/32k 2, B4/4k 1.5, B8/4k 1, B1/32k 0.75, B1/4k 0.5), TG scored in tok/s
    per user, and an absolute B1 guard (no B1 cell worse than −5% TG).

The findings that matter

  • Of the 20 bucket-dependent arms, the MTP draft-depth ones flip sign because the drafter's
    acceptance rate flips with B, not because a different path runs. Scoping a flag per bucket
    cannot move acceptance; scoping K per bucket can, and QWEN36_MTP_BATCH_K_BY_BUCKET already
    does.
  • The one path-driven case is the SDPA-decode cores-per-head cap — and the cap binds only where
    cph * B * num_kv_heads < 110, i.e. at B=1 for cph ∈ {16, 32, 48}. So the cph48 record's
    +2.55% at B1/32k is a real program effect and its B4/B8 deltas are run-to-run noise between two
    boots of the same program.
  • Prefill cannot be bucket-scoped (the traces are captured once at boot and replayed; the
    running-decode count never enters a prefill trace shape). The owner's prefill ask is met by the
    judging rule, not by the mechanism.

Evidence (no card numbers yet)

  • ttsim gate, 2 chips, correctness only: bench/runs/bucket-flags-sim-20261020T195949Z.jsonl
    (SIM_GATE, 13 cells, all_ok). The flag-off SDPA decode output is bitwise equal to the stock
    program's; the scoped program runs and matches a torch reference; the wrong-mapping rung refuses.
  • 19 host unit tests: tests/test_bucket_flags.py (no ttnn, no device).
  • ttx lint clean on the CONTROL and on both new arms.
  • No tt-metal patch: the mechanism is host-side, so there is no new JIT surface (patch 0082 was not
    needed and is not used).

The card screen (queued, not run)

bench/queues/b-bucket-screen.txt: the must-fail boot first (expect REFUSED), then control → arm →
control over the six cells the weighted rule needs. The arm maps 1,2 → cph 48 and 4,8 → cph 16
and unsets the global value, so a correct mechanism moves no cell, and a broken one shows up at
B=1 (the default gives 32 of the 110 cores instead of 96, and loses ~2.5% TG at 32k).

What this does not claim

No speed number. The mechanism is unmeasured on the cards; the audit's per-cell deltas are n=1 runs.
Prefill is not scoped. The full report (with the harness friction list) is at
/home/orchestra/muse-runs/b-bucket.md.

**Draft on purpose**: this branch is a WIP track; the card screen (bench/queues/b-bucket-screen.txt) is the coordinator's to run, and a draft PR skips the CI card job. ## What Three deliverables for the owner's 2026-10-20 ask ("give more weight to B4 at 32k … ideally we could also dynamically run different optimized path, as what works for B1 might be totally different for what works well for B4 or B8"): 1. **Audit** — `docs/analysis/per-bucket-levers-20261020.md`: every measured lever whose per-cell result depends on the batch bucket, split into path-driven and acceptance-driven, with the per-cell deltas from the records (tools: `tools/ttx/percell.py`, `tools/ttx/bucket_scan.py`). 2. **Mechanism** — `QWEN36_BUCKET_FLAGS="4,8:FLAG_A=1;1:FLAG_B=2"`: a per-bucket scope for the decode levers that are read per call, applied while a bucket's decode programs are compiled and its trace captured. Off by default and byte-identical; a mapping that names a latched flag is refused at boot; a new `ttx lint` rule checks the mapping against the served `bucket_flags.py` and requires every flag it names to be read by a file the arm stages. 3. **Judging rule** — `docs/DEV-LOOP.md` §4b and `tools/ttx/sweep-verdict.py --weighted`: the weighted score (B4/32k 3, B8/32k 2, B4/4k 1.5, B8/4k 1, B1/32k 0.75, B1/4k 0.5), TG scored in tok/s per user, and an absolute B1 guard (no B1 cell worse than −5% TG). ## The findings that matter - Of the 20 bucket-dependent arms, the MTP draft-depth ones flip sign because the drafter's **acceptance rate** flips with B, not because a different path runs. Scoping a flag per bucket cannot move acceptance; scoping **K** per bucket can, and `QWEN36_MTP_BATCH_K_BY_BUCKET` already does. - The one path-driven case is the SDPA-decode cores-per-head cap — and the cap binds only where `cph * B * num_kv_heads < 110`, i.e. **at B=1** for cph ∈ {16, 32, 48}. So the cph48 record's +2.55% at B1/32k is a real program effect and its B4/B8 deltas are run-to-run noise between two boots of the *same* program. - **Prefill cannot be bucket-scoped** (the traces are captured once at boot and replayed; the running-decode count never enters a prefill trace shape). The owner's prefill ask is met by the judging rule, not by the mechanism. ## Evidence (no card numbers yet) - ttsim gate, 2 chips, correctness only: `bench/runs/bucket-flags-sim-20261020T195949Z.jsonl` (SIM_GATE, 13 cells, all_ok). The flag-off SDPA decode output is bitwise equal to the stock program's; the scoped program runs and matches a torch reference; the wrong-mapping rung refuses. - 19 host unit tests: `tests/test_bucket_flags.py` (no ttnn, no device). - `ttx lint` clean on the CONTROL and on both new arms. - No tt-metal patch: the mechanism is host-side, so there is no new JIT surface (patch 0082 was not needed and is not used). ## The card screen (queued, not run) `bench/queues/b-bucket-screen.txt`: the must-fail boot first (expect REFUSED), then control → arm → control over the six cells the weighted rule needs. The arm maps `1,2 → cph 48` and `4,8 → cph 16` and unsets the global value, so a correct mechanism moves **no** cell, and a broken one shows up at B=1 (the default gives 32 of the 110 cores instead of 96, and loses ~2.5% TG at 32k). ## What this does not claim No speed number. The mechanism is unmeasured on the cards; the audit's per-cell deltas are n=1 runs. Prefill is not scoped. The full report (with the harness friction list) is at `/home/orchestra/muse-runs/b-bucket.md`.
Believed before: a lever that wins at B8 and loses at B1 is a lever that runs a
different path per batch, so a per-bucket mechanism could exploit it.

The records say otherwise for most of them. Of the 20 bucket-dependent arms in
bench/runs, the MTP draft-depth arms (k4b1, k5b1, k4) flip sign because the
drafter's ACCEPTANCE rate flips with B (LEDGER R-2026-10-07-b8k3: accept per
draft 0.57 -> 0.37 at B1), not because a different path runs. Scoping a flag
per bucket cannot move acceptance; scoping K per bucket can, and
QWEN36_MTP_BATCH_K_BY_BUCKET already does.

One case is path-driven: the SDPA-decode cores-per-head cap. The factory's
min(110, cph * B * num_kv_heads) means the cap binds only where that product
is below the core grid, so for cph in {16, 32, 48} it only changes the program
at B=1. That also re-reads the cph48 record: its +2.55% TG at B1/32k is a
real program effect, and its B4/B8 deltas (-0.79, -0.68, -0.01, +0.27%) are
run-to-run noise between two boots of the SAME program.

Prefill cannot be bucket-scoped at all (the traces are captured once at boot and
replayed; the running-decode count never enters a prefill trace shape), so the
owner's prefill ask is met by the judging rule, not by a mechanism.

Two new tools, because the per-cell deltas were being re-derived by hand:
percell.py (an arm against its OWN control, so no cross-run drift) and
bucket_scan.py (every arm whose B=1 mean and B>=4 mean fall on opposite sides).
Believed before: "run a different optimized path per bucket" is a wish, because
a decode lever is ONE global env value for the whole boot, so a lever that
helps B1 can only ship for every bucket or not at all.

The per-bucket PROGRAM already existed -- the decode warmup compiles and
captures a trace per width, and the MTP path has its own per-bucket compile and
capture loops. What was missing was a way to make a FLAG differ per bucket.
That is now bucket_flags.py: a mapping of bucket widths to flag values, applied
as a thread-local overlay while that bucket's decode programs are compiled and
its trace captured (the compile pass and the capture pass must see the same
values, or the captured trace would reference a program built with other
ones). The overlay is thread-local and never writes os.environ, so it cannot
leak into another thread or into the runtime path.

Only a flag that is READ PER CALL can differ per bucket. bucket_flags.SCOPABLE
is the registry of those (the five QWEN36_SDPA_DEC_* knobs and
QWEN36_GDN_DECODE_CHAIN); a mapping that names a flag latched before any
decode trace is captured (QWEN36_KV_UPDATE_FOLD, QWEN36_ATTN_POST_FOLD,
QWEN36_ARGMAX_FOLD, QWEN36_DECODE_MR_CPB, ...) is REFUSED at boot rather than
silently ignored, because a per-bucket value for it could not take effect.

Off by default and byte-identical: with the flag unset, get() is
os.environ.get() and no overlay is built. The boot self-test refuses the boot
on a mapping that does not parse, a non-scopable flag, a scope that does not
read back, a scope that did not restore the overlay exactly, and the
wrong-mapping rung QWEN36_BUCKET_FLAGS_MUSTFAIL=1.

A new ttx lint rule checks the mapping against the SERVED bucket_flags.py (the
lint loads the file the boot runs, it does not copy the parser) and requires
every flag the mapping names to be read by a file the arm stages -- a flag
nothing serves reads would keep its boot-wide value in every bucket, i.e.
ship inert. That is caught before a slot is taken.

Host-side only: no device code, so no new JIT surface and no tt-metal patch
(0082 was not needed and is not used). The card screen is queued, not run:
bench/queues/b-bucket-screen.txt runs the must-fail boot first, then control,
arm, control over the six cells the weighted rule needs. The arm maps
1,2 -> 48 and 4,8 -> 16 and unsets the global value, so a correct mechanism
moves no cell and a broken one shows up at B=1 (the default gives 32 of the
110 cores instead of 96).
Believed before: the per-cell table is the decision, so a lever that wins at
B4/32k and loses at B1/4k is a wash, and the table cannot say which one
matters more.

The owner (2026-10-20): "we should give more weight in our decision to b4 at
32k above b1 at 8k when it comes to both decode and prefill, as that is the
more performance-sensitive spot. of course we should not botch the B1 speeds".
So the score is now weighted (B4/32k 3, B8/32k 2, B4/4k 1.5, B8/4k 1,
B1/32k 0.75, B1/4k 0.5), TG is scored in tok/s PER USER (1000/tg_ms, the
owner's primary decode metric: a step that takes 5% longer is 4.8% fewer
tokens per second, so ms/token and tok/s do not share a sign), and the B1
guard is absolute: no B1 cell may be worse than -5% TG, whatever the score.

A score inside the control band is a HOLD, not a win (the band is the
control's own [min,max] spread, weighted the same way; the band
false-positive rate is ~30% at n=2 vs 4). weight_coverage reports the share of
the weight that was actually measured: a score over a subset is not the
owner's score.

The per-cell output is unchanged. k4b1 is the case the rule exists for: its
weighted score is positive (it wins at B8) and it still loses, because B1/4k
TG is 13.8% worse.
The mapping cache only applies to the BOOT env. An explicit env (the tests, and
any caller that asks about a mapping that is not the boot's) is parsed fresh:
otherwise the first parse shadows every later question, and a test that passes a
mapping would read the boot's.

The wrong-mapping rung no longer raises ValueError on a width the mapping does
not name. It shifted each NAMED width to the next named width's assignments and
indexed the list with a width that was not in it; a mapping that names only some
widths (the common case) crashed the boot with a ValueError instead of leaving
the unnamed width alone. A single-width mapping still refuses, because a shift
cannot be detected with one width: the self-test says so.

The audit's lint-rule paragraph now also says what the rule really checks: the
mapping must parse with the SERVED bucket_flags.py, and every flag it names must
be READ by a file the arm stages (a flag nothing serves reads keeps its
boot-wide value in every bucket, i.e. ships inert). It also points at the right
DEV-LOOP section for the judging rule (4b, not 2d).
19 host unit tests (tests/test_bucket_flags.py, no ttnn, no device): the parse
and every refusal it owes, the scope (a mapped flag reads the mapped value, an
unmapped one keeps the boot-wide value, the overlay is restored exactly and
nested scopes restore the OUTER scope), the thread-locality of the overlay, the
self-test passing and refusing, the wrong-mapping rung and the banner.

Two of the tests found real defects in the mechanism, both fixed in the
previous commit: the boot cache shadowed an explicit env, and the wrong-mapping
rung raised ValueError on a width the mapping does not name (the common case:
a mapping that names only some widths).

The ttsim gate (bench/probes/sim_bucket_flags.py, 2 chips, correctness only):
13 cells, all ok. The host cells run the SERVED reader (tp_common.sdpa_decode_knobs,
exec'd from the served source) against the stock os.environ backend: with the
flag off the returned program config and call kwargs are identical, and under
scope(w) the reader reads the scoped value for w and the boot-wide value for a
bucket the mapping does not name. The device cells (B=1, B=8): the flag-off
SDPA decode output is BITWISE equal to the stock program's, and the scoped
program runs and matches a torch reference on the cache as stored.

Record: bench/runs/bucket-flags-sim-20261020T195949Z.jsonl (SIM_GATE, all_ok,
git 8f2f6f9d, dirty false). No ttsim number is a performance number: the probe
prints no timings. The card screen is still queued, not run.
queue: say where the screen runs from, and which arms it uses
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Has been cancelled
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has been cancelled
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
tt-stack-ci / Build simulators and check the host module (pull_request) Has been cancelled
4b2bafb15a
The steps use relative paths, so the queue has to be run from the repo root, and
the arms it names are derived from CONTROL (the candidate ...-bbf1 and the
must-fail ...-bbf1-mf).
audit: re-derive every cell with percell.py, and fix the one that was wrong
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Has been cancelled
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has been cancelled
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
tt-stack-ci / Build simulators and check the host module (pull_request) Has been cancelled
f087985efa
Believed before: the per-cell table in the audit was right (it was written by
hand from the same records the tool reads).

Re-derived with tools/ttx/percell.py on every row: 35 of 36 cells are exactly
as written. One was not: cph48's B4/4k TG is -0.72%, not the -0.79% in the
table -- that was the PP delta of the same cell (the two happen to be close,
which is why it survived a hand check). The page now says which cell was
corrected, so the correction is visible instead of silent.

percell.py also stops re-reading each arm's record file once per cell (it was
O(cells) reads) and drops a helper nothing called.
Owner

verdict: approve (advisory — WIP draft; card screen not run, no label applied)
tier: T1 (additive: one new vendored python module + one nix mount line + tools/tests/docs; the decode path is byte-identical when the flag is off)

rationale: The per-bucket mechanism is sound and the host half is proven: I reconstructed the branch's bucket_flags.py (new file + patch 4's two fixes) and ran the 19 host unit tests here — all pass, including the wrong-mapping rung and the latched-flag refusal. The nix change is additive and correctly explains why the file must mount unconditionally (tp_common imports it).

concerns:

  • [warn] bench/queues/b-bucket-screen.txt — the card screen is queued but NOT run; the PR itself says "No speed number. The mechanism is unmeasured on the cards". Do not un-draft + label until the screen lands: the B1/32k falsifier (mapping ignored → ~2.5% TG loss) is the only proof the overlay actually takes effect on hardware.
  • [warn] patches/.../mtp_batch.py — the whole per-bucket loop body is re-indented under with bucket_flags.scope(bw); the trace-capture logic reads as a faithful re-indent (same ops, same order, same budget check), but with a broken mechanism this is the file where the damage would be silent. The must-fail arm in the screen is the right guard.
  • [nit] tools/ttx/ttxlib/lint.py — the lint check matches flag names in RAW bytes of staged files (comment mentions count), which the docstring concedes; fine as a static gate since parse() refuses non-scopable flags, but worth remembering a commented-out reader passes the lint.

No secret-leak / red-flag patterns; no tt-metal patch (no new JIT surface). The audit's claim (path-driven case is cph, binding only at B=1; prefill cannot be scoped) is consistent with the mechanism design. Leaving as draft on purpose — approve is advisory; run the screen, then label + un-draft.

**verdict:** approve (advisory — WIP draft; card screen not run, no label applied) **tier:** T1 (additive: one new vendored python module + one nix mount line + tools/tests/docs; the decode path is byte-identical when the flag is off) **rationale:** The per-bucket mechanism is sound and the host half is proven: I reconstructed the branch's `bucket_flags.py` (new file + patch 4's two fixes) and ran the 19 host unit tests here — all pass, including the wrong-mapping rung and the latched-flag refusal. The nix change is additive and correctly explains why the file must mount unconditionally (tp_common imports it). **concerns:** - [warn] `bench/queues/b-bucket-screen.txt` — the card screen is queued but NOT run; the PR itself says "No speed number. The mechanism is unmeasured on the cards". Do not un-draft + label until the screen lands: the B1/32k falsifier (mapping ignored → ~2.5% TG loss) is the only proof the overlay actually takes effect on hardware. - [warn] `patches/.../mtp_batch.py` — the whole per-bucket loop body is re-indented under `with bucket_flags.scope(bw)`; the trace-capture logic reads as a faithful re-indent (same ops, same order, same budget check), but with a broken mechanism this is the file where the damage would be silent. The must-fail arm in the screen is the right guard. - [nit] `tools/ttx/ttxlib/lint.py` — the lint check matches flag names in RAW bytes of staged files (comment mentions count), which the docstring concedes; fine as a static gate since `parse()` refuses non-scopable flags, but worth remembering a commented-out reader passes the lint. No secret-leak / red-flag patterns; no tt-metal patch (no new JIT surface). The audit's claim (path-driven case is cph, binding only at B=1; prefill cannot be scoped) is consistent with the mechanism design. Leaving as draft on purpose — approve is advisory; run the screen, then label + un-draft.
Author
Owner

Review (coordinator's card screener). The tooling and docs are split into #284, where the judge has three fixes: WIN on TG or PP, floors at the CI bars, and a B1 guard on PP plus a noise flag.

Mechanism: GO for a fidelity screen. Fixes are on review/b-bucket (built on this branch, merged with master S5).

  • Flag-off byte-identical: confirmed. Ignoring whitespace, the mtp_batch diff is only the two scope(bw) wrappers, and get() reads os.environ when no overlay is active.
  • Compile and capture are both scoped at every MTP bucket and at the plain-decode warmup.
  • Gap, now fixed: nothing proved the overlay reached the captured programs, because the self-test only exercised get() in isolation. get() now records scoped reads per (bucket, flag). After the MTP capture, verify_reached refuses the boot unless every mapped pair was read inside its bucket's scope with the mapped value. It has an in-boot wrong-input branch (an altered mapping must be caught) and logs QWEN36_BUCKET_FLAGS reached: buckets [...]. 6 new unit tests.
  • Queue file: do not run bench/queues/b-bucket-screen.txt. It boots a separate must-fail arm, which the owner prohibits (10-03), and it uses ttx run instead of ttx ab. The S5 arm -s5-bbf1 (expects the reached banner) is in the coordinator's batch 2.
  • Evidence: the audit's cph48 row is n=1. Its B4/32k −0.68% contradicts the page's own claim that B4/B8 compile the same program, so that cell is noise. S5 already ships cph48 globally, so there is no measured per-bucket win today. The mechanism ships only when an arm wins with it.
  • B1 guard: it is relative to the screen's control. S5's own −4.5% at B1/32k vs S4 therefore doesn't eat into it, but nothing stops B1 drifting down across ships. Track that in each ship's LEDGER entry.
Review (coordinator's card screener). The tooling and docs are split into #284, where the judge has three fixes: WIN on TG or PP, floors at the CI bars, and a B1 guard on PP plus a noise flag. **Mechanism: GO for a fidelity screen.** Fixes are on `review/b-bucket` (built on this branch, merged with master S5). - **Flag-off byte-identical:** confirmed. Ignoring whitespace, the mtp_batch diff is only the two `scope(bw)` wrappers, and `get()` reads `os.environ` when no overlay is active. - **Compile and capture are both scoped** at every MTP bucket and at the plain-decode warmup. - **Gap, now fixed:** nothing proved the overlay reached the captured programs, because the self-test only exercised `get()` in isolation. `get()` now records scoped reads per (bucket, flag). After the MTP capture, `verify_reached` refuses the boot unless every mapped pair was read inside its bucket's scope with the mapped value. It has an in-boot wrong-input branch (an altered mapping must be caught) and logs `QWEN36_BUCKET_FLAGS reached: buckets [...]`. 6 new unit tests. - **Queue file:** do not run `bench/queues/b-bucket-screen.txt`. It boots a separate must-fail arm, which the owner prohibits (10-03), and it uses `ttx run` instead of `ttx ab`. The S5 arm `-s5-bbf1` (expects the reached banner) is in the coordinator's batch 2. - **Evidence:** the audit's cph48 row is n=1. Its B4/32k −0.68% contradicts the page's own claim that B4/B8 compile the same program, so that cell is noise. S5 already ships cph48 globally, so there is no measured per-bucket win today. The mechanism ships only when an arm wins with it. - **B1 guard:** it is relative to the screen's control. S5's own −4.5% at B1/32k vs S4 therefore doesn't eat into it, but nothing stops B1 drifting down across ships. Track that in each ship's LEDGER entry.
Author
Owner

Review (coordinator's card screener). The tooling and docs are split into #284, where the judge has three fixes: WIN on TG or PP, floors at the CI bars, and a B1 guard on PP plus a noise flag.

Mechanism: GO for a fidelity screen. Fixes are on review/b-bucket (built on this branch, merged with master S5).

  • Flag-off byte-identical: confirmed. Ignoring whitespace, the mtp_batch diff is only the two scope(bw) wrappers, and get() reads os.environ when no overlay is active.
  • Compile and capture are both scoped at every MTP bucket and at the plain-decode warmup.
  • Gap, now fixed: nothing proved the overlay reached the captured programs, because the self-test only exercised get() in isolation. get() now records scoped reads per (bucket, flag). After the MTP capture, verify_reached refuses the boot unless every mapped pair was read inside its bucket's scope with the mapped value. It has an in-boot wrong-input branch (an altered mapping must be caught) and logs QWEN36_BUCKET_FLAGS reached: buckets [...]. 6 new unit tests.
  • Queue file: do not run bench/queues/b-bucket-screen.txt. It boots a separate must-fail arm, which the owner prohibits (10-03), and it uses ttx run instead of ttx ab. The S5 arm -s5-bbf1 (expects the reached banner) is in the coordinator's batch 2.
  • Evidence: the audit's cph48 row is n=1. Its B4/32k −0.68% contradicts the page's own claim that B4/B8 compile the same program, so that cell is noise. S5 already ships cph48 globally, so there is no measured per-bucket win today. The mechanism ships only when an arm wins with it.
  • B1 guard: it is relative to the screen's control. S5's own −4.5% at B1/32k vs S4 therefore doesn't eat into it, but nothing stops B1 drifting down across ships. Track that in each ship's LEDGER entry.
Review (coordinator's card screener). The tooling and docs are split into #284, where the judge has three fixes: WIN on TG or PP, floors at the CI bars, and a B1 guard on PP plus a noise flag. **Mechanism: GO for a fidelity screen.** Fixes are on `review/b-bucket` (built on this branch, merged with master S5). - **Flag-off byte-identical:** confirmed. Ignoring whitespace, the mtp_batch diff is only the two `scope(bw)` wrappers, and `get()` reads `os.environ` when no overlay is active. - **Compile and capture are both scoped** at every MTP bucket and at the plain-decode warmup. - **Gap, now fixed:** nothing proved the overlay reached the captured programs, because the self-test only exercised `get()` in isolation. `get()` now records scoped reads per (bucket, flag). After the MTP capture, `verify_reached` refuses the boot unless every mapped pair was read inside its bucket's scope with the mapped value. It has an in-boot wrong-input branch (an altered mapping must be caught) and logs `QWEN36_BUCKET_FLAGS reached: buckets [...]`. 6 new unit tests. - **Queue file:** do not run `bench/queues/b-bucket-screen.txt`. It boots a separate must-fail arm, which the owner prohibits (10-03), and it uses `ttx run` instead of `ttx ab`. The S5 arm `-s5-bbf1` (expects the reached banner) is in the coordinator's batch 2. - **Evidence:** the audit's cph48 row is n=1. Its B4/32k −0.68% contradicts the page's own claim that B4/B8 compile the same program, so that cell is noise. S5 already ships cph48 globally, so there is no measured per-bucket win today. The mechanism ships only when an arm wins with it. - **B1 guard:** it is relative to the screen's control. S5's own −4.5% at B1/32k vs S4 therefore doesn't eat into it, but nothing stops B1 drifting down across ships. Track that in each ship's LEDGER entry.
An independent test pass over the mechanism (40 tests, tests/test_bucket_flags.py)
found three real defects. All three had a concrete failing input; all three are
fixed here and covered by a regression test.

1. banner() burned its once-per-boot latch on an EMPTY mapping, so a mapping
   that arrived later in the same process logged nothing: the arm's
   "QWEN36_BUCKET_FLAGS engaged" line was missing from the log. The flag being
   off is not a banner event; the latch is now taken only by a real mapping.

2. The boot mapping was cached and nothing ever called reset(), so an in-place
   change of the env (the served arm-switch path rewrites the environment) kept
   applying the BOOT arm's mapping: a per-bucket lever that silently did not
   apply, which is the exact failure mode this mechanism exists to prevent.
   The cache is now keyed on the RAW env value, so a change is picked up and
   re-announced. (The served arm switch classifies QWEN36_BUCKET_FLAGS as an
   unknown flag, i.e. a REBOOT, so no switch changes it in place today; the
   hazard was for any future path that does.)

3. A nested scope for a width the mapping does not name kept the OUTER scope's
   value instead of the boot-wide one, contradicting the module's own
   docstring. A scope is the BUCKET's value set: every scopable flag inside it
   reads either that bucket's assignment or the boot-wide value. The served
   path does not nest today (the MTP bucket loops run after the decode warmup,
   not inside it), so this changes no served behaviour; it makes the contract
   true.

The test file is the superset of two passes (38 + the two regression tests
added here = 40). One of the earlier tests asserted the OLD caching behaviour
and was updated to the fixed semantics.
tests: the scope docstring says what a nested scope for an unnamed width reads
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Has been cancelled
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has been cancelled
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
tt-stack-ci / Build simulators and check the host module (pull_request) Has been cancelled
f267d3ebc3
The fixed semantics are: a scope is the bucket's value set, so a nested scope
for a width the mapping does not name reads the boot-wide value, not the
enclosing bucket's.
ttsim gate: the record against the fixed mechanism
Some checks are pending
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 9m48s
tt-stack-ci / Report upstream drift (pull_request) Successful in 2m47s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 9m37s
tt-stack-ci / Serialized card gate (pull_request) Has been skipped
cards-fresh cards: draft, not run; add cards:go to force
d30bf72455
The module changed (three defects fixed, commit 32edc55d), so the earlier record
described a source that is no longer in the tree. It is replaced by the run
against the fixed source: bench/runs/bucket-flags-sim-20261020T211436Z.jsonl
(SIM_GATE, 13 cells, all_ok, git f267d3eb, dirty false). The index row moves
with it.

The run waited four minutes for a ttsim slot (the other three were busy) and
then took 42 s: correctness only, no timings.
Some checks are pending
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 9m48s
tt-stack-ci / Report upstream drift (pull_request) Successful in 2m47s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 9m37s
tt-stack-ci / Serialized card gate (pull_request) Has been skipped
cards-fresh cards: draft, not run; add cards:go to force
This pull request has changes conflicting with the target branch.
  • modules/tenstorrent-serving.nix
  • patches/prod-local-metal/models/demos/blackhole/qwen36/tt/mtp_batch.py
  • patches/prod-local-metal/models/demos/blackhole/qwen36/tt/qwen36_vllm.py
  • tools/ttx/ttxlib/lint.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin free/b-bucket:free/b-bucket
git switch free/b-bucket
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack!283
No description provided.