Repository navigation
nemotron: Super's latent shared expert plans once at load and, on one GPU, runs beside the routed experts (stacked on #996, #999) - #1002
Conversation
…lans and pair ids Buffers.sibling gave each extra prompt segment its own `shared` and `sids` from fresh scratch, but only the owner's load writes them (initShared), so a segment of a latent MoE planned its shared expert from pair ids nothing wrote. On Super with `--segments 2` an 8,186-token prompt's reply differed from `--segments 1`. A sibling now points both at the owner's. `tf-cuda-test prompt-segments MODEL IDS_FILE` checks a prompt run as 2 to 4 segments a call against one uncut pass: caches and states, the MTP head's caches, the logits, the last hidden row and the first token.
…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.
…, at buffer load, one per row count The latent shared expert's pairs are the same (row, share) list at every layer, so initShared now plans each row count up to max_rows into its own slice of the shared buffer and the expert pass reads that plan instead of planning the shared expert again at every layer. Prompt passes wider than a window and the other ranks' jobs still plan at their row count. A host test checks that the row counts' plans stay apart and inside the shared slot at one share and two.
…he side stream beside the routed experts The latent shared expert reads only the block's input rows, so on one GPU a pass of up to max_rows rows forks it onto the engine's side stream once the input is written. It runs on its own NVFP4 rows, activations and the plan built at load while the router, the latent projection and the routed experts run on the main stream, which waits for it just before the shared rows are summed. Every row's sums and their order are unchanged. Prompt passes wider than a window and tensor-parallel ranks keep one stream. Engine.forward gives latent families the side stream: tf_plan_routed's bounds hold only for the non-latent MoE, which plans with it. `tf-cuda-test shared-fork MODEL` runs every latent MoE layer at 1 to 16 rows in both precisions with the side stream held back by copies before the fork, against the same layer on one stream: the deltas must be byte-equal.
There was a problem hiding this comment.
Source/CPU review of the last two commits only, c6004831 and 14c78e73 above ed44eefb: I found no material source defect in the shared-plan slices, separate scratch/output regions or fork/join ordering. TP stays on one stream, and the main stream waits for the shared result before the final sum.
The actual host plan-layout test passes (2/2 including the imported config test), whole-tree Zig 0.17.0 formatting passes, and the safe aarch64 Linux driver/CLI cross-build completes 12/12 steps. No GPU binaries were executed here. All four current-head CI checks are green.
I verified all 122 receipt files against the pinned Git blobs at 7371337c and reproduced summary.md byte for byte. The audit, negative control and local build receipts check the reported full hashes and source/binary labels. Changing only a full hash's suffix makes the audit fail. This checks receipt consistency, not the underlying token IDs or binary provenance independently.
Two qualifications need to stay explicit:
- The clean A/B/B/A holds show chat x4 at 108.3 / 100.4 / 100.4 / 108.2 aggregate tok/s, a 7.25% lower median on this tip. Earlier builds showing both levels do not establish that this change is uninvolved. Please qualify “the chat x4 cell is not this change's” as unresolved; startup calibration is a hypothesis until a trace or controlled comparison separates it.
- The exactness checklist includes resumed vs fresh, but the receipt explicitly says that was not exercised. Please leave that combined item unchecked or supply its receipt. TP2's newly cached shared-plan path also remains untested, as disclosed.
The supplied GPU pass and mutant logs are useful evidence, but I did not rerun them. This is a scoped source/CPU review, not approval of the full stack or GPU/performance qualification.
Update: the description now keeps the 7.25% chat-x4 decrease unresolved, names calibration as a hypothesis, and leaves the combined exactness checklist unchecked. Both wording requests are addressed; the unrun TP2/resume paths and unresolved performance cause remain evidence limits.
|
Thanks for the audit. Both points, with new receipts under chat x4. The gap follows the window-cost table, not the build. Each build times its decode windows at its first
On the same table the tip is ahead in every cell (chat x4 +1.5% on the base's table and +1.6% on the tip's; every code x4 and x1 cell too), and either build So the drop is not this change's launches. It is the cost rule's response to the table the tip measures. That table Resumed vs fresh. Tip, default prompt cache ( |
|
Thanks @plotarmordev for the table swap and resumed/fresh hashes. They separate the same-table gain from the depth rule's response to each build's own costs. The fresh-calibration default outcome remains an inference because those recalibrated tables were not served. That is stronger evidence than our earlier scheduling inference. We have prepared a conservative shared/TP schedule follow-up, but have not measured it fixing chat x4. Keep the default-table regression visible and compare the integrated policy in matched runs with drafts and caching on. The new resume receipt covers its pinned build; the changed TP2 cached-plan path and final merged performance are still owed. Posted by Ash's AI Assistant Synthena |
|
Thanks. Understood on keeping the default-table chat x4 result visible; the description states it as measured. I can run the owed checks on two DGX Sparks (GB10, TP=2 over their direct link) once the integrated source is up: the TP2 cached shared-plan path (TP=2 tokens against TP=1 and against main), and matched runs of the integrated policy against main with drafts and the prompt cache on, including chat/code x1/x4 on fresh calibrations. Point me at the branch or commit and I'll post the receipts here in the same format. |
…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 cached shared-expert plans and for reporting the chat-x4 regression alongside the lone-stream gains. We merged the work for 1.1.0 in 29aad5b. Plans are built for each decode row count. Lone captured windows retain side-stream overlap; shared multisequence and two-rank windows keep the earlier schedule and continue batching through the common lanes. Actual schedule controls stay with the change. GB10 Super VL passed 17/17, concurrent 2/4 and chat 12/12; a standalone shared-plan throughput comparison remains unrecorded. Posted by Ash's AI Assistant Synthena |
…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/shared-expert-overlap. Stacked on #996 and #999: the branch is a merge of the two, then this pullrequest's two commits; review only the last 2 commits.
What this changes
The latent MoE's shared expert reads only the block's input rows and the same (row, share) pairs at every layer, so a
decode window no longer plans it per layer or waits for the router before running it. Same bits.
Buffers.initSharedplans every row count from 1 tomax_rowsinto its own slice of the sharedbuffer, and passes of up to a window's rows read that plan instead of planning the shared expert again at every
layer. Wider prompt passes and the other rank's jobs still plan at their own row count. A host test checks that the
row counts' plans stay apart and inside the shared slot at one share and two.
latent.runforks the shared expert onto the engine's side stream once the input rows arewritten. It runs on its own NVFP4 rows, activations and the load-time plan while the router, the latent projection
and the routed experts run on the main stream, and the main stream waits for it just before
moe_outsums theshared rows. Each row's sums and their order are unchanged. Wider prompt passes and tensor-parallel ranks keep one
stream.
Engine.forwardnow gives latent families the side stream (tf_plan_routed's bounds hold only for thenon-latent MoE, which plans with it).
tf-cuda-test shared-fork MODEL: every latent MoE layer (40 blocks and the MTP head) at 1 to 16 rows, in bothprecisions, forked against the same layer on one stream, byte for byte. Before each forked run it fills the shared
rows' slot with NaN and holds the side stream back with copies, so a sum that does not wait for the join reads NaN.
docs/recipes/nemotron-3.5-super-vl.mdsays where the plans come from and what runs on the side stream.Receipt
Raw receipts:
receipts/nemotron/shared-expert-overlap(README.mdmaps every file to its binary).Environment: this branch at
14c78e735cc9effb2dfb2c2dc53c54b93d06f481against its baseed44eefbaefdfc6b52c0740ac9aeda3bbc5a36ba(the merge of nemotron: a prompt segment's buffers read the owner's shared-expert plans and pair ids #996 and nemotron: decode forms of Super's latent top-k and NVFP4 experts on CUDA, same bits #999). Both built from clean checkouts withzig build fatbins -Dsm=121 -Dnvcc=…,zig build installandzig build native(-Doptimize=fast -Dstrip=true -Dtarget=aarch64-linux-gnu.2.28 -Dcpu=baseline -Dversion=1.0.12, zig 0.17.0;builds.txt).tensorfold-nativesha256: base
f24658bd2f308a05495928e18f9d9e8240323bc11f4573feaef35deaefbdb93f, branch33d9dcf6e0064903ce08f723fd6b3559f8b3f03828e71200c9c02e5a314e8d6f;tf-cuda-test: basecc76592e24263fb8e3e5ca531a6339011aa2245f0f942fabc9f50b1900e7d4ef, branch07ad762d349ff5028dea72e24327fff73d5c7475a6b0b11919f3ee7431e6710e. A DGX Spark (GB10), CUDA 13.0 (nvcc13.0.r13.0), driver 580.173.02; the
tf-cuda-testruns on a second DGX Spark.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 (checkpoint math and MTP drafts on). Four holds on onenode, each a fresh server, in the order base, branch, branch, base. Every receipt JSON carries
source_commitandbinary_sha256.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 the base andthe branch: code
51e4c630298a14a1…, chat161034fd0a090a34…. The cold prefills' 16-token replies hash the sametoo (
58b069bf157f…).tf-cuda-test shared-fork:PASS shared-fork (checkpoint): 656 (layer, rows) cases, the forked delta byte-equal to the one-stream delta, and thesame line for
(full).Decode window cost,
tf-cuda-test window-profile MODEL 1,4,16 IDSat position 8,170 (medians of 5), base → branch:graph 48.859 → 47.474 ms at 1 row, 80.384 → 79.111 ms at 4 rows, 145.390 → 144.511 ms at 16 rows. On the branch at
1 row, eager with marks, the 40 layers'
experts_downspan is 17.626 ms forked (plus 2.102 msshared_wait) against20.427 ms on one stream.
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, base 1 / branch 1 / branch 2 / base 2: code x1 46.7 / 47.8 / 47.9 / 46.7, code x4135.8 / 138.2 / 138.3 / 135.8, chat x1 36.1 / 36.8 / 36.8 / 36.1, chat x4 108.3 / 100.4 / 100.4 / 108.2. The chat x4
cell is lower on this tip's own window-cost table, not because of its launches: on the same table the tip is faster in
every cell, chat x4 included (+1.5% and +1.6%,
followup/). With its own, cheaper table the depth rule drafts less forfour chat streams (139-140 rounds against 109-110), which lowers chat x4 on either build; that cost-rule interaction is
not this pull request's to change.
Prompt speed:
bench_cache.py --require-cold --tokens 16 --repeats 2 --streams 1on an 8,186-token chat prompt(token ids in the receipt), cold first request
ttft_s: base 4.454, 4.461, 4.456, 4.459; branch 4.452, 4.466, 4.458,4.458 (the last four from holds that ran only this request, in the order branch, base, base, branch). This
prompt's chunks are wider than a window and run the same launches on one stream as before.
Tests run:
zig build test: 1377 passed, 7 skipped, 0 failed (base: 1376 and 7; the new one is the shared-plan layouttest).
zig build test-kernel-contract: 18 of 18.zig build test-golden: 309 of 319 equal, 0 unexpecteddifferences (base: 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 the base, 0 new.tf-cuda-test shared-fork2 of 2 PASS (above).window-profileon the base and the branch (above).FAIL shared-fork: NoSideStream(a latent MoE gets noside stream there). The branch with the join removed (
gpu/mutant-no-join.diff) fails at its first case:FAIL shared-fork (checkpoint): layer 0 at 1 rows: first difference at byte 0, 2048 of 2048 words differ.Not run, and why: Metal (no Mac here; the change is CUDA-only). TP=2 across two GB10s: ranks keep one stream, but
rank 0's own shares at window widths now read the load-time plan, and that path was not run. A non-latent Nemotron
(Nano):
Engine.forwardkeeps its side-stream condition, not run.tf-cuda-test kernel-contract: no kernel changed.Resumed against fresh prompts: not exercised separately; no prompt-path or cache code changes. The test's mutant was
run only with the side stream held back, not without the hold.
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Resumed vs fresh:followup/resume.)shared-fork.)SUMMARYline is in the receipt. (No kernel changed.)ttft_sabove.)shared-forkis atf-cuda-testcommand that takes the checkpoint, asprompt-segmentsdoes.)