Repository navigation
cuda: grouped NVFP4 experts behind experts.Grouped (decode rows); prompt rows refused until a staged kernel takes them - #629
Conversation
… experts route through it, block-FP8 experts join
…mpt rows refused until a staged kernel takes them
4678ffa to
a6166f6
Compare
|
Thank you, @jschmied. This is merged into main (a43975e) on top of #605 and #595, your commit as it was, and it ships in 1.0.6. The GB10 gate is the one in #595: Nemotron's paths unchanged with Refusing NVFP4 in |
|
Thanks, @jschmied. This is the entry point we were waiting for in #548. #641 puts the staged NVFP4 prompt kernel behind |
|
Update: #641 is closed. By the time it opened, main already had a staged NVFP4 prompt kernel (a6aa478); I'd missed @ashhart's note in #548. The comparison on GLM's real experts continues there: #548 (comment) |
… (decode rows) Thanks @jschmied. # Conflicts: # zig/tests/cuda/main.zig
Grouped NVFP4 experts behind
experts.Grouped, as agreed with @Bizuayeu in #548. Decode rows run onnvfp4/experts.cu, andGrouped.promptrefuses NVFP4 until their staged prompt kernel takes those rows. Stacked on #605; this PR's own commit is the last one. Rebased on main9041e20awith #605; the receipts below hold after the rebase.cuda/experts.zig:Formatgainsnvfp4.Layerdocuments its tables: [E][NI/32][D/32][2][144] int32 blocks for gate and up, [E][D/32][NI/32][1][144] for down, and per-expert global scales.Nvfp4Experts(load,run,packOne,packGateUp) carries the Python packing (_pack's nibble order and scale bytes) and the three epilogues (SwiGLU gate-up, down to fp32, down to bf16 sums).Grouped.decodedispatches to it.Grouped.promptreturnserror.PromptFormNotBuiltfor NVFP4.zig/kernels/cuda/nvfp4_experts.cu: the device code ofnvfp4/experts.cu, and thenvfp4_expertsfatbin.tf-cuda-test nvfp4-experts <dir>withoracle/nvfp4_experts.py: the packing and global scales, the plan, then up and down throughGrouped.decode, with a blocking stream and outputs filled before each call. The 300-row case runs the decode form with bf16 sums, asnvfp4/experts.pydoes for prompt rows today, and also checks thatGrouped.promptrefuses.Receipts on GB10 (DGX Spark, sm_121, CUDA 13.0), this branch built with nvcc for
sm_121:zig build testpasses;zig fmt --checkis clean for the touched files, andlean_checktoo.tf-cuda-test nvfp4-expertsagainstnvfp4/experts.py(python-0.6 lineage), byte-equal in every case:tf-cuda-test fp8-experts(from cuda: grouped experts behind one call (experts.zig): Nemotron's 4-bit experts route through it, block-FP8 experts join #605) still passes on this build.Nemotron 3.5 Lightning MLX-4bit @
d9d758fb:tensorfold check-kernels: 1,008 of 1,008 projection cases and 384 of 384 forked-MoE cases.tensorfold run: the six reply hashes from cuda: grouped experts behind one call (experts.zig): Nemotron's 4-bit experts route through it, block-FP8 experts join #605 (three prompts, greedy and sampled):5923b40d570b,d38725819372,ead827be94f5,bb8855c2f084,068276d3ec75,a6961a8c7589.The device code is the copy whose SASS we compared with the Python build's on 10-09 (3/3 instances). @Bizuayeu ran the same kernels on GLM-5.3-Flash's real experts (layer 3, widths 2048 / 1024 / 704), including
swiglu_limit, a skipped slot anddown_scale, all equal (Zig CUDA ports: shared layers belowlanes.Backend, and one place to coordinate them #548).