Repository navigation
nvfp4 experts cuda: decode up to 24% faster (GLM-5.3 83.8 -> 104.1 tok/s), same bits, via a per-warp cp.async ring - #2266
Conversation
|
Thanks @eleqtrizit. The ncu read is clear (long-scoreboard stalls with DRAM 30% busy), and the change keeps the sums where they were: the same
The bit-equality reads right from the code. |
|
I'll run on a GB10. Give me some time. |
|
Thanks for the careful read. All four are below. sm_121 (GB10, nvcc 13.0.88, driver 580.178.04), head e29bc7d Filtered to the NVFP4 expert decode CTAs, every launch fits and matches its nvcc 13.0 record:
You're right about occupancy. On sm_12x the 4-warp waves gate-up CTA (34 KiB static plus the 1 KiB reservation) now fits 2 blocks per SM. Main's register-only version fit 4. However, each warp now keeps 4 k-groups of loads in flight instead of about 1, so bytes in flight per SM still go up. Measured on GB10 with Qwen3.6-35B-A3B-NVFP4 @1355db6a, 4 ABBA rounds with fresh servers (tok/s, median [min-max]):
nvcc 13.0 timing GLM-5.3-Flash FP4-Local on 2x RTX PRO 6000 Blackwell, TP=2, built with nvcc 13.0.88, 2 ABBA rounds:
Every min-max spread is within 0.4%. The token_sha sets match the nvcc 13.4 runs exactly. The GB10 table above was also built with 13.0.88. Sampled decode and 4 ABBA rounds for the GLM headline GLM-5.3-Flash FP4-Local, 2x RTX PRO 6000 Blackwell, TP=2, nvcc 13.4, main cde4fe7 vs e29bc7d, 4 ABBA rounds (base, cand, cand, base twice) with fresh servers, median [min-max]:
|
|
Thanks @eleqtrizit, all four are answered: the sm_121 contract with every decode CTA on its nvcc 13.0 record, a GLM
|
|
@eleqtrizit, one note on reach, for when you answer the three asks: Flash Next's NVFP4 decode also launches
|
|
Thanks @ashhart, all three are below. 1. Nemotron on a GB10 nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-NVFP4 @bee75962 on GB10 (sm_121, nvcc 13.0.88, driver 580.178.04), MTP drafts on (the default), main 6ec5fa4 vs e29bc7d. These are the same two builds as the Qwen3.6 table. 4 ABBA rounds (base, cand, cand, base twice) with fresh servers, tok/s, median [min-max]:
2. The code-sampled 1-stream cell (Qwen3.6, GB10)
3. CHANGELOG Added under Unreleased in 826042e, with "(#2266, fixes #2265)". The CHANGELOG is the only file it adds. It conflicts textually with main's newer Unreleased lines only. |
|
Thanks, @eleqtrizit, these are clear. On Nemotron 3.5 Lightning NVFP4, no cell is slower: eight of the twelve are outside main's range, all faster, and the token hashes are identical, greedy and sampled. The Qwen3.6 cell is the one thing in the way. Your rounds put the code prompt, sampled at one stream, at 132.4 [130.6-132.8] against main's 134.8 [134.2-135.2]. The ranges don't overlap, so it's a real 1.8% loss, and we don't land changes that make a served cell slower, even beside gains elsewhere. We think the halved occupancy is the cause. Each kernel's resident-block count comes from the occupancy query ( Could you log which path When you next push, please end the line with "Thanks to @eleqtrizit." The CHANGELOG conflict is ours to settle. |
53e8147 to
9f464b6
Compare
9f464b6 to
dc4b781
Compare
|
Thanks @ashhart. I logged it, and Occupancy doesn't explain the loss. A D=2 ring brought resident blocks back to So GB10 now keeps register loads: on GB10 (sm_121, nvcc 13.0.88), 4 ABBA rounds with fresh servers, main 6ec5fa4 vs e29bc7d + the register form, tok/s, median [min-max]:
The other Qwen3.6 cells are -0.2% to +0.7%, and the 12 Nemotron 3.5 Lightning NVFP4 cells are -0.3% to +0.4%. Ranges overlap main in every cell, so I read this as level with main, not faster. The sm_121 records are updated from real compiles. On GB10 all 10 decode CTAs pass their limits and all 608 kernels pass gates 1-4. That contract run still exits non-zero with 170 limit problems, all in kernels this PR doesn't touch: 168 "no compiled usage recorded" on Qwen and NVFP4 tile kernels, and two Preprocessed source for sm_80/86/89/120 is byte-identical with and without this change, so those results stand. sm_80 has still never been run on this PR. The CHANGELOG line now ends with "Thanks to @eleqtrizit." Flash Next NVFP4 at 1, 2, 4 and 8 streams is yours when you're ready. |
|
@eleqtrizit thanks, this settles the GB10 question cleanly.
The CHANGELOG conflict is ours. |
|
Thanks @ashhart. Results on 1. Qwen3.6-35B-A3B NVFP4 on sm_120 (RTX PRO 6000 Blackwell, one card, nvcc 13.4.92, @1355db6a, 4 ABBA rounds with fresh servers, tok/s, median [min-max]):
The four 2. Flash Next NVFP4 on sm_120 (
Level with main: 14 of the 16 cells overlap main's range, and the other two (greedy at 8 streams, code and chat) are faster. 3. sm_80: I can't reach an A100, so it remains unrun. 4. SASS on sm_121a: nvcc 13.0.88, 5. Lean checker on this head: 398 vs 398 at the merge base, 0 new. One CHANGELOG note: the last rebase had left our line at the end of |
|
Thanks @eleqtrizit, that answers everything:
Since GB10 now builds main's kernels, the GB10 runs we listed on 6 Nov would compare a kernel with itself. Instead, we'll |
|
Thanks @eleqtrizit. Our two checks on a GB10 are clean on
With your sm_120 numbers (GLM-5.3 at TP=2 up to 24% faster, Qwen3.6 4-15% faster, tokens equal) and these, it's queued to land, with your CHANGELOG line as written.
|
2efcaa4 to
e8ae8e1
Compare
|
@eleqtrizit this was in a landing train today, but
|
|
Our GB10 check is in: GLM-5.3-Flash NVFP4 at TP=2 on two GB10s (sm_121), main against e8ae8e1, fresh launches base, new, new, base, plus a chat pair.
The +24% in your description was measured on RTX PRO 6000 (sm_120) with drafts off. It doesn't show up on GB10's sm_121 path, but nothing gets slower there either. That's all we need. It's queued to land.
|
…hrough a per-warp cp.async ring ncu showed nvfp4_expert_half stalled on long scoreboard (~110k cycles a warp): the register pipeline kept about one k-group in flight and the activation loads missed L1, while DRAM sat near 30% busy. Each warp now keeps a 4-stage cp.async ring in shared memory for its weight words, block scales and x halves, and computes in the same k order, so sums are bit-identical. GLM-5.3 FP4-Local, 2x RTX PRO 6000 TP=2: one-row gate-up 69.8 -> 31.7 us; plain decode 90.0 -> 105.7 tok/s; reply shas unchanged, drafted == plain. Kernel contract: 551 pass gates 1-4, limit problems unchanged. The half gate-up limit records (regs, static shared bytes) come from nvcc 13.4.92.
…per-warp cp.async ring The ring that made the half gate-up kernel bandwidth-bound now feeds the classic and waves decode kernels too (gate-up and down, 1 and 4 warps): one Ring helper streams each warp's words, scales and inputs D = 4 k32 groups ahead, and the sums still run in k order, so every kernel keeps its bits. GLM-5.3 FP4-Local, 2x RTX PRO 6000 TP=2, against the half-kernel ring alone: drafted code 220.1 -> 229.0 tok/s, code-long 172.9 -> 175.9, chat 177.6 -> 182.1; plain 105.7 -> 107.9. Reply shas unchanged, drafted == plain. Decode bench, one row: classic gate-up 88.0 -> 38.5 us, down 19.7 -> 13.1 us. Limit records here are nvcc 13.4.92's; the 13.0 base and 13.2/13.3 sets are still to be re-derived.
…13.2.78 set (13.3.73 compiles as 13.2)
On sm_121 the shared-memory ring halved resident blocks and cost Qwen3.6 code sampled 1.8% at one stream; a D=2 ring restored occupancy and kept the loss. GB10 now loads two stages in registers with no shared memory, level with main. Preprocessed source for sm_80/86/89/120 is unchanged. sm_121 limit records come from real nvcc 13.0.88 and 13.2.78 compiles.
e8ae8e1 to
664e530
Compare
|
Thank you @eleqtrizit. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
The NVFP4 decode expert kernels (nvfp4_expert_kernel, nvfp4_expert_waves, nvfp4_expert_half) stall on load latency. Each warp now keeps a D=4 shared-memory ring that cp.async fills with its weight words, block scales and both rows' inputs. Every group is summed in the same k order as before, so the output is bit-identical. All three kernels share one
Ring<M, WARPS, Word>helper. GB10 (sm_121) keeps two register-loaded stages with no shared memory, because the shared ring cost a served Qwen3.6 cell 1.8%. The contract records are regenerated from nvcc 13.0.88, with a 13.2.78 override set; 13.3.73 compiles the same as 13.2.atc overlap --json: the kernel files merge cleanly. Only the CHANGELOG line can conflict textually with other open PRs' Unreleased lines.Checks on this head
zig buildexit 0;zig build test test-kernel-contract test-golden fuzz-cortheonexit 0tools/pr_check.py: 0 errors, 0 warnings)cuobjdump -sassand-res-usageon sm_121a (nvcc 13.0.88), main vs this head: byte-identical for all 19nvfp4_expertsfunctions, including the 10 decode CTAsReceipt
bench_concurrent.py --alone --serialequal on both sides (GLM 48/48 alone, 16/16 serial; GB10 240/240 and 80/80 for Qwen3.6, and the same for Nemotron). GLM drafted == plain on every prompt.Kernel contract
qwen35_kv8register counts over their records. Not compared against plain main.Checklist
"draft": false, and concurrent equals solo.