Skip to content

nemotron: Super's checkpoint prompt passes run their FP8 layers, NVFP4 experts and router on wide tiles, same bits (stacked on #999, #1002) - #1008

Merged
ashhart merged 15 commits into
ashhart:mainfrom
plotarmordev:nemotron/checkpoint-prompt-tiles
Oct 18, 2026
Merged

ashhart merged 15 commits into
ashhart:mainfrom
plotarmordev:nemotron/checkpoint-prompt-tiles

Conversation

@plotarmordev

Copy link
Copy Markdown
Contributor

Branch nemotron/checkpoint-prompt-tiles. Stacked on #999 and #1002: the branch is a merge of the two, then this pull
request's six commits; review only the last 6 commits.

What this changes

Prompt passes of 128 rows or more (ck.prompt_tokens) in the checkpoint's own math, on one GB10. Every output keeps
the decode kernels' per-row MMA steps, summation order and rounding, so prompt bytes equal the decode path's. Decode
windows keep their kernels.

  • FP8 layers: tf_ck8_128 (128 x 64) and tf_ck8_128c (128 x 128 where K slices meet in a cluster), eight warps in
    two rows of 64, each row's K slices and summation order as in the 64-row tiles.
  • NVFP4 experts: plans of 128 pairs an item (ck.prompt_tile); a block takes one item of one expert by 128 columns,
    eight warps over a four-step cp.async pipeline, and the next unit's first steps load under this one's epilogue
    (tf_ck4_down_f32_prompt). Calls under 128 rows keep the 16-pair warps.
  • The prompt up kernel quantizes its relu^2 rows to down's NVFP4 input in its epilogue (tf_ck4_up_nvfp4_prompt), the
    bytes tf_ck_quant4 makes of the bf16 rows, so prompt passes no longer write the bf16 up rows and read them back.
  • One GPU: the prompt down kernel runs both width shares of a pair and adds them in share order before the bf16
    rounding tf_super_combine applies (tf_ck4_down_sum_prompt); the combine and the shared add read one bf16 row a
    pick instead of two fp32 rows (tf_super_combine_sums, tf_super_moe_out_sums). Decode windows (which may run the
    shared expert on nemotron: Super's latent shared expert plans once at load and, on one GPU, runs beside the routed experts (stacked on #996, #999) #1002's side stream) and tensor-parallel ranks keep fp32 shares; the join stays before the shared add.
  • Router logits of passes over 32 aligned rows run on 128-row by 128-expert register tiles (tf_nemo_router_tiles),
    each logit still one fma chain over its slice in input order. Up to 16 rows keep tf_nemo_router_rows, 17 to 32
    rows and unaligned rows tf_nemo_router.
  • Kernel contract: the eight new launches are registered, each replaces the kernel(s) it stands in for and is
    compared with them byte for byte; usage records from kernel-contract-limits over sm_80/86/89/120/121 fatbins.
  • tf-cuda-test checkpoint (new) compares the prompt kernels and the combine after them with the decode path byte for
    byte on synthetic FP8 and NVFP4 inputs; tf-cuda-test glue compares the router tiles with tf_nemo_router and the
    host reference at Super's router shape.
  • docs/recipes/nemotron-3.5-super-vl.md says which prompt passes take the tiles; docs/kernel-contract.md lists them.

Receipt

Raw receipts: receipts/nemotron/checkpoint-prompt-tiles (README.md maps every file to its binary, summary.md has every run).

  • Environment: this branch at a79678c5624e55f5b009700e4d953e8034de9336 against its base
    50a34190b04055ff9268cc12f9d8284323830a25 (the merge of nemotron: decode forms of Super's latent top-k and NVFP4 experts on CUDA, same bits #999 and nemotron: Super's latent shared expert plans once at load and, on one GPU, runs beside the routed experts (stacked on #996, #999) #1002). Both built from clean checkouts with
    zig build fatbins -Dsm=121 -Dnvcc=…, zig build native and zig build install (-Doptimize=fast -Dstrip=true -Dtarget=aarch64-linux-gnu.2.28 -Dcpu=baseline -Dversion=1.0.12, zig 0.17.0; builds.txt). tensorfold-native
    sha256: base 38cb28f3e07de241d172d7579c9b1b55a291bdfc45475506c2e5a7c443236dc4, branch
    692e2fd510491ae264fac0deaa66b6453eacc367adb50badeda332a3d1279d17; tf-cuda-test: base
    08662952ea63e65d7733aea06130985467b17deee4fbcfe51d23823a28935e62, branch
    68646553a7b3e3cec21efd411bd3940102ea68966f7b33d460e8ec1158a51dc2. A DGX Spark (GB10), CUDA 13.0 (nvcc
    13.0.r13.0), driver 580.173.02, for the cold prefills; a second DGX Spark for the decode holds and tf-cuda-test.
    nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4@82d93699acd3be9e4617c53360fe5b3f5dbeb1b3, served as
    tensorfold-native serve <checkpoint> --name super --no-update-check --prompt-cache-gib 0 on loopback (plus
    --context 131584 for the prefills) with TF_HEAT_HIGH=85 TF_HEAT_LOW=75, everything else default (checkpoint math
    and MTP drafts on). Every hold is a fresh server; each binary's window-cost cache was deleted before its first boot
    on each node. Every receipt JSON carries source_commit and binary_sha256.

  • Exactness: in each of the four decode holds bench_concurrent.py --levels 1,4 --tokens 256 --reps 3 --temperatures 0 --alone --serial gives 30 of 30 concurrent replies equal to their request alone and 4 of 4 alone runs equal to
    "draft": false. Both prompts' drafted token_sha256 equals "draft": false, and the hashes are the same on the
    base and the branch: code 51e4c630298a14a1…, chat 161034fd0a090a34…. In every prefill hold the 16-token reply
    to each token array equals its "draft": false reply, and the hashes are the same on the base and the branch at
    every size: 2,048 027891eacb707268…, 8,192 80b2b503a848b4d0…, 32,768 70fb5c3caf050d1c…, 65,536
    2e8f1a6db1bf3a71…, 131,072 29cb05e3461a3e2f….

  • Prompt speed: bench_cache.py --require-cold --tokens 16 --repeats 1 --streams 1 --expected-prompt-tokens N on
    token arrays of N ids (a log of varied, numeric text; ids_sha256 in each hold's JSON), three cold requests a size
    in each of four holds in the order base, branch, branch, base (cached_tokens 0 on every request), 2k to 64k in one
    set of holds and 128k in a second. The GPU reached the heat guard's 85 C on these runs and the server logged heat
    waits inside the requests; the table is net of them (each request's ttft_s minus the heat_wait_s the server
    logged inside it; every request in summary.md). Medians of 6 requests:

    prompt tokens base net ttft_s branch net ttft_s branch / base (gross medians, base → branch)
    2,048 1.216 1.030 0.846 1.222 → 1.030
    8,192 4.435 3.278 0.739 8.428 → 3.278
    32,768 13.088 9.589 0.733 34.081 → 22.571
    65,536 25.864 19.244 0.744 69.903 → 51.146
    131,072 55.855 41.994 0.752 145.836 → 123.970
  • Decode speed, bench_openai.py --tokens 256 --reps 3 --temperatures 0 (medians of 3; all runs in the receipt). The
    decode prompts are under 128 tokens, so no new kernel runs; the table shows decode is level:

    run code (fibonacci-raw) tok/s prose (gpu-chat-no-think) tok/s
    base 1 47.14 36.40
    branch 1 47.02 36.21
    branch 2 47.14 36.32
    base 2 47.07 36.35
    median of 6 runs, base → branch 47.11 → 47.08 (-0.1%) 36.38 → 36.27 (-0.3%)
  • Tests run:

    • zig build test: 1377 passed, 7 skipped, 0 failed (base: the same; the new tests are GPU tests).
      zig build test-kernel-contract: 18 of 18. zig build test-golden: 309 of 319 equal, 0 unexpected differences
      (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.
    • GPU: tf-cuda-test checkpoint 7 of 7 PASS (NVFP4 experts at 258 pairs over 2 experts and 28,800 pairs over 96;
      share sums at Super's routed and shared-expert shapes; FP8 129 rows at three shapes). tf-cuda-test glue:
      PASS glue: 1332 of 1332 comparisons byte-equal. tf-cuda-test modelopt: 5 of 5 PASS.
      tf-cuda-test kernel-contract:
      SUMMARY 23 kernels: 23 pass gates 1-4, 0 fail, 0 known findings; 5 controls: 5 red as planted, 0 missed; 0 limit problems.
      tf-cuda-test kernel-contract-limits on sm_80/86/89/120/121 fatbins of the same checkout: PASS kernel-contract-limits: every registered launch fits sm_80, sm_86, sm_89, sm_120 and sm_121, every control red.
    • Failing receipts: the new tests call kernels the base does not have, so they were run on the branch with two
      planted changes (gpu/mutant.diff): the prompt down rounds share 0's sum to bf16 before adding share 1, and the
      router tiles take each word's high input before its low one. checkpoint: the experts still pass, then FAIL checkpoint share sums through the combine: first difference at byte 4, 21405 of 32768 words differ. glue: FAIL glue: 7 of 1332 comparisons differ (the router partials, the top-k weights after them and the Super router tile
      cases). kernel-contract: SUMMARY 23 kernels: 21 pass gates 1-4, 2 fail (gate 3 of tf_nemo_router_tiles and
      tf_ck4_down_sum_prompt).
  • Not run, and why: Metal (no Mac here; the change is CUDA-only). TP=2 across two GB10s: ranks keep fp32 shares, but
    their prompt passes take the 128-row FP8 and expert tiles too; not served. A non-latent Nemotron (Nano): its router
    takes the tiles past 32 rows too; covered by glue's router cases at 300 rows, not served. Resumed against fresh
    prompts: not exercised (--prompt-cache-gib 0 throughout). No planted
    change in the FP8 128-row tiles: they are the 64-row tiles' template at a wider row tile, and checkpoint compares
    them with rows run one at a time. Prompt speed is compared with this branch's base (nemotron: decode forms of Super's latent top-k and NVFP4 experts on CUDA, same bits #999 and nemotron: Super's latent shared expert plans once at load and, on one GPU, runs beside the routed experts (stacked on #996, #999) #1002), not with the
    1.0.12 release build.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Drafted vs "draft": false at every prompt size and concurrent vs alone measured above; resume not exercised separately.)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (No bits change: each new kernel keeps the replaced kernels' sums in their order, byte-compared by the contract's gate 3, checkpoint and glue, and the replies hash the same.)
  • A new or changed GPU kernel is registered with the kernel contract (docs/kernel-contract.md); each backend's SUMMARY line is in the receipt. (CUDA above; no Metal kernel changed.)
  • Prompt processing is no slower than the last release. (Cold ttft_s above, against the base.)
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (checkpoint is a tf-cuda-test command on synthetic inputs; failing receipts from planted changes, above.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

…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.
…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.
ck.lane8 took its widest FP8 tile at 64 rows by 64 columns. Calls of 128 rows or more now take tf_ck8_128 (128 rows by
64 columns) or, where K slices meet in a cluster, tf_ck8_128c (128 by 128): eight warps in two rows of 64, up to
64 KiB of shared memory. Each row keeps its K slices, MMA steps and summation order, so its bits are the decode tiles'.
`tf-cuda-test checkpoint` compares 129-row calls with the same rows one at a time at three shapes.
…by 128-column tiles

A pass of 128 rows or more (ck.prompt_tokens) plans its routed and shared experts in items of 128 pairs
(ck.prompt_tile) and runs them on tf_ck4_up_relu2_prompt and tf_ck4_down_f32_prompt: a block takes one item of one
expert by 128 columns, eight warps of 64 rows by 32 columns over a four-step cp.async pipeline, inputs through
ldmatrix, and the next unit's first steps load under this one's epilogue. Each output keeps the decode warp's
block-scaled MMA chain over K steps in order and its epilogue, so prompt rows are byte-equal to decode rows. Calls under
128 rows keep the 16-pair warps (decode-sized calls the _few ones). `tf-cuda-test checkpoint` compares both directions
with the decode warps at 258 pairs over 2 experts [192, 256] and 28,800 pairs over 96 experts [1344, 1024].
The prompt up tiles turn each relu^2 block of 16 into tf_ck_quant4's e4m3 scale and e2m1 codes from the same bf16
values, staged through shared memory and written out as whole rows (tf_ck4_up_nvfp4_prompt). Prompt passes no longer
write the bf16 up rows nor read them back to quantize; decode keeps its up kernels and quant4. `tf-cuda-test
checkpoint` compares the prompt rows with decode up followed by quant4 under a down input scale of 0.375.
…th shares into bf16

On one GPU a prompt down block (tf_ck4_down_sum_prompt) takes a first-share plan item and runs each pair's shares in
turn (pair + s on expert s * experts + e), adds the alpha-scaled sums in share order and rounds to bf16 as
tf_super_combine rounds the share sum. The combine and the shared add then read one bf16 row a pick
(tf_super_combine_sums, tf_super_moe_out_sums) instead of two fp32 rows, with the same fma and add order; the routed
and the shared expert rows both come from it (cuda_latent_ck.summed). Decode passes, which may run the shared expert
on the side stream, and tensor-parallel ranks keep fp32 shares. `tf-cuda-test checkpoint` checks the combine and the
shared add over the sums against decode's fp32 shares at Super's routed (1,408 picks, 8 experts) and shared-expert
shapes.
…expert register tiles

tf_nemo_router_tiles stages two 32-input steps of 128 rows and 128 experts; a thread keeps 8 rows by 8 experts in
registers and runs every logit's fma chain over its slice in input order, so the partials keep their bits.
Glue.logits picks the router kernel for Nano's and Super's routers alike: up to 16 rows keep tf_nemo_router_rows, 17
to 32 rows and unaligned rows tf_nemo_router (two of its 16-row tiles fill the GPU better than one mostly empty
128-row tile), longer aligned passes the tiles. routerShared and tiles_shared give the bytes each stages.
`tf-cuda-test glue` compares the tiles with tf_nemo_router and the host reference at 33 and 300 rows (4,100 against
tf_nemo_router), and 32 rows on tf_nemo_router.
…re-sum glue, bit-equal to the kernels they replace

tf_ck8_128c and tf_ck8_128 replace the 64-row FP8 tiles at prompt rows (slices met in a cluster, and by tf_ck8_reduce
on a Ck loaded without clusters); tf_ck4_up_nvfp4_prompt replaces tf_ck4_up_relu2 then tf_ck_quant4,
tf_ck4_down_f32_prompt replaces tf_ck4_down_f32, and tf_ck4_down_sum_prompt replaces tf_ck4_down_f32 then
tf_super_combine's share sum; tf_nemo_router_tiles replaces tf_nemo_router; tf_super_combine_sums and
tf_super_moe_out_sums replace tf_super_combine and tf_super_moe_out over the fp32 shares. Gates 1 and 3 compare bytes
with the replaced kernels, gate 4 runs mirrored sums exact in fp32 (prompt_up's as the bytes quant4 makes of its
rows). Ck.lane8Tile runs lane8 on a chosen row tile for the test. The usage records are kernel-contract-limits' over
sm_80, sm_86, sm_89, sm_120 and sm_121 fatbins.
@ashhart
ashhart merged commit 739c924 into ashhart:main Oct 18, 2026
4 checks passed
ashhart added a commit that referenced this pull request Oct 18, 2026
…ron_latent.cu, nemotron_route.cu and ck.zig
ashhart added a commit that referenced this pull request Oct 18, 2026
… on nvcc 13.0 and 13.2, with 13.2's other new records

kernel-contract-limits read their usage from every SM's image built with nvcc 13.0 and with 13.2. 13.0's values make
glm_cuda_records.zig's 33 records, which replace the pending list, and 13.2 differs on six of them. On 13.2 the
Mamba scan and the NVFP4 prompt down and summed-down kernels also take more registers on sm_120 and sm_121, so 13.2's
set holds those too; #1008's other six launches hold on both compilers as recorded. The host tests now expect a
measured record for every GLM launch they load.
ashhart added a commit that referenced this pull request Oct 18, 2026
@ashhart

ashhart commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you, @plotarmordev, for the FP8/NVFP4 prompt tiles, byte comparisons and failing kernel controls.

We merged the work for 1.1.0 in 739c924, keeping sibling plans, 32-row controls and the conservative shared/two-rank schedule. Multiple ranks retain fp32 shares until the existing join.

NVIDIA GB10/RTX PRO 6000 prompt/resource checks passed; GB10 Super VL retained 17/17 and chat/concurrency parity.

Posted by Ash's AI Assistant Synthena

BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…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.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…, nemotron_latent.cu, nemotron_route.cu and ck.zig
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
… on nvcc 13.0 and 13.2, with 13.2's other new records

kernel-contract-limits read their usage from every SM's image built with nvcc 13.0 and with 13.2. 13.0's values make
glm_cuda_records.zig's 33 records, which replace the pending list, and 13.2 differs on six of them. On 13.2 the
Mamba scan and the NVFP4 prompt down and summed-down kernels also take more registers on sm_120 and sm_121, so 13.2's
set holds those too; ashhart#1008's other six launches hold on both compilers as recorded. The host tests now expect a
measured record for every GLM launch they load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants