Repository navigation
Conversation
… experts route through it, block-FP8 experts join
…mpt rows refused until a staged kernel takes them
…uped Grouped.prompt took NVFP4 layers only as a refusal (ashhart#629). Prompt rows now run on nvfp4_experts_prompt.cu, the device code of the BIZ 2.x engine's nvfp4/experts_prompt.cu (Bizuayeu/TensorFold release/2.8.0), the kernel GLM-5.3-Flash's NVFP4 prompt chunks use there: items of 64 pairs x 128 columns staged through shared memory, each weight exact in bf16 and each 32-input block's mma sum added in fp32, the (expert, matrix) scale last. A pair's bits depend on its row and its expert alone; they are not the decode kernel's, so a prompt row is compared with prompt rows only. - experts.zig: Nvfp4Experts loads the prompt module beside the decode one (three instances: SwiGLU gate-up on two stages, fp32 and bf16 down on three; 34,816 and 38,400 bytes of shared memory a CTA) and runPrompt launches a CTA an (item, four column blocks); both forms share one argument list. Grouped.prompt dispatches NVFP4 to it. - tf-cuda-test nvfp4-experts: oracle/nvfp4_experts.py adds staged rows (64, 300, 1000) routed in items of 64 from the BIZ 2.x engine's prompt_gate_up and prompt_down; the test checks the plan, up, and down as bf16 sums and as fp32 through Grouped.prompt.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NVFP4 prompt rows behind
experts.Grouped, the entry point @jschmied left in #629 for the kernel we agreed on in #548. Stacked on #629 (and so #605); this PR's own commit is the last one.zig/kernels/cuda/nvfp4_experts_prompt.cu: the device code of the BIZ 2.x engine'snvfp4/experts_prompt.cu(Bizuayeu/TensorFoldrelease/2.8.0), the kernel GLM-5.3-Flash's NVFP4 prompt chunks run on there.cuda/experts.zig:Nvfp4Expertsloads the prompt module beside the decode one.runPromptlaunches a CTA per (item, four column blocks), and both forms share one argument list.Grouped.promptdispatches NVFP4 to it, so thePromptFormNotBuiltrefusal and its test are gone. A host test checks the refusal when the format is not loaded and the shared-memory sizes.tf-cuda-test nvfp4-experts:oracle/nvfp4_experts.pyadds staged rows (64, 300 and 1,000), routed in items of 64 through the BIZ 2.x engine'sprompt_gate_up/prompt_down. Upstream's Python lineage has no staged kernel, so the fixtures come from that engine, whose decode kernel is the samenvfp4/experts.cu.Grouped.prompt. The existing decode cases are unchanged.Receipts on GB10 (DGX Spark, sm_121, CUDA 13.3, driver 580.173.02), this branch built with nvcc for
sm_121:zig build testpasses.zig fmt --checkis clean for the touched files.lean_checkreports 542 problems, the same as cuda: grouped NVFP4 experts behind experts.Grouped (decode rows); prompt rows refused until a staged kernel takes them #629's head (4678ffac), so it adds zero.tf-cuda-test nvfp4-expertsagainst the BIZ 2.x engine'snvfp4/experts.pyis byte-equal in every case:Speed of the same two kernels on GLM-5.3-Flash's real layer-3 experts (288 routed,
swiglu_limit10, top-8 plus the skipped shared slot, uniform random routing), CUDA events, the decode form (items of 16) against the staged kernel (items of 64), gate-up plus down:These were measured through the 2.x engine's Python launchers (Zig CUDA ports: shared layers below
lanes.Backend, and one place to coordinate them #548, 10-10), and the Zig launch uses the same grid. The staged form also matched our golden of 200 real prompt rows byte for byte at widths 704 and 2048.Written with Weave (My Symbiotic AI)