X280-2: on-card speculative control loop — kill the MTP V→host→C round trip #305

Open
opened 2026-10-23 10:00:52 +02:00 by Grok · 0 comments
Owner

X280-2 — On-card speculative control loop (MTP / drafter accept → commit → draft, no host round trip)

Type: speed lever (decode), latency-bound · the flagship item of this milestone
Effort (after X280-0): 8–12 weeks · Stage: B (start in parallel with X280-1)
Depends on: X280-0 (K0.1, K0.4) · Blocks: X280-5's graph-level variant

1. TL;DR

Every MTP cycle is V trace → blocking id readback → Python accept → ~9 H2D writes → C trace. The device is idle through the middle of it, and the measured exposure is 2.8–4.4 ms per cycle out of a 38.8–54.0 ms step.

We move the accept and the C-trace parametrisation onto an X280 hart sitting one NoC hop from Tensix L1: verify ids land in LIM, the X280 computes the accepted length m per row, patches the commit mask / positions / page-table pointers in place, and releases a limiter in Tensix L1. The host is told the emitted tokens, not asked to make the decision.

Pre-registered target: exposed host + prep per cycle → ≤ 0.3 ms, giving +5…9% TG tok/s per user at B=1/4k and +2…5% at B=8/32k, with bit-identical outputs and unchanged τ.

2. Why (measured baseline)

From bench/runs/reprofile-dfr-decode-20261015.jsonl (QWEN36_MTP_BATCH_TIMING, window-weighted means, CONTROL …-gpgob-dfr, TP=2):

Cell total ms verify accept host prep wait_c
B1/4k 38.77 29.37 6.36 1.51 1.29 0.24
B1/32k 40.26 30.76 6.41 1.52 1.21 0.35
B4/4k 41.42 31.29 6.63 1.71 1.51 0.28
B4/32k 45.22 34.91 6.63 1.71 1.58 0.38
B8/4k 47.17 35.98 6.53 2.38 1.73 0.53
B8/32k 53.96 42.46 6.66 2.51 1.86 0.48

accept is mostly waiting, so it is not the target. host + prep (2.80 … 4.37 ms) is pure serial host time inside the step. At B1/4k that is 7.2% of the step; at B8/32k, 8.1%.

The historical evidence says the same thing from the other side: LEDGER R-2026-09-26-resident-async-flush measured −6.2 ms/step for re-gaining resident+async on plain decode, and the MTP path gives both of them up because acceptance length m ∈ [0..K] is data-dependent (docs/MTP-BATCH.md:105, §12a).

And QWEN36_MTP_DEVICE_ACCEPT (c152) already tried the Tensix-only half of this: accept on device made the accept phase 3.4 → 0.1 ms, but wait_c grew by 2.6–3.2 ms and the step total did not move (bench/runs/perf-loop-c152-device-accept-verdict-20261001T2000Z.jsonl). The lesson is precise: the win is not "move accept", it is "stop the round trip and stop rebuilding C's inputs on the host". That is a control-plane job, which is what an X280 is.

3. What exists today (control flow)

  1. Host enqueues trace V (verify, M = Bw×T rows) with ttnn.execute_trace.
  2. Host does a blocking read of the verify ids (cpu()), computes m per row in Python (MTPBatchHost accept), and updates slot state.
  3. Host builds the C inputs: commit mask/length, reseed positions, page-table/v_posf updates, K draft-input rows — roughly 9 separate H2D writes plus tilizes per step (MTP-BATCH.md:520-523, §19a).
  4. Host enqueues trace C (commit + reseed + K drafts).
  5. With QWEN36_MTP_OVERLAP=1 C is non-blocking, so vLLM's between-step work overlaps it — but the next cycle still begins with a host-built V.

Traced command queues are host-enqueued; an X280 cannot replay a trace. So the design cannot be "X280 runs the step". It has to be "the traces that are already captured become data-dependent on a small set of buffers the X280 writes".

4. Design

4.1 The key idea: make C m-agnostic instead of host-parametrised

Today C is re-parametrised from the host each cycle. Instead, capture one C trace whose behaviour depends only on device-resident data:

Input Today After
accepted length m per row host-computed Python int → several H2D writes and different code paths one uint8[Bw] in LIM/DRAM, written by X280
commit source state host picks among T candidate state buffers device gather with m as the index (data-dependent addressing, same program)
reseed positions host builds a position vector, H2D X280 increments the existing device position vector in place
draft row inputs host fills K rows unchanged shape; only the row mask is device data
page-table pointers host patched unchanged per cycle; remapped only when the batch plan changes (rare, and still host)

This is the whole lever. Everything else is plumbing.

4.2 Data flow per cycle

host, once per plan change:  enqueue V; enqueue C' (m-agnostic); arm the limiter
  V runs on Tensix ──(last verify program)──► candidate ids/values → LIM of one cluster (Bw×T×4 B)
  X280 hart (polling LIM, no interrupt needed):
      1. m[i] = compare-and-count accepted prefix per row          (~µs)
      2. write m[] into the commit mask buffer, positions[i] += m[i]+1
      3. write the emitted token ids → slot state + D2H ring (async)
      4. set the release flag that C' spins on
  C' runs on Tensix (commit over m rows, reseed, K drafts)
  host: reads the emitted ids off the D2H ring, returns them to vLLM; never blocks

No host work sits between V and C. host + prep collapses to "kick off the next cycle at the plan boundary".

4.3 Sizing — this is a LIM-sized problem

Object Size
verify candidate ids/values, Bw=8 × T=4 (K=3) × 4 B 128 B
m[] 8 B
positions vector 32 B
token history for the slot map ≤ 1 KiB
total hot state < 2 KiB

This is why this issue is the flagship: it needs essentially no memory bandwidth, only a placement change. It is the purest test of "latency, not throughput".

4.4 Host-visible change

The host must stop being the accept authority but remain the plan authority: slot remap, preemption, batch composition, and the "fallback to plain decode" decision stay on the host, at plan boundaries. That keeps the vLLM accounting work (LagBook, async scheduler) unchanged — that machinery already exists for the async path (docs/MTP-BATCH.md:537-554).

5. Numeric targets and kill criteria

ID Metric Pre-registered target
T2.1 host + prep in the overlap-timing line, all six cells ≤ 0.3 ms/cycle (from 2.80–4.37)
T2.2 TG tok/s per user B1/4k +5…9% (38.77 → 35.5–36.8 ms cycle)
T2.3 TG tok/s per user B8/32k +2…5%
T2.4 τ (tokens per row-step) unchanged (accept rule identical)
T2.5 outputs bit-identical to CONTROL at every cell, all 1024 tokens
T2.6 X280 hart time per cycle ≤ 50 µs at Bw=8 (accept + patch + release)
K2.1 if host+prep after two rounds is > 1.5 ms/cycle close — the residual would be elsewhere
K2.2 if the m-agnostic commit is not bit-exact in ttsim for every (T, Bw) cell fall back to bucketed C traces (m ∈ {0,1,2,3} pre-baked); if that also fails, close
K2.3 if T2.2 < 1% at G5 close as INERT with a record

6. Quality gates

Gate What must pass
G0 QWEN36_X280_MTP_ACCEPT=1; banner; flag off = today's host accept, byte-identical; ttx lint 8/4/1; the arm lists the MUSTFAIL banner as absent
G1 host tests: accept arithmetic for every m ∈ [0..K+1], T=1..8, Bw=1..8; a must-fail case where m is off by one must be refused by the in-boot self-test
G2 ttsim, this is the real gate — m-agnostic commit vs the current path, bitwise, at every (T, Bw, ctx, edge-page) cell; plus a flag-off regression all_ok. Trace replay itself cannot be proven in ttsim, so…
G3 on-card: a traced replay of C' with each m planted by the X280, token_ids_sha256 vs the current path; mailbox RTT under load
G4 served boot; the warmup self-test runs its own wrong-input branch at every boot and refuses if it passes
G5 ttx A/B ABBA n≥2 vs CONTROL …-gpgob-dfr (or its successor), B=1/4/8 × 4k/32k, QWEN36_MTP_OVERLAP_TIMING=1 twin arm for the phase split
G6 tier 1 (bit-exact): equiv 8/8, GSM8K ≥ 59/60, retrieval 16/16
G7 CONTROL move, STATUS row, LEDGER entry, LEVERS row

7. Work breakdown

Phase Work Exit
P1 ttsim model of the m-agnostic commit (device gather on m) vs today, all cells G2
P2 The 1 KiB LIM protocol: layout, versioning, sequence numbers, timeout/fallback G1
P3 X280 accept + patch + release firmware; host-side "plan boundary only" refactor G3
P4 Remove the V→host→C round trip; keep OVERLAP for vLLM's between-step work G4
P5 Served A/B + timing twin G5/G6
P6 Ship G7

8. Risks and traps

  1. The m-agnostic commit is a numerics change if done carelessly. Gathering candidate state m is the same data the host selects today, so it is bit-exact if the gather reads the same fp32 values and the commit applies the same rounding. Prove it in ttsim before any card time.
  2. Traces bake addresses, not values. Patching the mask/position buffers is safe only if those buffers were allocated before capture and never reallocated. This is the same constraint mtp-state-slot already solves for slot states.
  3. A hung/timed-out X280 must fall back. Watchdog on the release flag: if it does not arrive in ~50 µs, the host takes today's path for that cycle. Never deadlock a served request on firmware.
  4. The resident chain is not MTP-aware (MTP-BATCH.md:105, §12d). Do not try to fix that here; the win is the intra-step round trip.
  5. One NoC hop still has a cost. X280 polls LIM; polling burns vector issue slots. Use a wfi-style spin on a LIM word with a bounded backoff, or have the Tensix epilogue do one atomic store to a flag the X280 watches (the X280 cannot be interrupted by NoC).
  6. kvfold refuses T > 4. Any drafter work (DSpark, K≥7) needs that lifted first; out of scope here, but the m-agnostic commit should not make it harder.

9. Anti-goals

  • Not "run the whole step on X280". Traces stay host-enqueued; the X280 only decides and patches.
  • Not moving the drafter model itself (that is Tensix work).
  • Not changing the accept rule. Bit-exactness is the gate and the safety property.

10. Open questions

  • Q1: can the verify epilogue write Bw×T ids to LIM without a new trace capture? (It changes the program's output set → almost certainly a re-capture of the V trace. Budget it.)
  • Q2: does the C' trace's GDN commit support a device-side index into the T candidate states without a new kernel? If not, that is a small C++ op (int gather over state tiles), which is a real chunk of this issue's effort.
  • Q3: what does QWEN36_MTP_EARLY_RESEED do to the dependency order once the host no longer waits? (May become unnecessary — measure both.)

11. References

  • bench/runs/reprofile-dfr-decode-20261015.jsonl — the phase split this issue attacks.
  • docs/MTP-BATCH.md §3, §7.3, §12, §19a — the host phases, the async design, and why accept-on-device alone was inert.
  • bench/runs/perf-loop-c152-device-accept-verdict-20261001T2000Z.jsonl — the negative that defines this design.
  • LEDGER R-2026-09-26-resident-async-flush, R-2026-10-03-so-t0, R-2026-10-03-gdc-cpk.
  • docs/analysis/lever-reeval-decode-gdn-attn-mtp-20261006.md §2c — the lever table this issue replaces.
# X280-2 — On-card speculative control loop (MTP / drafter accept → commit → draft, no host round trip) **Type:** speed lever (decode), latency-bound · **the flagship item of this milestone** **Effort (after X280-0):** 8–12 weeks · **Stage:** B (start in parallel with X280-1) **Depends on:** X280-0 (K0.1, K0.4) · **Blocks:** X280-5's graph-level variant ## 1. TL;DR Every MTP cycle is **V trace → blocking id readback → Python accept → ~9 H2D writes → C trace**. The device is idle through the middle of it, and the measured exposure is **2.8–4.4 ms per cycle** out of a 38.8–54.0 ms step. We move the accept and the C-trace parametrisation onto an X280 hart sitting one NoC hop from Tensix L1: verify ids land in LIM, the X280 computes the accepted length `m` per row, patches the commit mask / positions / page-table pointers **in place**, and releases a limiter in Tensix L1. The host is told the emitted tokens, not asked to make the decision. **Pre-registered target:** exposed `host + prep` per cycle → **≤ 0.3 ms**, giving **+5…9% TG tok/s per user at B=1/4k** and **+2…5% at B=8/32k**, with **bit-identical outputs** and **unchanged τ**. ## 2. Why (measured baseline) From `bench/runs/reprofile-dfr-decode-20261015.jsonl` (`QWEN36_MTP_BATCH_TIMING`, window-weighted means, CONTROL `…-gpgob-dfr`, TP=2): | Cell | total ms | verify | accept | host | prep | wait_c | |---|---:|---:|---:|---:|---:|---:| | B1/4k | 38.77 | 29.37 | 6.36 | **1.51** | **1.29** | 0.24 | | B1/32k | 40.26 | 30.76 | 6.41 | 1.52 | 1.21 | 0.35 | | B4/4k | 41.42 | 31.29 | 6.63 | 1.71 | 1.51 | 0.28 | | B4/32k | 45.22 | 34.91 | 6.63 | 1.71 | 1.58 | 0.38 | | B8/4k | 47.17 | 35.98 | 6.53 | 2.38 | 1.73 | 0.53 | | B8/32k | 53.96 | 42.46 | 6.66 | 2.51 | 1.86 | 0.48 | `accept` is mostly *waiting*, so it is not the target. **`host` + `prep` (2.80 … 4.37 ms) is pure serial host time inside the step.** At B1/4k that is **7.2% of the step**; at B8/32k, 8.1%. The historical evidence says the same thing from the other side: `LEDGER R-2026-09-26-resident-async-flush` measured **−6.2 ms/step** for re-gaining resident+async on plain decode, and the MTP path gives both of them up because acceptance length `m ∈ [0..K]` is data-dependent (`docs/MTP-BATCH.md:105`, §12a). And `QWEN36_MTP_DEVICE_ACCEPT` (`c152`) already tried the *Tensix-only* half of this: accept on device made the accept phase 3.4 → 0.1 ms, but `wait_c` grew by 2.6–3.2 ms and the step total did not move (`bench/runs/perf-loop-c152-device-accept-verdict-20261001T2000Z.jsonl`). **The lesson is precise: the win is not "move accept", it is "stop the round trip and stop rebuilding C's inputs on the host".** That is a control-plane job, which is what an X280 is. ## 3. What exists today (control flow) 1. Host enqueues trace **V** (verify, M = Bw×T rows) with `ttnn.execute_trace`. 2. Host does a **blocking** read of the verify ids (`cpu()`), computes `m` per row in Python (`MTPBatchHost` accept), and updates slot state. 3. Host builds the **C** inputs: commit mask/length, reseed positions, page-table/`v_posf` updates, `K` draft-input rows — roughly **9 separate H2D writes plus tilizes** per step (`MTP-BATCH.md:520-523`, §19a). 4. Host enqueues trace **C** (commit + reseed + K drafts). 5. With `QWEN36_MTP_OVERLAP=1` C is non-blocking, so vLLM's between-step work overlaps it — but the *next* cycle still begins with a host-built V. Traced command queues are **host-enqueued**; an X280 cannot replay a trace. So the design cannot be "X280 runs the step". It has to be **"the traces that are already captured become data-dependent on a small set of buffers the X280 writes"**. ## 4. Design ### 4.1 The key idea: make C m-agnostic instead of host-parametrised Today C is re-parametrised from the host each cycle. Instead, capture **one** C trace whose behaviour depends only on device-resident data: | Input | Today | After | |---|---|---| | accepted length `m` per row | host-computed Python int → several H2D writes and different code paths | **one `uint8[Bw]` in LIM/DRAM, written by X280** | | commit source state | host picks among `T` candidate state buffers | device gather with `m` as the index (data-dependent addressing, same program) | | reseed positions | host builds a position vector, H2D | X280 increments the existing device position vector in place | | draft row inputs | host fills `K` rows | unchanged shape; only the row *mask* is device data | | page-table pointers | host patched | unchanged per cycle; remapped only when the batch plan changes (rare, and still host) This is the whole lever. Everything else is plumbing. ### 4.2 Data flow per cycle ``` host, once per plan change: enqueue V; enqueue C' (m-agnostic); arm the limiter V runs on Tensix ──(last verify program)──► candidate ids/values → LIM of one cluster (Bw×T×4 B) X280 hart (polling LIM, no interrupt needed): 1. m[i] = compare-and-count accepted prefix per row (~µs) 2. write m[] into the commit mask buffer, positions[i] += m[i]+1 3. write the emitted token ids → slot state + D2H ring (async) 4. set the release flag that C' spins on C' runs on Tensix (commit over m rows, reseed, K drafts) host: reads the emitted ids off the D2H ring, returns them to vLLM; never blocks ``` No host work sits between V and C. `host + prep` collapses to "kick off the next cycle at the plan boundary". ### 4.3 Sizing — this is a LIM-sized problem | Object | Size | |---|---| | verify candidate ids/values, Bw=8 × T=4 (K=3) × 4 B | 128 B | | `m[]` | 8 B | | positions vector | 32 B | | token history for the slot map | ≤ 1 KiB | | total hot state | **< 2 KiB** | This is why this issue is the *flagship*: it needs essentially no memory bandwidth, only a placement change. It is the purest test of "latency, not throughput". ### 4.4 Host-visible change The host must stop being the accept authority but remain the **plan** authority: slot remap, preemption, batch composition, and the "fallback to plain decode" decision stay on the host, at plan boundaries. That keeps the vLLM accounting work (`LagBook`, async scheduler) unchanged — that machinery already exists for the async path (`docs/MTP-BATCH.md:537-554`). ## 5. Numeric targets and kill criteria | ID | Metric | Pre-registered target | |---|---|---| | **T2.1** | `host` + `prep` in the overlap-timing line, all six cells | **≤ 0.3 ms/cycle** (from 2.80–4.37) | | **T2.2** | `TG tok/s per user` B1/4k | **+5…9%** (38.77 → 35.5–36.8 ms cycle) | | **T2.3** | `TG tok/s per user` B8/32k | **+2…5%** | | **T2.4** | τ (tokens per row-step) | **unchanged** (accept rule identical) | | **T2.5** | outputs | **bit-identical to CONTROL** at every cell, all 1024 tokens | | **T2.6** | X280 hart time per cycle | ≤ 50 µs at Bw=8 (accept + patch + release) | | **K2.1** | if `host+prep` after two rounds is > 1.5 ms/cycle | **close** — the residual would be elsewhere | | **K2.2** | if the m-agnostic commit is not bit-exact in ttsim for every (T, Bw) cell | fall back to **bucketed C traces** (m ∈ {0,1,2,3} pre-baked); if that also fails, close | | **K2.3** | if T2.2 < 1% at G5 | close as INERT with a record | ## 6. Quality gates | Gate | What must pass | |---|---| | **G0** | `QWEN36_X280_MTP_ACCEPT=1`; banner; flag off = today's host accept, **byte-identical**; `ttx lint` 8/4/1; the arm lists the MUSTFAIL banner as `absent` | | **G1** | host tests: accept arithmetic for every `m ∈ [0..K+1]`, T=1..8, Bw=1..8; a **must-fail** case where `m` is off by one must be refused by the in-boot self-test | | **G2** | **ttsim, this is the real gate** — m-agnostic commit vs the current path, bitwise, at every (T, Bw, ctx, edge-page) cell; plus a flag-off regression `all_ok`. Trace replay itself cannot be proven in ttsim, so… | | **G3** | on-card: a traced replay of C' with each `m` planted by the X280, `token_ids_sha256` vs the current path; mailbox RTT under load | | **G4** | served boot; the warmup self-test runs its own wrong-input branch at every boot and refuses if it passes | | **G5** | `ttx` A/B ABBA n≥2 vs CONTROL `…-gpgob-dfr` (or its successor), B=1/4/8 × 4k/32k, `QWEN36_MTP_OVERLAP_TIMING=1` twin arm for the phase split | | **G6** | **tier 1** (bit-exact): `equiv` 8/8, GSM8K ≥ 59/60, retrieval 16/16 | | **G7** | CONTROL move, STATUS row, LEDGER entry, LEVERS row | ## 7. Work breakdown | Phase | Work | Exit | |---|---|---| | P1 | ttsim model of the m-agnostic commit (device gather on `m`) vs today, all cells | G2 | | P2 | The 1 KiB LIM protocol: layout, versioning, sequence numbers, timeout/fallback | G1 | | P3 | X280 accept + patch + release firmware; host-side "plan boundary only" refactor | G3 | | P4 | Remove the V→host→C round trip; keep `OVERLAP` for vLLM's between-step work | G4 | | P5 | Served A/B + timing twin | G5/G6 | | P6 | Ship | G7 | ## 8. Risks and traps 1. **The m-agnostic commit is a numerics change if done carelessly.** Gathering candidate state `m` is the same data the host selects today, so it is bit-exact *if* the gather reads the same fp32 values and the commit applies the same rounding. Prove it in ttsim before any card time. 2. **Traces bake addresses, not values.** Patching the mask/position buffers is safe only if those buffers were allocated **before** capture and never reallocated. This is the same constraint `mtp-state-slot` already solves for slot states. 3. **A hung/timed-out X280 must fall back.** Watchdog on the release flag: if it does not arrive in ~50 µs, the host takes today's path for that cycle. Never deadlock a served request on firmware. 4. **The resident chain is not MTP-aware** (`MTP-BATCH.md:105`, §12d). Do not try to fix that here; the win is the intra-step round trip. 5. **One NoC hop still has a cost.** X280 polls LIM; polling burns vector issue slots. Use a `wfi`-style spin on a LIM word with a bounded backoff, or have the Tensix epilogue do one atomic store to a flag the X280 watches (the X280 cannot be interrupted by NoC). 6. **`kvfold` refuses `T > 4`.** Any drafter work (DSpark, K≥7) needs that lifted first; out of scope here, but the m-agnostic commit should not make it harder. ## 9. Anti-goals - **Not** "run the whole step on X280". Traces stay host-enqueued; the X280 only decides and patches. - **Not** moving the drafter model itself (that is Tensix work). - **Not** changing the accept rule. Bit-exactness is the gate and the safety property. ## 10. Open questions - Q1: can the verify epilogue write `Bw×T` ids to LIM **without** a new trace capture? (It changes the program's output set → almost certainly a re-capture of the V trace. Budget it.) - Q2: does the C' trace's GDN commit support a device-side index into the `T` candidate states without a new kernel? If not, that is a small C++ op (int gather over state tiles), which is a real chunk of this issue's effort. - Q3: what does `QWEN36_MTP_EARLY_RESEED` do to the dependency order once the host no longer waits? (May become unnecessary — measure both.) ## 11. References - `bench/runs/reprofile-dfr-decode-20261015.jsonl` — the phase split this issue attacks. - `docs/MTP-BATCH.md` §3, §7.3, §12, §19a — the host phases, the async design, and why accept-on-device alone was inert. - `bench/runs/perf-loop-c152-device-accept-verdict-20261001T2000Z.jsonl` — the negative that defines this design. - `LEDGER R-2026-09-26-resident-async-flush`, `R-2026-10-03-so-t0`, `R-2026-10-03-gdc-cpk`. - `docs/analysis/lever-reeval-decode-gdn-attn-mtp-20261006.md` §2c — the lever table this issue replaces.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
bitpartner/tt-stack#305
No description provided.