prefill: tune and overlap the row-parallel reduce-scatter (128/chunk, 2 workers today) #108

Open
opened 2026-09-27 16:55:48 +02:00 by Grok · 4 comments
Owner

Desk research 2026-09-27 (no hardware, no new speed number). Note: docs/notes/sram-model-split-2026-09-27.md (branch serving-throughput). Related: #50, #51, #97.

Problem

Prefill 16k per chip (c67): fused AG+matmul 26.8%, row-parallel matmul 11.1%, CCL line reduction 10.0%. The prefill reduce-scatter runs 128×/chunk (2 per layer), ~1.34 GB/card/chunk at ~30 GB/s, configured with 2 workers / 2 buffers.

Levers (estimate)

  1. Reduce-scatter settings (workers, buffers per channel, links): −10…−20 ms per 2048-token chunk (~563 ms today). Bit-exact.
  2. Overlap reduce-scatter with its row-parallel matmul by splitting the matmul into row blocks, reduce-scatter on a separate core set: −20…−35 ms per chunk. Bit-exact.

First probe

Two-card probe sweeping the reduce-scatter config on the prefill row-parallel shapes (needs ccl.py in the overlay), then workbench prefill profile; then #2.

Rejected in the same review: chunk 4096 (batching two 16k prefills 10.4 s vs 5.25 s, PREFILL-KERNEL-DEEPDIVE §3); freeing prefill L1 for bigger blocks (≤0.3%, tp_common.py:64-67); splitting prefill GDN scan across cores (done in 0025).

Desk research 2026-09-27 (no hardware, no new speed number). Note: `docs/notes/sram-model-split-2026-09-27.md` (branch `serving-throughput`). Related: #50, #51, #97. ## Problem Prefill 16k per chip (c67): fused AG+matmul 26.8%, row-parallel matmul 11.1%, CCL line reduction 10.0%. The prefill reduce-scatter runs 128×/chunk (2 per layer), ~1.34 GB/card/chunk at ~30 GB/s, configured with 2 workers / 2 buffers. ## Levers (estimate) 1. Reduce-scatter settings (workers, buffers per channel, links): −10…−20 ms per 2048-token chunk (~563 ms today). Bit-exact. 2. Overlap reduce-scatter with its row-parallel matmul by splitting the matmul into row blocks, reduce-scatter on a separate core set: −20…−35 ms per chunk. Bit-exact. ## First probe Two-card probe sweeping the reduce-scatter config on the prefill row-parallel shapes (needs `ccl.py` in the overlay), then workbench prefill profile; then #2. Rejected in the same review: chunk 4096 (batching two 16k prefills 10.4 s vs 5.25 s, PREFILL-KERNEL-DEEPDIVE §3); freeing prefill L1 for bigger blocks (≤0.3%, `tp_common.py:64-67`); splitting prefill GDN scan across cores (done in 0025).
Author
Owner

Runbook: https://git.bitp.cz/donach/tt-stack/src/branch/serving-throughput/docs/runbooks/108-prefill-rs.md. Lever 1 in flight: probe bench/probes/prefill_rs/rs_sweep.py (mesh; links x workers x buffers x chunks, traced, torch.equal vs prod config) queued in bench/queues/c68-mrx-then-mtp.txt after bundle H; serving knob QWEN36_PREFILL_RS_CFG=links,chunks,workers,buffers coded on branch prefill-rs-cfg (492fcbf). Drill: links are already 2 (P300 link_dict (2,2) even for cluster_axis=0); buffers are hard-coded 2 in tt_all_reduce. c67: ~355 us per RS ~ 28 GB/s per direction. Lever 2 (M-blocked matmul + RS on a CCL sub-device) is new; staged after lever 1.

Runbook: https://git.bitp.cz/donach/tt-stack/src/branch/serving-throughput/docs/runbooks/108-prefill-rs.md. Lever 1 in flight: probe bench/probes/prefill_rs/rs_sweep.py (mesh; links x workers x buffers x chunks, traced, torch.equal vs prod config) queued in bench/queues/c68-mrx-then-mtp.txt after bundle H; serving knob QWEN36_PREFILL_RS_CFG=links,chunks,workers,buffers coded on branch prefill-rs-cfg (492fcbf). Drill: links are already 2 (P300 link_dict (2,2) even for cluster_axis=0); buffers are hard-coded 2 in tt_all_reduce. c67: ~355 us per RS ~ 28 GB/s per direction. Lever 2 (M-blocked matmul + RS on a CCL sub-device) is new; staged after lever 1.
Author
Owner

Lever 1 (RS config) is killed (c69 T7). Mesh sweep, [1,1,2048,5120] bf16, 144 configs: production (2,2,2,10) runs 303 µs; the best (workers=4, buffers 2 or 4, chunks=10) runs 285 µs, −6%, under the 10% bar. All configs are bit-exact. Records: bench/runs/prefill-rs-sweep-20260927T152810Z.jsonl, bench/runs/perf-loop-c69-rs-cfg-verdict-20260927T1531Z.jsonl. Lever 2 (RS overlapped with its matmul via sub-devices) is still open; runbook docs/runbooks/108-prefill-rs.md.

Lever 1 (RS config) is **killed** (c69 T7). Mesh sweep, [1,1,2048,5120] bf16, 144 configs: production (2,2,2,10) runs 303 µs; the best (workers=4, buffers 2 or 4, chunks=10) runs 285 µs, **−6%**, under the 10% bar. All configs are bit-exact. Records: `bench/runs/prefill-rs-sweep-20260927T152810Z.jsonl`, `bench/runs/perf-loop-c69-rs-cfg-verdict-20260927T1531Z.jsonl`. Lever 2 (RS overlapped with its matmul via sub-devices) is still open; runbook `docs/runbooks/108-prefill-rs.md`.
Author
Owner

Lever 1 served result: QWEN36_PREFILL_RS_CFG=2,10,4,2 inside the c70 bundle leaves TTFT flat (B=8 32k TTFT max 64.71→64.35 s, within noise). Confirms the op-level kill: RS is not bound by its pipeline knobs. LOO queued. Next here: lever 2 (overlap).

Lever 1 served result: QWEN36_PREFILL_RS_CFG=2,10,4,2 inside the c70 bundle leaves TTFT flat (B=8 32k TTFT max 64.71→64.35 s, within noise). Confirms the op-level kill: RS is not bound by its pipeline knobs. LOO queued. Next here: lever 2 (overlap).
Member

Do not re-sweep reduce-scatter workers or buffers. Lever 1 is killed (c69, best −6%, under the 10% bar; served TTFT was flat in c70). Next is lever 2 only, as written in docs/runbooks/108-prefill-rs.md on master: overlap the row-parallel reduce-scatter with its matmul. Pass: B=4 and B=8 wall or TTFT outside the current BEST band, and bit-exact. Fail: inside the band. No decode work.

Do not re-sweep reduce-scatter workers or buffers. Lever 1 is killed (c69, best −6%, under the 10% bar; served TTFT was flat in c70). Next is lever 2 only, as written in docs/runbooks/108-prefill-rs.md on master: overlap the row-parallel reduce-scatter with its matmul. Pass: B=4 and B=8 wall or TTFT outside the current BEST band, and bit-exact. Fail: inside the band. No decode work.
Sign in to join this conversation.
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#108
No description provided.