prefill: adaptive chunk/shape policy (amd-qwen shaped; not RDNA microkernels) #135

Closed
opened 2026-09-30 09:08:35 +02:00 by tenstorrent · 3 comments
Member

Parent / blocked-by tracking via #90 (amd-qwen / tinygrad borrow-adapt lane).

Grill call: WATCH (desk-only until metal/vllm-tt port path is clear)

Hypothesis. An adaptive prefill chunk/shape policy that reacts to load/context (queue depth, prompt length, remaining KV) can cut TTFT / makespan variance on agent workloads without borrowing RDNA-specific microkernels. The AMD idea is the policy, not the kernels.

Source. tinygrad / jacobrosenthal amd-qwen-on-master (AMD ROCm Qwen3.8). External — not TT silicon claims.

Depends on. Existing prefill levers (#97 colpar A/B; AGMM / row-RS work); serving path that can expose load/context signals to a policy hook.

Measure first. Desk simulation: replay recorded prompt-length × concurrency traces; compare fixed chunk vs adaptive policy on predicted TTFT / KV pressure. No device until the sim shows a clear regime where adaptive wins.

Out of scope. RDNA micro-opts; inventing new TT SDPA kernels; changing default prod flags before measure.

Refs: #90; related #97 prefill colpar; grill 2026-09-29/30 Tenstorrent amd-qwen eval.

Parent / blocked-by tracking via #90 (amd-qwen / tinygrad borrow-adapt lane). ## Grill call: **WATCH** (desk-only until metal/vllm-tt port path is clear) **Hypothesis.** An adaptive prefill chunk/shape policy that reacts to load/context (queue depth, prompt length, remaining KV) can cut TTFT / makespan variance on agent workloads without borrowing RDNA-specific microkernels. The AMD idea is the *policy*, not the kernels. **Source.** tinygrad / jacobrosenthal amd-qwen-on-master (AMD ROCm Qwen3.8). External — not TT silicon claims. **Depends on.** Existing prefill levers (#97 colpar A/B; AGMM / row-RS work); serving path that can expose load/context signals to a policy hook. **Measure first.** Desk simulation: replay recorded prompt-length × concurrency traces; compare fixed chunk vs adaptive policy on predicted TTFT / KV pressure. No device until the sim shows a clear regime where adaptive wins. **Out of scope.** RDNA micro-opts; inventing new TT SDPA kernels; changing default prod flags before measure. Refs: #90; related #97 prefill colpar; grill 2026-09-29/30 Tenstorrent amd-qwen eval.
Owner

Eval (2026-09-30): WATCH → PARK. Full write-up: docs/ISSUES-133-137-EVAL-2026-09-30.md.

  • The policy cannot move our ranked metric. In the closed B4/B8 bench, makespan ≥ Σprefill + 1024·t_dec(last). The p4 sim reproduces c110 within 0.3% and puts interleave at neutral to +4% (est).
  • The shape half has shipped: masked-bucket traces 128-2048 give −2.6% B8/32k and −6.3% B8/4k (LEDGER R-2026-09-30-tail, bench/runs/perf-loop-c121b-nhp-tail-verdict-20260930T0430Z.jsonl).
  • The chunk half is chunk 4096, parked at est −3…+3% for ~10 h (desk study 5b6e9b8, branch agmm-silu):
    • QWEN36_PREFILL_CHUNK is read only by text_demo; the served path pins 2048 at 5 sites.
    • The SDPA GQA multicast refuses S=4096 without a pair-mode fix.
    • It is incompatible with the prefix arm.
  • Mechanics: each chunk size needs its own trace (~48 MiB; the 1 GiB region already holds ~522 MiB). Non-prefix served arms run enable_chunked_prefill=False, so there is no hook for a policy.
  • Cheapest experiment (0 card-h, ~2 h): extend p4 sim.py with a per-length chunk cost, using bench/runs/c117-prefill-tail-phases-20260929T231714Z.jsonl and ~316 ms per 2048 chunk. Kill if the gain is under 1% at B4/B8 32k. Otherwise run the chunk-4096 workbench screen (1.5 card-h) and go to a served run only at ≥2% wb wall at both 16k and 30k.
  • Priority: below the whole queue. If the owner makes TTFT under arrivals a metric, p4 lever B (one prefill per step, BIT_EXACT, 2-3 h) comes first.

🤖 Generated with Claude Code

**Eval (2026-09-30): WATCH → PARK.** Full write-up: `docs/ISSUES-133-137-EVAL-2026-09-30.md`. - **The policy cannot move our ranked metric.** In the closed B4/B8 bench, makespan ≥ Σprefill + 1024·t_dec(last). The p4 sim reproduces c110 within 0.3% and puts interleave at neutral to +4% (est). - **The shape half has shipped:** masked-bucket traces 128-2048 give −2.6% B8/32k and −6.3% B8/4k (LEDGER `R-2026-09-30-tail`, `bench/runs/perf-loop-c121b-nhp-tail-verdict-20260930T0430Z.jsonl`). - **The chunk half is chunk 4096, parked** at est −3…+3% for ~10 h (desk study 5b6e9b8, branch `agmm-silu`): - `QWEN36_PREFILL_CHUNK` is read only by text_demo; the served path pins 2048 at 5 sites. - The SDPA GQA multicast refuses S=4096 without a pair-mode fix. - It is incompatible with the prefix arm. - **Mechanics:** each chunk size needs its own trace (~48 MiB; the 1 GiB region already holds ~522 MiB). Non-prefix served arms run `enable_chunked_prefill=False`, so there is no hook for a policy. - **Cheapest experiment (0 card-h, ~2 h):** extend p4 `sim.py` with a per-length chunk cost, using `bench/runs/c117-prefill-tail-phases-20260929T231714Z.jsonl` and ~316 ms per 2048 chunk. Kill if the gain is under 1% at B4/B8 32k. Otherwise run the chunk-4096 workbench screen (1.5 card-h) and go to a served run only at ≥2% wb wall at both 16k and 30k. - **Priority:** below the whole queue. If the owner makes TTFT under arrivals a metric, p4 lever B (one prefill per step, BIT_EXACT, 2-3 h) comes first. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Member

Dead: chunk-2304 measured a LOSS via MTP acceptance (PR #179; owner 2026-10-09 quote in-issue), and the p4 desk study shows adaptive interleave cannot move makespan at the pinned 2048-token chunk; reopen only if the owner makes TTFT-under-arrivals a ranked metric. Verified 2026-11-18.

Dead: chunk-2304 measured a LOSS via MTP acceptance (PR #179; owner 2026-10-09 quote in-issue), and the p4 desk study shows adaptive interleave cannot move makespan at the pinned 2048-token chunk; reopen only if the owner makes TTFT-under-arrivals a ranked metric. Verified 2026-11-18.
Owner

agent-gateway closeout (closed): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (closed): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
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#135
No description provided.