Repository navigation
perf(nemotron cuda): the lone driver reclaims the lane rounds' last stream - #780
Conversation
It commits each round's kept rows as the lane core's windows read them (logprobRows on the window's logits) and opens the stream with the prompt's last row, so a lone logprobs request decodes on the lone driver's graphs and confidence depth rule.
…guards A stream with a budget past the driver's minimum or a loop guard decodes on the lone driver until a loop guard's close is pending or the budget's cut falls within the next round, then goes to the lane core, which forces the close as before.
A grammar stream opens with its masked first draw; each round the grammar keeps the planned chain's rows it allows, adds its own drafts after them and masks every row (Constraint.window, as windows.constrain does for a lone stream), and the window is verified masked.
…ream After a round with one live stream, no queue, fills or cancels, the host detaches it (Engine.detach drops its round state) and runs the lone driver resumed: the lane's sequence bound, the head begun again at its last draft's kept rows (Head.again rewrites the meta) and level 1 drafted again; a lane not settled stays in the lane core. Streams a forced close or budget cut is near stay.
…s served once each
|
Thank you, @plotarmordev. Giving the last live stream back to the lone driver means a reply that started beside another finishes on the fast path once it is alone. It landed in 1.0.9 under your name (
What we measured on a GB10 (sm_121), against the build without it:
On the M3 Ultra after our fix: concurrent == solo at 2 and 4 streams, greedy and sampled, three runs each, for Nemotron (a plain and a taught folder) and the 27B. In the 1.0.9 release gate, 2, 4 and 8 streams equalled their solo replies on a GB10 (MLX 4-bit and NVFP4), 4 at once did on an M5 Max with Nemotron, and the 27B's 2 and 4 at once did on an M3 Ultra. |
…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
On top of #779 (its commits come first here; this pull request adds the last two). Once the requests beside a stream finish and nothing else waits, Nemotron CUDA hands the lane rounds' last live stream back to its lone driver. Before, the stream stayed in the lane rounds to its end.
lane_host_lone.zigreclaim, after each round: one admitted job; no queue, fills, cancels or foreground wait; a stream the driver takes, with no forced close or budget cut near. The host detaches the stream and runs the driver resumed. A resumed stream keeps what it already delivered.lanes/engine.zigdetach: off the live list, its round state dropped, asadoptexpects it back.cuda_lanes.zigreclaim: the lane's sequence bound, and its last draft's kept rows. A lane with rows not yet committed stays in the lane rounds.cuda_drafts.zigRounds.resumedandcuda_mtp.zigHead.again: the head begun again at the same rows (its meta rewritten) and level 1 drafted again.engine_api.zigLoneHooks.resumed, throughnative/cuda.zigandcuda_native.zig.Receipt
Environment: DGX Spark (GB10), Nemotron 3.5 Lightning MLX-4bit @
d9d758fb, on 1.0.8 (0efbd447),--context 16384 --parallel 4. Every server start measured its own window-cost table (a fresh cache), arms alternated.Exactness: 42 replies equal 1.0.8's:
logprobspairs (greedy and seeded, 0 and 20 alternatives, the second request at 0, 0.3 or 1.0 s), thinking-budget pairs, structured pairs at four delays, and short-beside-long pairs greedy and seeded. Drafted output equals"draft": falsefor every request kind above.Speed, an 800-token reply started beside a 60-token one (2 starts, 3 trials each):
temperature: 0.8Greedy is about -5%, separated. Sampled is unchanged, and the short replies are unchanged.
The Grill, portable-v1 one-stream cell, 1.0.8 against this branch (all five changes): -0.18%, with its unchanged-deployment control at -0.13% (8/8 acquisitions each). No change beyond the capture drift, as expected for plain lone requests.
Tests run:
zig build test618/623 (5 skipped);test-cuda-host25/25 steps; server tests 155/155 and 98/98; goldens 309/319 with 0 unexpected differences;zig fmt;lean_checkas on 1.0.8.New test:
core/lane_host_lone_test.zig. A drafted stream handed to the lane rounds is reclaimed and resumed, with its tokens served once each, in order. A stream the driver does not take stays to its end. With the resumed delivery count reset it fails (expected 28, found 47).Not run, and why: Metal (unchanged). The NVFP4 checkpoint and RTX cards (no hardware here).
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.