Skip to content

cuda: the staged NVFP4 prompt entries leave an expert's items alone (skip), as the decode form does - #764

Merged
ashhart merged 1 commit into
ashhart:mainfrom
Bizuayeu:pr/nvfp4-prompt-skip
Oct 16, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
Bizuayeu:pr/nvfp4-prompt-skip

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

A family that computes one expert itself (GLM-5.3-Flash stacks its BF16 shared expert as the last expert id) plans
every pair together and has the grouped kernels skip that id. The decode form already takes skip;
Grouped.prompt refused it with OptionNotBuilt for NVFP4. The prompt entries now take skip and return before
staging any rows of that expert's items. Nemotron passes -1, so its bits do not change.

Receipt

  • Environment: TensorFold 1.0.10 (6c5e5192) plus this change; one GB10 (DGX Spark, sm_121, CUDA 13.3).
  • Exactness: with skip = -1 the kernels run as before. tf-cuda-test quant-ref now runs the prompt gate-up and
    down twice on one routed plan (300 rows, 4 slots, the shared expert last), without and with the shared expert
    skipped: its pairs' rows keep what the buffer held, and every other pair's row equals the run without skip, byte
    for byte, for fp8 and nvfp4.
  • Decode and prompt speed: not applicable (one compare at an item's start).
  • Tests run:
    • tf-cuda-test quant-ref: 4 PASS, 0 FAIL; the nvfp4 skip check fails on main with OptionNotBuilt.
    • zig build test-cuda-host: 451 passed, 0 failed. zig build test: 553 passed, 5 skipped, 0 failed.
    • zig fmt --check: clean. lean_check: 523, as main.
  • Not run, and why: Metal (CUDA only).

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.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Prompt processing is no slower than the last release.
  • 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.
  • 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.

@Bizuayeu

Copy link
Copy Markdown
Contributor Author

Rebased onto 1.0.9 (c36b536d), the commit's lines unchanged. Host tests 429/429, zig build test 484 passed, 5 skipped.

…skip), as the decode form does

A family that computes one expert itself (GLM-5.3-Flash stacks its BF16 shared expert as the last expert id) plans
every pair together and has the grouped kernels skip that id. The decode form already takes skip; Grouped.prompt
refused it with OptionNotBuilt for NVFP4. The prompt entries now take skip and return before staging any rows of
that expert's items. Nemotron passes -1, so its bits do not change.

quant-ref now checks it: with the shared expert skipped, its pairs' prompt rows keep what was there and every
other pair's row equals the run without skip, for fp8 and nvfp4.
@Bizuayeu
Bizuayeu force-pushed the pr/nvfp4-prompt-skip branch from 6f3991b to 3a576e3 Compare October 14, 2026 12:25
@Bizuayeu

Copy link
Copy Markdown
Contributor Author

Rebased onto 1.0.10 (3a576e32). #805 split the prompt rows into prompt_tiles and the prompt_body that dispatches to it, so the skip check now sits in prompt_body, before any tile is staged; the changes to experts.zig and the quant-ref test are unchanged. quant-ref 4 PASS, and the description's counts are from this head.

@ashhart
ashhart merged commit 19fcfcd into ashhart:main Oct 16, 2026
4 checks passed
ashhart added a commit that referenced this pull request Oct 16, 2026
Recall (off unless asked for), model discovery's reasoning efforts (#819), the NVFP4 prompt entries' skip (#764) and Nemotron's CUDA decode router, top-k and add_moe_norm (#833), gated on the candidate before Living Weights' key, snapshot and rollback. Two conflicts: the CHANGELOG's Unreleased list, where both sides' lines are kept in landing order, and the server main's imports, where all four are kept.
ashhart added a commit that referenced this pull request Oct 16, 2026
The contributor's five GLM commits landed above, with our fixes after them; the head's first seven commits are the same changes as #757, #758, #766, #762, #764 and #763, which the candidate already has from their own heads. This keeps the PR's head in the history with no change to the tree.
@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @Bizuayeu. Letting the NVFP4 prompt entries skip an expert, as the decode entries already do, removes a real blocker for a family that computes its shared expert itself.

It ships in TensorFold 1.0.12 under your name (a90017a14), with one commit of ours after it (b50341f6c) that wraps quant-ref's new lines at 120 columns. Your head is merged after them with no change to the tree, so this pull request shows as merged.

On a GB10, tf-cuda-test quant-ref passes the skip case for FP8 and NVFP4: the skipped expert's prompt rows keep what the buffer held, and every other row equals the run without skip. Nemotron passes -1 on every call, so its NVFP4 replies are the same tokens: drafted equals "draft": false in all 17 release cells, chats equal the cache-off server's, and 2, 4 and 8 concurrent streams equal their solo runs. Cold prompts of 2k to 64k tokens ran within 0.3% of the build before.

No caller passes a real expert id yet, so quant-ref alone covers the skip path until a family such as GLM-5.3-Flash on CUDA starts passing its shared expert.

Posted by Ash's AI Assistant Synthena

@Bizuayeu

Copy link
Copy Markdown
Contributor Author

@ashhart, for the record: GLM-5.3-Flash on CUDA already passes a real id here. cuda_moe.zig passes its BF16 shared expert's id (l.count) as skip to both the gate_up and down entries, on prompt chunks and on decode, so #804's lane checks and served runs go through the skip path with a real expert.

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