Repository navigation
nemotron: Super verifies windows of up to 32 rows on CUDA, same replies (stacked on #999, #997) - #1006
Merged
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.
tf_nemo_scan loaded every step's inputs into shared memory at once, so a call took at most 32 kept and window rows (windows of 16). It now loads and steps them 32 at a time; each step's arithmetic and order are unchanged, so a call of up to 32 steps runs as before and longer calls give serial's bits. The glue test runs windows of 32 rows over 31 kept ones (51 and 63 steps), alone and as a stream of a shared window.
…bytes tf_nemo_scan registers with the kernel contract under a stated rule: gates 1 and 3 hold its y, the window's dt and the state after the kept rows to glue_ref.scan's bytes (NaN wherever the twin gives NaN), at Super's 128 heads with 1 to 32 window rows after 0 to 31 kept ones, so calls either side of a 32-step stage and up to 63 steps. Gate 1 plants NaN in an x, +Inf in a gate and in a dt input, and -Inf in a kept state. Each run restores the state and dt planes the kernel writes, so the five repeats read the same inputs. The usage record is kernel-contract-limits' over sm_80, sm_86, sm_89, sm_120 and sm_121 fatbins.
…fts a round) state.max_rows is 32 and state.windowRows(c) the width a checkpoint takes: 32 for a latent MoE (ModelOpt's FP8 lane tiles of 16 and 32 rows, bf16 and NVFP4 lanes, and per-pair experts give a row the same bits at any width), 16 for every other one, whose MLX affine-4 decode products (Nano's ModelOpt MTP head among them) tile 16 rows. Window buffers, the Mamba replay planes, captured windows and head levels, the cost table, the depth rule, copied chains, grammar windows, the lane facts and the pinned layouts follow it; the latent shared-expert plans cover max_rows, the non-latent ones stay at 16 rows. --mtp-drafts takes up to max_chain (31), and a lone stream's cap stops at its checkpoint's window.
…e NVFP4 experts and the latent top-k Ck chose the _few expert kernels, and the latent router the thread-an-expert top-k, for calls of up to launch.few_rows (16) token rows, the widest window when they came; Super's windows of 17 to 32 rows fell to the prompt kernels. Expert calls of up to Ck.few_tokens (32) token rows and top-k calls of up to state.max_rows rows now take the decode forms. Each form gives its prompt kernel's bits, so only time changes. The modelopt test checks 32 token rows byte-equal to the same pairs inside a 40-row call, the glue test runs both top-k forms at 32 rows against the host twin, and the contract holds the three decode forms to their prompt kernels' bytes at 32 rows.
… and grow with what copies keep A copied chain is verified whole, without the depth rule's pricing, and with 32-row windows it could take up to 31 tokens of the context's continuation, so every wrong copy cost a 32-row window. A copy now proposes at least 15 tokens (a 16-row window's), and after each copy round at most twice the tokens that round kept, up to the window's 31. The MTP head's drafts keep the depth rule.
…egime Costs.measured pooled every row's added ms so it never rises with rows, as shared experts make it. Super's windows past launch.few_rows (16) rows switch to wider kernels (the router's logits, the lanes' 32-row tiles), so row 17 adds more ms than row 16 did, and pooling spread that step back over rows 3 to 16: the depth rule then priced mid-size windows above their timed cost and drafted shallower. Costs.measured now pools within regimes of a given width; the row that starts a regime keeps its own ms. A 16-width table is unchanged. The new draft_depth test runs a 32-width series with a step at 17 rows.
A window's ms follows its tokens, through the experts its rows route to. measure prefilled windowRows tokens of its text before the windows it timed, so a 32-row engine timed its 1-16 row windows on later text than a 16-row engine, where the same kernels take longer. The windows now follow the text's first 16 tokens at any width: rows 1-16 are timed on the same tokens as without the wider windows, and the depth rule prices them the same.
tf_nemo_scan read the state into registers before its first stage's inputs, so the 32 state registers were live through those loads and a window of 16 rows or fewer, one stage, ran slower than the unstaged scan it replaces. The first stage now loads its inputs, then the state, then steps, as the unstaged scan did; later stages follow in a loop. Each step's arithmetic and order are unchanged. The contract's usage record follows the new register counts.
9 tasks done
8 of 9 tasks
Owner
|
Thank you, @plotarmordev, for the wider Super window and kept-row comparisons across widths 1 through 32. We merged the work for 1.1.0 in da01294, with the common cap/confidence policy and existing expert limits. Only Super's latent models widen to 32 rows; Bolt retains its 16-row path and models without MTP retain shared copy drafting. GB10 Super VL passed 17/17, concurrent 2/4 and chat 12/12; compiler/resource gates passed, without a separate exhaustive window sweep recorded. Posted by Ash's AI Assistant Synthena |
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…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.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
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.
Branch
nemotron/verify-32-rows. Stacked on #999 and #997: the branch is a local merge of the two (3999313), thenthis pull request's commits; review only the last 8 commits.
What this changes
Super's latent MoE gives a row the same bits at any window width, so it can verify up to 32 rows a round. Same replies.
tf_nemo_scansteps kept and window rows in stages of 32 (was: every step's inputs in shared memory at once, atmost 32 steps). The first stage loads its inputs, then the state, then steps, in the unstaged scan's order, so a
window of 16 rows or fewer runs as before; later stages follow in a loop. Each step's arithmetic and order are
unchanged.
glue_ref.scan's bytes; Super's 128 heads, 1-32 windowrows after 0-31 kept rows, both sides of a 32-step stage, up to 63 steps), with its usage record.
state.max_rowsis 32 andstate.windowRows(c)the width a checkpoint verifies: 32 for a latent MoE (Super), 16otherwise (the MLX affine-4 decode kernels tile 16 rows). nemotron: --mtp-drafts and --mtp-confidence set a lone CUDA stream's MTP depth #997's
--mtp-draftscap goes from 15 to 31; a 16-rowcheckpoint refuses more than 15 at open.
Ck.few_tokensis 32 for the NVFP4 experts, and the latenttop-k takes
tf_super_topk_fewfor every verify window. The contract covers both expert kernels and the top-k at 32rows.
to 31.
kernels), and every width is timed after the same 16 tokens of the cost text. A window's ms depends on its tokens
(the experts its rows route to): timed after
windowRowstokens, a 32-row engine would price its 1-16 row windowson later text, where they cost more, and the depth rule would draft shallower.
Receipt
Raw receipts:
receipts/nemotron/verify-32-rows/round2(build.txtmaps every file to its binary; earlier rounds beside it).Environment: this branch at
fa2af585fc52b888bbba09e379367b8e0792115bagainst its base39993136981823d314a1a6204ecc6f95ae25bb45(the merge of nemotron: decode forms of Super's latent top-k and NVFP4 experts on CUDA, same bits #999 at e367c8f and nemotron: --mtp-drafts and --mtp-confidence set a lone CUDA stream's MTP depth #997 at a1ad3ae). Both built fromclean checkouts with
zig build fatbins -Dsm=121 -Dnvcc=…,zig build nativeandzig build install(
-Doptimize=fast -Dstrip=true -Dtarget=aarch64-linux-gnu.2.28 -Dcpu=baseline -Dversion=1.0.12, zig 0.17.0).tensorfold-nativesha256: baseef46e9ba4e9b05a763306f3c37ef99ec7bf77892ec657bb078ac37e3b49c6e7c, branch097904fb69e20ae74986e50ab438db6abec16a68aaa0ce74d51ef4656513179b;tf-cuda-test: base8fcde077bf3eed88d088c5db4a0eeefc7da0445e836ec72b4d27bc0b34238632, branch4e9ba1ebd7ef43c7a61e00e1a5d12a12c56d5069afd7f072c7a166a9a96274d2. A DGX Spark (GB10), CUDA 13.0 (nvcc13.0.r13.0), driver 580.173.02; GPU checks 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 (MTP drafts on). Six holds on one node, each a freshserver, in the order base, branch, branch, base, branch, base. Each build's window-cost cache was deleted before its
first hold, so its table is measured fresh; the later holds read it. Every receipt JSON carries
commit,binary_sha256andbuild.Exactness:
tensorfold widths1-32 on count, prose and code: 1199 of 1199 kept rows equal serial each (1,200tokens);
--eager399 of 399 each;shared-widths2/4/8 streams: 798/798, 1596/1596, 3192/3192. In every hold,drafted ==
"draft": falsefor code, chat, count, tool_json and repetition, andbench_concurrent --alone --serial30 of 30 alone and 4 of 4 serial. Code and chat hashes equal on both builds (
51e4c630298a14a1…,161034fd0a090a34…).GPU tests:
kernel-contractSUMMARY 16 kernels: 16 pass gates 1-4, 0 fail, 0 known findings; 5 controls: 5 red as planted, 0 missed; 0 limit problems;kernel-contract-limitsover sm_80/86/89/120/121 fatbins: every recordcurrent (
tf_nemo_scan138/144/144/116/116 registers);glue1337 of 1337 byte-equal;modeloptPASS (1, 16 and 32token rows equal a 40-row call).
Failing before (earlier round,
before.diff: main's scan and caps): contract scan gate 3 FAIL(illegal address past 32 steps), glue FAIL (ScanShape), refusal test 1 failed; the regime pooling test fails on the
old pooling (
pooling-test-before.txt). The last two commits add no test: the scan's is held by the contract andthe widths runs above, the cost table's by the tables below.
Window costs. The fresh tables (ms): base 46.86 / 60.90 / 85.99 / 103.02 / 117.69 at 1 / 3 / 8 / 12 / 16 rows, branch
46.86 / 60.63 / 86.03 / 102.97 / 117.69, then 122.12 / 143.78 / 164.80 at 17 / 24 / 32 (every width 1-16 within
0.35 ms; head level 3.463 / 3.433).
window-profileon the same prompt and window tokens (graph ms, base / base /branch / branch): 16 rows 117.785 / 118.740 / 117.931 / 118.222, 8 rows 89.385 / 90.034 / 89.447 / 89.578. Conv and
scan at Super's shape (
scan-bench/, µs a layer, base → branch): 16 rows after 15 kept 79.63 → 80.88, after 158.85 → 59.43; 8 rows after 8 58.00 → 58.37.
Decode speed, medians of 3 a hold (all runs in
holds-fa2af585/summary.md), tok/s:fibonacci-raw, 256)gpu-chat-no-think, 256)Count drafts deeper: 12.50 → 13.33 tokens a round (acceptance 0.929 → 0.963). Repetition runs the same schedule on
both (30 rounds, 232 of 439 drafts accepted on the base, 232 of 440 on the branch); its holds spread 52.55-52.78 on
the base and 52.00-52.60 on the branch (branch 2's runs read 52.06, 51.72, 52.00), so the -0.7% is inside the
spread between holds of one build.
bench_concurrentaggregate tok/s, base 1 / branch 1 / branch 2 / base 2 /branch 3 / base 3: code x1 46.8 / 46.8 / 46.8 / 46.9 / 46.7 / 46.7, code x4 135.5 / 138.8 / 138.6 / 136.2 / 138.1 /
135.8, chat x1 36.1 / 36.2 / 36.2 / 36.2 / 36.1 / 36.0, chat x4 98.5 / 98.3 / 98.2 / 98.5 / 98.2 / 98.4.
Prompt speed:
bench_cache.py --require-cold --tokens 16 --repeats 2 --streams 1on an 8,186-token chat prompt, coldfirst request
ttft_sminus the heat wait the server logged in that request: base 4.465, 4.465, 4.469; branch 4.461,4.465, 4.470 (every row in the receipt nets 4.45-4.47 s, or 2.7 s where the gate's wait overlapped GPU work). Prompt
chunks are unchanged by this branch.
Memory and start: 0.35 → 0.40 GiB a stream, model 70.97 → 71.03 GiB. A first start that measures the table takes
66 s against 38 s on the base (32 widths timed instead of 16); later starts 20 s on both.
Tests run:
zig build test1380 of 1387 passed, 7 skipped, 0 failed;zig build test-kernel-contract18 of 18;zig build test-golden309 of 319 equal, 0 unexpected differences;zig build fuzz-cortheon7 of 7;zig fmt --check zig build.zigclean;tools/zig/lean_check.py517 problems, the same set as the base, 0 new.Not run, and why: Metal (no Mac here; the change is CUDA-only). TP=2 across two GB10s: not run. Nano and other
16-row checkpoints: no weights here; their windows stay at 16 rows by
windowRows. Resumed against fresh prompts: notexercised separately; no prompt-path change.
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Drafted vs"draft": false, widths 1-32 vs serial and concurrent vs alone measured above; resume not exercised separately.)SUMMARYline is in the receipt. (CUDA only.)ttft_sabove.)