Repository navigation
cuda: grouped experts behind one call (experts.zig): Nemotron's 4-bit experts route through it, block-FP8 experts join - #605
Conversation
… experts route through it, block-FP8 experts join
e5d7d2a to
aaa5579
Compare
|
Thank you, @jschmied. This is merged into main (c93351f), your commit as it was, and it ships in 1.0.6. On a GB10 against main: One commit of ours on top, 6ed796d: we are retiring the Python engine, so tooling that imports it doesn't land in the tree, and it removes |
The grouped-MoE step from #548: one call for grouped experts on #558's plan, with a layer view per format and decode and prompt rows apart. Rebased on main after #602 and #591. #591's
tf-cuda-test trainpacked experts with Nemotron'spack_expertsdirectly; it now packs throughAffine4Experts.pack, the same launch, as 9041e20 did for #602.cuda/experts.zig:Layer(format, up/down tables, their scales, width, dims, experts, SwiGLU limit),Epi(up with the format's activation, down to fp32 or to bf16 sums) andRows.Grouped.decodeandGrouped.prompttake the plan and a bound on its items. A format that isn't loaded is refused before any launch, as is an epilogue or option its kernels weren't built with.Affine4Expertsholds Nemotron'sexperts.cu,experts_prefill.cuandexperts_pack.culaunches, moved unchanged:run,runPrompt,pack,bytes.Fp8Expertsadds block-FP8 experts (fp8/experts.cu's device code, decode and prompt forms) with the Python packing.families/nemotron/cuda_kernels.zig:Kernelsholds oneAffine4Expertsinstead of five functions and the occupancy pair.Ops.expertsandOps.expertsPrefilldelegate, so no caller changes.Affine4Experts.pack.tf-cuda-test fp8-experts <dir>withoracle/fp8_experts.py, throughGrouped. It uses the pattern from d7469ca: a blocking stream, and outputs filled before each call.NVFP4 experts follow as their own PR on the same
Grouped(decode rows). @Bizuayeu's staged kernel then takes NVFP4's prompt rows, as agreed in #548.Receipts on GB10 (DGX Spark, sm_121, CUDA 13.0).
main(2f8284e) and this branch were each built with nvcc forsm_121:zig build testpasses andlean_checkis clean for the touched files.zig fmt --check build.zig zigflags only files outside this PR.tf-cuda-test fp8-expertsagainstfp8/experts.py(python-0.6 lineage), 33 experts x [512, 2560], 7 slots: the packing and scales, then the plan, gate-up and down. Decode at 1 and 3 rows (7 and 14 items) and prompt at 300 rows (the wide plan, 40 items) are byte-equal. The device code is the copy whose SASS we compared with the Python build's on 10-09 (6/6 instances).d9d758fb, every expert packed and launched through the moved code:tensorfold check-kernels: 1,008 of 1,008 projection cases and 384 of 384 forked-MoE cases (the decode experts), both builds.tensorfold run: three prompts (11, 20, 1,090 tokens; the long one's prefill takesexperts_prefill), greedy and sampled (0.8 / 20 / 0.95, seed 7). All six reply hashes equal main's:5923b40d570b,d38725819372,ead827be94f5,bb8855c2f084,068276d3ec75,a6961a8c7589.After the rebase, on main
9041e20aand this branch:tf-cuda-test trainpasses (every kernel within 2.40e-6 of its f64 reference),fp8-expertsis byte-equal, andcheck-kernelsplus the six Nemotron reply hashes are equal.