Repository navigation
Nemotron CUDA: prompt passes of up to 4,096 rows between kept points - #720
Conversation
…prompt states 1.0.8 moved the prompt pass into cuda_prompt.zig, cuts chunks from where a pass starts and keeps states inside chunks; the wider chunk is now that pass's step outside lessons, dumps and crowded marks. 1.0.8's last_chunk replaces this branch's last_row.
|
Brought up to date with 1.0.8 ( Re-checked at this head on a GB10 (Nemotron 3.5 Lightning MLX-4bit), against a 1.0.8 build:
The CHANGELOG entry now carries these numbers. |
…o 4,096 rows (ashhart#720) The startup line said prompts ran in 2048-row chunks; serial passes now run up to 4,096 rows, and 2,048-row chunks stay for staggered segments, dumps and lessons. Comments only otherwise.
The contributor's commit landed above, carried onto 1.0.8's prompt code; this keeps the PR's head in the history with no change to the tree.
…st windows as measured
…akes runs 2,048 rows A 4,096-row pass can hold more prompt-cache marks than the scan arms at once (marks.max, 16), and a keep past that was refused as TooManyMarks, so its state was never kept. A pass now runs 4,096 rows only while fewer than marks.max marks fall strictly inside it; otherwise it runs 2,048, as ashhart#720's head resolves it on 1.0.8. Co-authored-by: plotarmordev <[email protected]>
…from their current heads
|
Thank you, @plotarmordev. Passes of up to 4,096 rows are a clean win for long prompts, and because a row's bits don't depend on where a pass is cut, the change was easy to check. It landed in 1.0.9 under your name ( Your merged head brought one thing ours lacked: a pass runs 4,096 rows only while fewer than 16 keep marks fall inside it, and 2,048 otherwise. Without it, a 17th mark inside a wide pass was refused ( What we measured on a GB10 (sm_121):
|
…s wrap at 120 columns
The prompt-cache change brought back the startup line's older "prompts in {d}-row chunks" over 1.0.9's "prompts
in passes of up to {d} rows" (#720); this restores 1.0.9's text. The rest wraps the lines the change wrote, with
the same values: Nemotron's cache rules, budget and warm turns are as before.
…o 4,096 rows (ashhart#720) The startup line said prompts ran in 2048-row chunks; serial passes now run up to 4,096 rows, and 2,048-row chunks stay for staggered segments, dumps and lessons. Comments only otherwise.
The contributor's commit landed above, carried onto 1.0.8's prompt code; this keeps the PR's head in the history with no change to the tree.
…st windows as measured
…akes runs 2,048 rows A 4,096-row pass can hold more prompt-cache marks than the scan arms at once (marks.max, 16), and a keep past that was refused as TooManyMarks, so its state was never kept. A pass now runs 4,096 rows only while fewer than marks.max marks fall strictly inside it; otherwise it runs 2,048, as ashhart#720's head resolves it on 1.0.8. Co-authored-by: plotarmordev <[email protected]>
…from their current heads
…s wrap at 120 columns
The prompt-cache change brought back the startup line's older "prompts in {d}-row chunks" over 1.0.9's "prompts
in passes of up to {d} rows" (ashhart#720); this restores 1.0.9's text. The rest wraps the lines the change wrote, with
the same values: Nemotron's cache rules, budget and warm turns are as before.
What this changes
Nemotron on CUDA runs a prompt in passes of up to 4,096 rows instead of 2,048: a serial pass joins grid chunks between the points the prompt cache keeps states at, so each pass reads the routed experts' weights once for twice the rows. Resume points, kept states and every reply's bits are unchanged.
cuda_engine.zigserialChunks: grid chunks join up tostate.pass_rows(2 xprefill_rows), cutting only at a keep (kept). No joining under--dump, attached lessons or a decision row; staggered segments keep the 2,048-row grid.cuda_state.zig:pass_rows, and the prompt scratch sized for it;cuda_mtp.zigand the pinned prompt ids follow.Engine.last_rowreplaces(len - 1) % prefill_rowswhere the last chunk's hidden row is read (cuda_lanes.zig,cuda_decode.zig,cli/cuda_segments.zig,tests/cuda/tree_accept.zig).Receipt
Environment: two DGX Sparks (GB10, sm_121, driver 580.173.02, CUDA 13),
TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit@d9d758fb, this branch one7c523ebbuilt withzig build native -Dnvcc=… -Dsm=121, built-in kernels,--context 16384 --parallel 4.Exactness:
e7c523eb: 6 replies (a short prompt, a code prompt and an ~11,500-token prompt, each drafted and"draft": false, 96 tokens) in each of four sessions (two per build):token_shaand the 20-alternative logprob rows identical.cached_tokensidentical (the second turn resumed 4,096 tokens in both); concurrent equals solo;tensorfold segmentsdigests (state, head, logits, hidden) equal across 1 to 4 segments and equal to stock;tf-cuda-test tree-acceptJSON byte-identical to stock.Prompt speed (tok/s, medians of 3 prompts in each of two sessions per build, sessions ordered A B B A):
e7c523ebOn 1.0.6, The Grill 0.6.0's
prefill-prose-portable-selection-v1(baseline, change, unchanged control;--context 65536 --parallel 2): makespan -8.1% at 4k, -3.9% at 8k, -5.4% at 16k, -5.1% at 32k, each separated from both baselines, control flat. Prompts of repository text on the second Spark: +6.5% to +16.4%. The Grill'ssparkdash-prefill(a repeated unit, few experts routed): no change.Decode speed: unchanged (The Grill's
portable-v1, order swapped: no effect).Memory: the prompt workspace takes 0.47 GiB more (18.46 GiB against 17.99 at startup).
Tests run:
zig build test39/39 steps, 451/451 tests;zig build test-cuda-host24/24 steps; the server tests 127/127 and 104/104 (zig/tests/server/zig_test.sh); the frozen server goldens 309 of 319 equal, 0 unexpected differences, as onmain;zig fmt --checkclean on the changed files;lean_check.py534 problems, as onmain. GPU:tf-cuda-testglue 100/100, sample 2880/2880, symbols, andtree-acceptbyte-identical to stock (on 1.0.6, same change).Not run, and why: Metal (unchanged). The NVFP4 checkpoint, RTX cards (no hardware here).
This touches
serialChunksas the prompt-cache pull requests (#721 to #723) do; whichever lands second needs a small merge there.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.