watch/lift: selective metal from tt-metal#56119 (do NOT wholesale cherry-pick) #38
Labels
No labels
human-approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitpartner/tt-stack#38
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Track and selectively steal env-gated pieces from tt-metal#56119 (
qwen36-prefill-opt) for 2× p150a — not a wholesale merge.Context
mergeable_state=dirty, stale (~9d as of 2026-09-19).gdn_decode_step,QWEN_SDPA_BF8=1, serving GDN state sync.Acceptance for any lift from this PR
Non-goals
Merging the whole PR onto our pin.
Refs
Analysis and inventory of #56119 for 2x p150a TP=2:
Breakdown of #56119 (qwen36-prefill-opt, 8.6k LOC draft):
Already implemented & active locally in tt-stack:
QWEN_SDPA_BF8=1: Cleared (Gate A) and active in production.QWEN_GDN_FUSED_DECODE=1,QWEN_GDN_PACKED_QKV=1(decode_gated_delta_rule_packed),QWEN_GDN_CONV_GATES=1, andQWEN_GDN_FUSED_INPLACE=1(delivers 19.8 tok/s @ B=1 vs upstream 18.8 tok/s).QWEN36_SDPA_STREAMING=1(Patch 0020, PR #44).Explicit Skip List (P300X2 / 1x4 mesh / TP=4 specific):
TT_SDPA_GQA_MCAST_QPAIR=1,TT_GDN_SCAN_MCAST=1: hardcoded for 4-chip multicast patterns; invalid on 1x2 TP=2 mesh.QWEN36_AGMM_LAYOUT=nt11x8: specific grid tiling for 4-chip layout.Watch / Potential Future Lift:
QWEN36_GDN_OUT_MODE=agmm: Tracked separately under Issue #41 (hazard: +764 MiB/device on TP=2).QWEN36_PREFILL_LOGITS_FAST=1andQWEN36_PREFILL_BUCKET_TRACE=1: Candidate flags to inspect for host dispatch reduction during dedicated prefill optimization pass.Issue remains open as a selective watch tracker; wholesale merge remains strictly rejected.
Audited and resolved/documented in PR #44 (commits
15a2ed6..65c5cba). Tagged @hermes for review.Performance advisory (automated review, 2026-09-24)
Priority guidance for the watch list, ranked by makespan/TTFT effect on our workload. Upstream numbers are all third-party P300X2 TP=4.
QWEN36_PREFILL_BUCKET_TRACE=1first. It is the only item here on today's hot path. With prefix caching, every cache hit's uncached suffix under 2048 tokens runs through the eagerprefill_masked_bucket(model.py:2586-2614). A measured warm hit computes 1,579 tokens in 1.94 s (bench/runs/phase2a-prefix-e2e.jsonl), and at conc-8 those tails are 37% of makespan. See #50 for the plan and the correctness traps: GDN padding through the recurrence must be masked, and nothing may compile after the traces are parked. Lift the mechanism, not the flag name, and gate it on greedy sha-identity on warm hits.QWEN36_GDN_OUT_MODE=agmm(#41): compare it against the zero-DRAM local option first. Widen or unfuse the 33 TFLOP/s MMRS out-proj (docs/PREFILL-AUDIT-2026-09-12.md§3 item 2, ~71 ms/chunk). See my comment on #41.QWEN36_PREFILL_LOGITS_FAST=1: probably low value. Prefill logits are one row per request, so the benefit is host-side and small next to the eager tail. Check its mechanism before spending a boot.Discipline for any lift:
docs/PREFILL-AUDIT-2026-09-12.md§4 measured a probe-level −9% prefill fix delivering 0–2% slower in-model. Every lift therefore needs an interleaved in-model A/B onbench/ab/sweep-32k.sh(makespan/TTFT), never a transferred speedup factor.agy research (2026-09-24)
1. Findings: Upstream tt-metal#56119 Hunk Inventory (73 files, 207 hunks)
Audited via GitHub compare API against pinned base (
60053f1fb4a, 103 commits ahead of PR base):nt11x8grid. Hardcoded for 1×4 mesh; deadlocks on 1×2 TP=2 or adds +764 MiB DRAM/card (#41). Strict Skip.gdn_decode_step/ KDA decode. Conflicts with local K1/K2 packed fused decode (19.8 tok/s @ B=1 vs upstream 18.8 tok/s). Strict Skip.BENCHMARKS.md.QWEN_SDPA_BF8=1(Gate A cleared, in prod via Patch 0016).QWEN36_PREFILL_BUCKET_TRACE, feeds #50): Eliminates ~420 ms host dispatch floor (151 hostfrom_torchcalls) on uncached suffix prefills under prefix caching (37% of conc-8 makespan).QWEN36_PREFILL_LOGITS_FAST=1): Device untilize + read dev 0 (0.5 MB vs 64 MB mesh gather).QWEN36_PREFILL_TIMING=1): Wall-clock phase triage.QWEN36_CCL_AG_SEM_POOL): Low effort, needs in-model A/B.qkv_causal_conv1d_silu): High effort, deferred to base C++ rebuild.2. Changes Landed on
agy/issue-38(Commit87c2670)docs/LIFT-AUDIT-TT-METAL-56119.md: Complete 207-hunk inventory, classification table, and lift plan.scripts/audit-pr56119-inventory.py: Reproducible CLI audit script with--markdownoutput..claude/skills/pr-hunk-inventory/SKILL.md: Procedure skill doc for PR hunk audits.patches/prod-local-metal/.../masked_bucket_trace.py: Pure-torch host builders for persistent buffers.bench/fixtures/fixtures-masked-bucket-trace-test.py: Standalone offline fixture test (5/5 suites PASS).3. Next Hardware Measurement
python3 bench/prefix_hit_equivalence.pyEXTRA_ENV="QWEN36_PREFILL_BUCKET_TRACE=128" bash bench/ab/sweep-32k.sh4. Open Questions
QWEN36_PREFILL_BUCKET_TRACE=128first.