Repository navigation
perf(nemotron cuda): the lone driver takes structured output - #779
Merged
ashhart merged 6 commits intoOct 13, 2026
Merged
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.
7 of 8 tasks
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 13, 2026
jschmied
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Oct 13, 2026
…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.
Owner
|
Thank you, @plotarmordev. Running the grammar the lane core already runs, through the same What we measured on a GB10 (sm_121), against the build without it:
|
Closed
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
The contributor's commit landed above with the same code, on top of ashhart#778's; this keeps the PR's head in the history with no change to the tree.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
On top of #778 (its commits come first here; this pull request adds the last one). Nemotron CUDA's lone driver takes a lone structured-output request (
response_format, ortool_choicerequired). A grammar stream opens with its masked first draw. Each round,Constraint.windowkeeps the planned chain's rows the grammar allows and grows it with the grammar's own drafts, aswindows.constraindoes for a lone stream. The window is then verified masked withEngine.verifyMasked, so replies are unchanged.cuda_drafts.zig:Rounds.verifytakes aGate: the chain as host ids, cut and grown, its rows masked.cuda_lone.zig: the masked opening, and the gate over the stream's grammar;Cuda.putBitsis public.engine_api.zigLone.structures,lane_host_lone.zigfits,native/cuda.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. libtfgrammar built byzig build grammarfrom xgrammar v0.2.8.Exactness:
json_object,json_schema, a strict enum schema, a required tool call, a schema with thinking on and a seededtemperature: 0.8schema reply have the sametoken_shaas 1.0.8 (3 each, 2 starts). 20 pairs of mixed structured, sampled and free requests, the second arriving 0, 0.3, 0.9 or 1.6 s later, all match. Drafted output equals"draft": falsefor each structured kind.Speed, medians over 2 starts:
json_object, same tokensjson_schema, same tokensThe schema reply now beats the free one through the grammar's own drafts.
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_checkas on 1.0.8.Not run, and why: Metal (unchanged). The NVFP4 checkpoint and RTX cards (no hardware here).
logprobswithresponse_formatis refused on 1.0.8 as here. Requests gated byCallGate(engines without structures) stay in the lane rounds.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.Constraint.window, and the masked window needs a GPU.)