Repository navigation
Nemotron CUDA: a shared round's MTP heads draft every stream in one batch - #768
Conversation
Each head level runs one forward with a row per stream still drafting (Head.chains), where each stream's head ran its levels one row at a time; a lone drafting stream keeps its captured levels. Drafts and confidences equal the one-at-a-time ones to the bit, greedy and sampled.
The contributor's pricing commit landed above with the same code, on top of ashhart#768's; this keeps the PR's head, which also holds ashhart#768's, in the history with no change to the tree.
…ed band missed 5.5% and 11.8%)
…date The contributor's two commits landed above, on top of ashhart#779's. On the candidate a shared round's heads draft in one batch (ashhart#768), so the kept rows are recorded after the one-stream h.chain as in the PR and for a batched head in our commit after it; and only a lone driver that resumes a stream is given one back, in another of ours, since the Mac's drivers open every stream they are given. This keeps the PR's head in the history with no change to the tree.
|
Thank you, @plotarmordev. Drafting a shared round's streams in one head batch is the largest multi-stream win in this set, and it holds up exactly. It landed in 1.0.9 under your name ( One gate failed, and the fix is in our commit after yours ( What we measured on a GB10 (sm_121):
|
…date The contributor's commit landed above, its pinned head buffer sized from the candidate's 4,096-row prompt passes; this keeps the PR's head in the history with no change to the tree.
The contributor's pricing commit landed above with the same code, on top of ashhart#768's; this keeps the PR's head, which also holds ashhart#768's, in the history with no change to the tree.
…ed band missed 5.5% and 11.8%)
…date The contributor's two commits landed above, on top of ashhart#779's. On the candidate a shared round's heads draft in one batch (ashhart#768), so the kept rows are recorded after the one-stream h.chain as in the PR and for a batched head in our commit after it; and only a lone driver that resumes a stream is given one back, in another of ours, since the Mac's drivers open every stream they are given. This keeps the PR's head in the history with no change to the tree.
What this changes
Nemotron on CUDA drafts every stream of a shared round in one batch: each MTP head level runs one forward with a row per stream still drafting, where each stream's head ran its levels one row at a time. A lone drafting stream keeps its captured levels.
cuda_mtp.zig:Head.chains. Each stream does attention over its own head caches and its own meta row; the dense layers, experts and draft head are shared.forwardandsampletake spans and explicit buffers, and the one-stream path issues the same calls as before.cuda_lanes.zig:draftFnbatches two or more drafting streams, andfacts()setsdraft_streams.Receipt
Environment: DGX Spark (GB10), Nemotron 3.5 Lightning MLX-4bit @
d9d758fb, on 1.0.8 (0efbd447),--context 16384 --parallel 8, 400-token replies, a distinct prompt per stream.Exactness: a check build ran each round's drafts both ways (one stream at a time, then batched) and compared the device outputs. Over 2,472 rounds and 25,051 draft levels, greedy and sampled at t=0.7, 0 draft ids and 0 confidences differed. Replies have the same
token_shaas 1.0.8 at 2, 4 and 8 streams, greedy, and at 2 and 8 streams sampled with a seed.Speed, makespan over 8 trials an arm:
On 1.0.7 the same gave -5.0%, -7.3% and -10.5%. On The Grill's concurrency ladder (1.0.7) the 4-stream cell ran -16.3%, separated, with its A2 control flat. Its ladder sends one prompt to every lane, so its 2- and 8-stream medians are mixtures of lanes in step and lanes out of step. Per mode, 8 streams ran -12% and -10%. A lone stream is unchanged.
Tests run:
zig build test616/621 (5 skipped);test-cuda-host25/25 steps; server tests 155/155 and 96/96; goldens 309/319 with 0 unexpected differences;zig fmt;lean_checkone problem fewer than 1.0.8.Not run, and why: Metal (unchanged). GLM, the other
draft_streamsfamily, has its own head and is untouched. There is no permanent GPU test for batched against one-at-a-time drafts: the check build was diagnostic, and the repo's GPU tests do not open a model with an MTP head on a shared round.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.