Repository navigation
Nemotron CUDA: decode glue keeps its loads in flight, same values and order - #771
Conversation
…es and order tf_nemo_add_moe_norm loads a row's slot weights and values before summing them; tf_nemo_scan loads every step's B, C, x, gate and dt into shared memory before its serial steps; an attention window of several rows runs tf_nemo_attn_chunk_pf, which loads its next key tile into registers while it computes the current one. Every sum keeps its order: tf-cuda-test glue stays byte-equal to the host references.
|
Thank you, @plotarmordev. Keeping the loads in flight while every sum keeps its order is the kind of win that's easy to trust, and it shows up on a lone stream, where most people decode. It landed in 1.0.9 under your name ( What we measured on a GB10 (sm_121), MLX 4-bit, base and tip four servers each in a mirrored order:
One addition on our side: after your change, a one-row window was the only user of |
The contributor's commit landed above with the same code, its attention kernel appended after ashhart#770's; this keeps the PR's head in the history with no change to the tree.
What this changes
Nemotron on CUDA keeps more of each decode step's loads in flight, with the same values and the same order of every sum:
tf_nemo_add_moe_normloads a row's slot weights and values before summing them. It used to load one slot at a time inside the sum, so 18.3 µs became 7.8 µs on a 5-row window.tf_nemo_scanloads every step's B, C, x, gate and dt into shared memory before its serial steps (24.4 → 17.9 µs).tf_nemo_attn_chunk_pf, which loads its next key tile into registers while it computes this one: -7% to -12% at 112k tokens of context. A single row keepstf_nemo_attn_chunk, where prefetching gained nothing.cuda_glue.zigguards the kernels' bounds (8 slots, 16-row windows).Receipt
Environment: DGX Spark (GB10), Nemotron 3.5 Lightning MLX-4bit @
d9d758fb, on 1.0.8 (0efbd447), 400-token replies.Exactness:
tf-cuda-test glue100/100 byte-equal to the host references. Its attention cases at 16, 16, 3 and 2 rows run the new kernel. Replies have the sametoken_shaas 1.0.8 at 1 and 8 streams and at 56k and 112k tokens of context.Speed:
On 1.0.7, two sessions gave one stream -2.1% and -2.0%, 56k +2.9 to +3.3%, 112k +4.5 to +5.3%. The Grill's one-stream cell ran -1.21%, separated, with its A2 control at -0.10%; that control stopped at 5 of 8 acquisitions.
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). Note: this and Nemotron CUDA: a shared round's per-stream conv, scan and attention run as one launch each #770 both append to
nemotron_attention.cu, so whichever lands second takes a trivial merge.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.