Repository navigation
nemotron: decode forms of Super's latent top-k and NVFP4 experts on CUDA, same bits - #999
Conversation
…d of its own, tf_super_topk's bits tf_super_topk takes a row's picks one argmax at a time on one warp. tf_super_topk_few, which calls of up to launch.few_rows rows now take, ranks each expert on a thread of its own by how many others beat it (higher score, then lower id): pick k is the expert k others beat, and once the finite scores run out every later pick is expert 0, as tf_super_topk's repeated argmax over -inf gives. Scores, sums and weights are the same operations in the same order. Prompt chunks keep tf_super_topk. glue_ref.superTopk is the host twin; the glue test runs both forms against it at 512 experts, 22 picks, 2 shares, rows 1/16/300, equal scores, fewer finite scores than picks, and the norm on and off. The glue tests' Rig moves to glue_rig.zig, which keeps glue_tests.zig under 600 lines.
…mns a warp, four steps in flight, same bits ck_experts.cu's grouped kernel is a template over a warp's n8 tiles and the steps of codes, scales and weights it keeps in registers ahead of the mma. Prompt chunks keep 8 tiles and one step; calls of up to launch.few_rows token rows take the _few pair, 4 tiles and 4 steps. Each column still takes its 64-input steps in order through the same mma_fp4, and the epilogue is unchanged. Ck.down takes the call's token rows to choose. The modelopt test checks up and down at 1 and 16 token rows byte-equal to the same pairs inside a 40-row call.
…-equal to the kernels they replace tf_super_topk_few replaces tf_super_topk at decode-sized calls: gate 1 holds it to tf_super_topk's bytes and to glue_ref.superTopk's picks on NaN and infinite logits and fewer finite scores than picks, gate 3 to tf_super_topk's bytes at 512 experts and at 22, 31, 32 and 33. tf_ck4_up_relu2_few and tf_ck4_down_f32_few replace tf_ck4_up_relu2 and tf_ck4_down_f32 at up to launch.few_rows token rows: gates 1 and 3 compare their bytes with the prompt kernels' on the same plan (NaN and infinite alphas, a NaN block scale; Super's routed and shared widths, and K at one to five steps), gate 4 runs mirrored FP4 sums exact in fp32. Ck.run and Ck.warp_columns are public for the test to launch either form. The usage records are kernel-contract-limits' over sm_80, sm_86, sm_89, sm_120 and sm_121 fatbins.
There was a problem hiding this comment.
I found no material kernel/dispatch issue in the three-commit increment at e367c8f5 on 6ee828c2. The source review checks the rank/tie/NaN rules, both CK column halves, U4 prefetch lifetimes and per-column MMA order. All four current-head CI checks pass.
Local Zig 0.17.0 results:
- Contract host tests: 18/18. The combined CUDA-host/contract run has 866 pass, two skip and two HTTP timing failures. Those same assertions were reproduced on unchanged
6ee828c2; the three benchmark sources are byte-identical here. - Whole-tree formatting, whitespace and lean delta pass (517 baseline, 517 candidate).
- Linux CLI/test-driver Fast and native-server Safe builds pass. These builds omit NVCC fatbins; none of the binaries was executed.
The four recorded holds have consistent direct draft/plain hashes, all 120 concurrent comparison records, cold-reply hashes and rounded median arithmetic. Reproducible source/CPU and receipt-data audit.
Follow-up at 0bb5e63b: the source/build/binary mapping request is answered in receipt pin bead6842. native-b8613a54 is the candidate binary SHA256 prefix; the index documents full source commits, build flags and hashes, plus the author's clean-rebuild comparison. All 48 original top-level files are unchanged; the seven additions and original files match their pinned Git blobs. Full-hash consistency checks pass and reject a changed suffix.
The new glue tests cover 1024 experts/32 picks, ties, no selectable values and exhaustion after 31 values. The contract's new 1024-expert shape still uses 22 picks; 32 picks are covered in glue. The separate stock-CK diff correctly makes gates 1/3 use the loaded stock functions with identical inputs. Its receipt reports 12 bit-equal shapes per CK direction. These additions address the requested coverage points.
The new head's four CI checks and local Linux CLI/test-driver cross-build pass. No material issue found in the test delta or stock-comparison setup. Binary rebuild equality, stock-fatbin identity and SASS identity remain author reports; no independent GPU/model execution or binary rebuild was performed. The original local timing failures above were not rerun for this test-only increment. Follow-up audit and manifests.
…d with no finite scores The glue test runs both forms against glue_ref.superTopk at 1,024 experts and 32 picks (1 and 16 rows, equal scores), with every score -inf, and at 1,000 experts with one finite score fewer than the picks. The contract adds a 1,024-expert shape, so gate 3 also compares tf_super_topk_few with tf_super_topk at the most experts it holds.
|
Thanks for the audit. Both points below. Receipt files are added beside the existing ones in 1. Provenance.
2. Coverage. The decode form's limits:
New commit
The CK baseline is the refactored TJ8/U1 kernel. Two checks tie it to main:
|
|
Checked The stock-CK diff also uses the separately loaded stock functions with identical inputs. I checked its reported results and mapping, without independently rerunning the GPU or rebuilding those binaries. All four current-head CI checks and the local Linux test-driver cross-build pass. No material source finding in this increment. I've updated the original review and audit with the resolved points and evidence limits. |
|
Thanks @plotarmordev for the clean-rebuild mapping and 1,325/1,325 glue comparisons, and @cwschroeder for the audit. The binary label is now tied to source, and the added boundary/exhaustion cases answer the source review. Keep the coverage distinction clear: 32 picks are exercised in glue, while the contract's large shape uses 22. The stock-CK comparison is supplied GPU evidence, not an independent rerun by us. We are carrying the full current increment, including those final tests, onto the maintained owner. Recheck its numerical/resource and served gates on that final composition; no source blocker remains in the reviewed increment. Posted by Ash's AI Assistant Synthena |
…perts at decode-sized calls kernel-contract-limits read 13.2's fatbins on an x86_64 box: tf_super_topk_few takes 32 registers on sm_120 and sm_121 where 13.0's record has 30, and tf_ck4_up_relu2_few 124 where it has 125; every other SM and the down experts are as recorded. Both join 13.2's set, and the contract's notes say what that set now holds.
…drafts a round, with the Mamba scan in stages of 32 The branch builds on #999's earlier commits and on #997, which come in with it. Twelve files took both sides, keeping this line's generic native options, owner guards, per-sequence context cap, page margins, #996's borrowed shared plans and #999's 1,024-expert, 32-pick reference, with the larger pinned-window layout beside the failed-load owner guards. The Mamba scan's record joins #999's records in the registry.
…at load, and on one GPU the shared expert beside the routed ones The branch builds on #999's earlier commits, which come in with it. Six files took both sides, keeping #999's 1,024-expert, 32-pick reference, the 32-row tests, Bolt's own layout, lanePartBytes and both projection partials, KV pages, copy ownership, sibling plan borrowing and the shared cap and confidence policy. Latent cached plans cover the checkpoint's window, Bolt keeps its fixed affine plans, and the side stream's join stays before its shared result is read.
…d 128-pair NVFP4 expert tiles, router tiles past 32 rows The branch builds on #999's and #1002's heads, which this line already holds. Ten files took both sides. The router keeps this line's slice widening for Bolt's rows and its wide top-k, with #1008's tile path in a logits call that the latent router shares. The latent forward keeps the per-checkpoint window, both projection partial pointers and its schedule, and adds #1008's share-sum combine and add. The scratch table keeps the router slices and lane partials and takes #1008's activation rows. ck.zig keeps the 32-row decode bound beside the 128-row prompt bound. The contract and runner keep every case they had and add #1008's. The eight new launches' records go to nemotron_prompt_records.zig, which keeps registry.zig under 600 lines.
|
Thank you, @plotarmordev, for the latent top-k/NVFP4 decode work and matched speed and concurrency receipts. We merged it for 1.1.0 in d9dcc11, over the current 1,024-expert/32-pick reference. Page ownership, sibling sequence state and current kernel records are retained, with no additional landing arithmetic change. NVIDIA GB10/RTX PRO 6000 live/resource contracts passed; GB10 Super VL/Lightning serving retained exact/concurrent/chat parity. Posted by Ash's AI Assistant Synthena |
…ized calls, a thread an expert and 32 columns a warp, same bits Five files took both sides. The contract's coverage paragraph is ashhart#999's, with this line's section on records per nvcc release after it. The registry keeps tf_nemo_topk_wide beside tf_super_topk_few. The host top-k reference is ashhart#999's pickRow, sized by the config's 1,024 experts and 32 picks, which covers the 512 the wide top-k takes. The contract tests import contract_ck beside this line's kernels, load nemotron_latent and ck_experts among this line's images, and add the ck experts after this line's Flash Next, H3 and Drama 3 kernels. The glue tests' rig is ashhart#999's glue_rig.zig, the rig this line had, and the summary names the latent top-k and the paged attention both.
….cu, nemotron_latent.cu and ck.zig
…4 up experts at decode-sized calls kernel-contract-limits read 13.2's fatbins on an x86_64 box: tf_super_topk_few takes 32 registers on sm_120 and sm_121 where 13.0's record has 30, and tf_ck4_up_relu2_few 124 where it has 125; every other SM and the down experts are as recorded. Both join 13.2's set, and the contract's notes say what that set now holds.
…31 MTP drafts a round, with the Mamba scan in stages of 32 The branch builds on ashhart#999's earlier commits and on ashhart#997, which come in with it. Twelve files took both sides, keeping this line's generic native options, owner guards, per-sequence context cap, page margins, ashhart#996's borrowed shared plans and ashhart#999's 1,024-expert, 32-pick reference, with the larger pinned-window layout beside the failed-load owner guards. The Mamba scan's record joins ashhart#999's records in the registry.
…t once at load, and on one GPU the shared expert beside the routed ones The branch builds on ashhart#999's earlier commits, which come in with it. Six files took both sides, keeping ashhart#999's 1,024-expert, 32-pick reference, the 32-row tests, Bolt's own layout, lanePartBytes and both projection partials, KV pages, copy ownership, sibling plan borrowing and the shared cap and confidence policy. Latent cached plans cover the checkpoint's window, Bolt keeps its fixed affine plans, and the side stream's join stays before its shared result is read.
…iles and 128-pair NVFP4 expert tiles, router tiles past 32 rows The branch builds on ashhart#999's and ashhart#1002's heads, which this line already holds. Ten files took both sides. The router keeps this line's slice widening for Bolt's rows and its wide top-k, with ashhart#1008's tile path in a logits call that the latent router shares. The latent forward keeps the per-checkpoint window, both projection partial pointers and its schedule, and adds ashhart#1008's share-sum combine and add. The scratch table keeps the router slices and lane partials and takes ashhart#1008's activation rows. ck.zig keeps the 32-row decode bound beside the 128-row prompt bound. The contract and runner keep every case they had and add ashhart#1008's. The eight new launches' records go to nemotron_prompt_records.zig, which keeps registry.zig under 600 lines.
Branch
nemotron/cuda-decode-kernels, three commits onmain(6ee828c). Independent of the other Nemotron pull requests.What this changes
Two kernels Nemotron 3.5 Super runs at every decode step get a form for calls of up to
launch.few_rows(16) tokenrows, each bit-equal to the kernel it replaces; prompt chunks keep the existing kernels.
tf_super_topktakes a row's 22 picks one argmax at a time on one warp.tf_super_topk_fewranks eachof the 512 experts on a thread of its own by how many others beat it (higher score, then lower id), so pick k is the
expert k others beat. Past the finite scores every pick is expert 0, as the repeated argmax over -inf gives. Scores,
sums and weights are the same operations in the same order.
glue_ref.superTopkis the host twin.ck_experts.cu): the grouped kernel becomes a template over a warp's n8 tiles and thesteps it keeps in registers ahead of the block-scaled FP4 mma.
tf_ck4_up_relu2_few/tf_ck4_down_f32_fewtake 32columns a warp (twice the warps, which the shared expert's two items need) with four steps of loads in flight. Each
column still takes its 64-input steps in order through the same
mma_fp4, and the epilogue is unchanged.replaces), byte-compared with the stock kernel on the sameinputs at gates 1 and 3;
docs/kernel-contract.mdlists them.An earlier variant ran the block top-k at every width. Decode was the same, but the 8,186-token cold prefill came out
17 to 42 ms slower than main in both alternated pairs (
all-widths/), so prompt chunks keeptf_super_topk.Receipt
Environment: TensorFold
e367c8f5(this branch) against6ee828c2(main), both built with the release flags(
-Doptimize=fast -Dsm=121). A DGX Spark (GB10), CUDA 13.0 (nvcc 13.0.r13.0), driver 580.173.02.nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4@82d93699acd3be9e4617c53360fe5b3f5dbeb1b3, served astensorfold-native serve <checkpoint> --name super --no-update-check --prompt-cache-gib 0on loopback withTF_HEAT_HIGH=85 TF_HEAT_LOW=75, everything else default (the checkpoint math and MTP drafts on). Four holds on onenode, each a fresh server, in the order main, branch, branch, main.
Exactness: in every hold
bench_concurrent.py --levels 1,4 --tokens 256 --reps 3 --temperatures 0 --alone --serialgives 30 of 30 concurrent replies equal to their request alone and 4 of 4 alone runs equal to
"draft": false. Bothbench_openaiprompts' draftedtoken_sha256equals"draft": false, and the hashes are the same on main and thebranch: code
51e4c630298a14a1…, chat161034fd0a090a34…. The cold prefills' 16-token replies hash the same too.Decode speed,
bench_openai.py --tokens 256 --reps 3 --temperatures 0(medians of 3; all runs in the receipt):fibonacci-raw) tok/sgpu-chat-no-think) tok/sbench_concurrentaggregate tok/s, main 1 / branch 1 / branch 2 / main 2: code x1 42.6 / 46.9 / 47.1 / 42.5, code x4125.1 / 134.5 / 134.9 / 125.0, chat x1 32.6 / 36.1 / 36.2 / 32.5, chat x4 99.0 / 98.5 / 98.5 / 99.0 (0.5% lower on
the branch in both pairs; the same cell read 99.2 / 98.5 / 98.4 / 99.0 in the earlier variant's holds).
Prompt speed:
bench_cache.py --require-cold --tokens 16 --repeats 2 --streams 1on an 8,186-token chat prompt (asynthetic field log, token ids in the receipt), cold first request
ttft_s: main 4.460 and 4.465, branch 4.460 and6.464. The 6.464 includes one 2.0 s heat-gate sleep inside that request (
info: heat_wait_s 2.0inpr-1.server.log, line 103); without it, 4.464. Prompt chunks run the same kernels as main.Tests run:
zig build test: 1376 passed, 7 skipped, 0 failed (main: the same).zig build test-kernel-contract: 18 of 18.zig build test-golden: 309 of 319 equal, 0 unexpected differences (main: the same).zig build fuzz-cortheon:7 of 7.
zig fmt --check zig build.zig: clean.tools/zig/lean_check.py: 517 problems, the same 517 as main, 0new.
-Dnvcc, on the GB10):tf-cuda-test kernel-contract:SUMMARY 15 kernels: 15 pass gates 1-4, 0 fail, 0 known findings; 5 controls: 5 red as planted, 0 missed; 0 limit problems; gates 62019 ms, limits 1 ms.The three new entries:
tf_super_topk_fewgate 1 (tf_super_topk's bytes and the host twin's picks on NaN, ±Infand fewer finite scores than picks), gate 2, gate 3 (6 shapes bit-equal to
tf_super_topk: 1 and 16 rows, 22, 31,32, 33 and 512 experts), gate 4 N/A (no sums);
tf_ck4_up_relu2_fewandtf_ck4_down_f32_fewgates 1 and 3 (12shapes each bit-equal to the prompt kernel on the same plan: Super's routed and shared widths, 1 to 16 token rows,
K at 1 to 5 steps), gate 4 exact sums at K 4,096 and 2,688.
tf-cuda-test kernel-contract-limitsover sm_80/86/89/120/121 fatbins: every record current, every control red.tf-cuda-test glue: 1309 of 1309 comparisons byte-equal (both top-k forms againstglue_ref.superTopkat 1, 4,16 and 300 rows, equal scores, fewer finite scores than picks, norm on and off).
tf-cuda-test modelopt: 5 of 5,with up and down at 1 and 16 token rows byte-equal to the same pairs in a 40-row call.
held to the stock kernels' bytes instead. With two planted faults (
mutants.diff: ties to the higher expert intf_super_topk_few; each FP4 step summed from zero then added in the_fewexperts),kernel-contractgoes redfor both (gates 1 and 3) and
gluefor the top-k. The modelopt 40-row comparison and the up kernel's bf16 relu²output did not show the per-step fault; the contract's down kernel did.
Not run, and why: Metal (no Mac here; the change is CUDA-only). TP=2 across two GB10s (the kernels are
per-rank; not run for this change). sm_80, sm_86, sm_89 and sm_120 on a live GPU (compiled records only); the
_fewexperts need the sm_120a block-scaled mma and the contract runner marks them N/A below it.--precision full, which does not run the checkpoint-math experts.Raw receipts:
receipts/nemotron/cuda-decode-kernels({base-1,pr-1,pr-2,base-2}.*per hold: server log, guard log, every tool's JSON;summary.md;gpu-tests.raw.txt;gpu-tests-mutants.raw.txtwithmutants.diff;host-{base,tip}.raw.txt;lean-{base,tip}.txt;all-widths/for the earlier variant).Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Draftedvs
"draft": falseand concurrent vs alone measured above; resume not exercised separately, and no prompt-path orcache code changes.)
change: same operations in the same order, byte-compared.)
SUMMARYline is in the receipt. (CUDA only; no Metal kernel changes.)ttft_sabove.)main's behaviour by design: the change keeps bits. The failing receipt is the planted faults above. The checkpoint
experts' tests skip below sm_120.)