watch/lift: tt-metal#56759 GDN prefill AGMM column-parallel out-proj #41

Open
opened 2026-09-19 15:34:19 +02:00 by tenstorrent · 4 comments
Member

Goal

Evaluate #56759 AGMM GDN prefill out-proj for TP=2 / 2× p150a DRAM budget.

Context

  • OPEN draft; measured on TP=4 / 4× p300c (not p150a): TTFT improvements growing with CTX (e.g. −4.41 s @256k in PR text) with +285 MiB net DRAM/device tradeoff.
  • Env flag class: QWEN36_GDN_OUT_COLPAR.
  • Do not bank P300c TTFT deltas on our topology.

Acceptance

  • Absorb only when metal pin has it (or patch)
  • A/B on TP=2 with DRAM high-water recorded
  • Ship/hold with evidence

Refs

## Goal Evaluate **#56759** AGMM GDN prefill out-proj for TP=2 / 2× p150a DRAM budget. ## Context - OPEN draft; measured on **TP=4 / 4× p300c** (not p150a): TTFT improvements growing with CTX (e.g. −4.41 s @256k in PR text) with **+285 MiB** net DRAM/device tradeoff. - Env flag class: `QWEN36_GDN_OUT_COLPAR`. - Do **not** bank P300c TTFT deltas on our topology. ## Acceptance - [ ] Absorb only when metal pin has it (or patch) - [ ] A/B on TP=2 with DRAM high-water recorded - [ ] Ship/hold with evidence ## Refs - https://github.com/tenstorrent/tt-metal/pull/56759
Owner

Architecture assessment as of 2026-09-19:

  • Upstream status: tt-metal#56759 (gdnopt/agent1) is an OPEN draft.
  • TP=2 DRAM Budget Risk:
    • The PR duplicates out_proj in column-sharded format across all 48 GDN layers for prefill while decode keeps the row-sharded copy.
    • At TP=4 (PR text), this was [6144, 1280] = +382 MiB/device (+285 MiB net).
    • At TP=2 (our 2x p150a setup), each device holds 2560 output columns: [6144, 2560] bfp8 x 48 layers = ~764 MiB/device additional weight memory.
    • On our target shapes (8x128k / 4x256k bf8 KV = 16 GiB/device KV + 12.55 GiB/device weights + 1 GiB trace = ~29.5 GiB / 30.8 GiB usable), +764 MiB consumes ~59% of the remaining margin.
  • Status: Kept in WATCH state until upstream stabilizes; when tested, DRAM high-water must be verified against target-shape allocations.
Architecture assessment as of 2026-09-19: - **Upstream status**: `tt-metal#56759` (`gdnopt/agent1`) is an OPEN draft. - **TP=2 DRAM Budget Risk**: - The PR duplicates `out_proj` in column-sharded format across all 48 GDN layers for prefill while decode keeps the row-sharded copy. - At TP=4 (PR text), this was `[6144, 1280]` = +382 MiB/device (+285 MiB net). - At TP=2 (our 2x p150a setup), each device holds 2560 output columns: `[6144, 2560]` bfp8 x 48 layers = **~764 MiB/device** additional weight memory. - On our target shapes (8x128k / 4x256k bf8 KV = 16 GiB/device KV + 12.55 GiB/device weights + 1 GiB trace = ~29.5 GiB / 30.8 GiB usable), +764 MiB consumes ~59% of the remaining margin. - **Status**: Kept in WATCH state until upstream stabilizes; when tested, DRAM high-water must be verified against target-shape allocations.
Member

Audited and resolved/documented in PR #44 (commits 15a2ed6..65c5cba). Tagged @hermes for review.

Audited and resolved/documented in PR #44 (commits `15a2ed6`..`65c5cba`). Tagged @hermes for review.
Owner

Performance advisory (automated review, 2026-09-24)

Two additions to the DRAM assessment above.

  1. A local alternative targets the same op without duplicating weights. The out-proj this PR re-shards is docs/PREFILL-AUDIT-2026-09-12.md §3 item 2. It is the worst prefill matmul we have: the GDN out-proj MMRS runs at 33 TFLOP/s on an 8×6 grid with 1×1 subblocks, 1.928 ms vs 0.443 ms standalone, ~71 ms per 2048-chunk (12%). The cause is _mmrs_prefill_placement capping the matmul at 48 cores so the RS workers have rows (tp_common.py:527), not the row-parallel layout itself. Widening to 11 columns with the RS workers on the bottom rows, or unfusing (full-grid matmul, then a separate RS), costs 0 MiB. The ~764 MiB/device of #56759 is DRAM the prefix arm needs: its pool is already 1,017,275 tokens (97% of the 1,048,576 target) with the trace region competing (bench/runs/prefix-traced-dram-oom-20260918T1540Z.jsonl). Try the local reshape first, and keep #56759 as the fallback if the in-model A/B shows the fused MMRS itself is the limiter.
  2. Discount both routes before banking anything. The same audit measured a probe-level −9% prefill matmul fix delivering 0–2% slower in-model (§4). The P300c TP=4 TTFT deltas in the PR are third-party for our topology, as the issue already says. Gain at target shapes is also smaller than at 16k: matmul time per chunk stays flat while chunk time grows (3,534 → 2,366 → 1,707 tok/s at 16k/128k/256k). So 71 ms/chunk is ≤12% at 16k and ~5–6% at 256k (upper bound, ESTIMATE).

Cheapest validation: one in-model profiled 2048-chunk (see #55: the profiler probably only needs TTNN_OP_PROFILER=1) to confirm the out-proj's in-model share. Then run an interleaved A/B on bench/ab/sweep-32k.sh (makespan/TTFT), with greedy sha-identity and the DRAM high-water mark recorded.

**Performance advisory (automated review, 2026-09-24)** Two additions to the DRAM assessment above. 1. **A local alternative targets the same op without duplicating weights.** The out-proj this PR re-shards is `docs/PREFILL-AUDIT-2026-09-12.md` §3 item 2. It is the worst prefill matmul we have: the GDN out-proj MMRS runs at **33 TFLOP/s** on an 8×6 grid with 1×1 subblocks, 1.928 ms vs 0.443 ms standalone, **~71 ms per 2048-chunk (12%)**. The cause is `_mmrs_prefill_placement` capping the matmul at 48 cores so the RS workers have rows (`tp_common.py:527`), not the row-parallel layout itself. Widening to 11 columns with the RS workers on the bottom rows, or unfusing (full-grid matmul, then a separate RS), costs **0 MiB**. The ~764 MiB/device of #56759 is DRAM the prefix arm needs: its pool is already 1,017,275 tokens (97% of the 1,048,576 target) with the trace region competing (`bench/runs/prefix-traced-dram-oom-20260918T1540Z.jsonl`). **Try the local reshape first**, and keep #56759 as the fallback if the in-model A/B shows the fused MMRS itself is the limiter. 2. **Discount both routes before banking anything.** The same audit measured a probe-level −9% prefill matmul fix delivering 0–2% *slower* in-model (§4). The P300c TP=4 TTFT deltas in the PR are **third-party** for our topology, as the issue already says. Gain at target shapes is also smaller than at 16k: matmul time per chunk stays flat while chunk time grows (3,534 → 2,366 → 1,707 tok/s at 16k/128k/256k). So 71 ms/chunk is ≤12% at 16k and ~5–6% at 256k (upper bound, ESTIMATE). **Cheapest validation:** one in-model profiled 2048-chunk (see #55: the profiler probably only needs `TTNN_OP_PROFILER=1`) to confirm the out-proj's in-model share. Then run an interleaved A/B on `bench/ab/sweep-32k.sh` (makespan/TTFT), with greedy sha-identity and the DRAM high-water mark recorded.
Owner

Ported upstream PR #57377 (column-parallel GDN prefill out-proj via AGMM) behind QWEN36_GDN_OUTPROJ_COLPAR=1 on branch agy/issue-64; see detailed research note on #64.

Ported upstream PR #57377 (column-parallel GDN prefill out-proj via AGMM) behind QWEN36_GDN_OUTPROJ_COLPAR=1 on branch agy/issue-64; see detailed research note on #64.
Sign in to join this conversation.
No labels
human-approved
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.

Dependencies

No dependencies set

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