feat: add NVFP4 MoE kernels with optional 4over6 quantization - #12
Draft
S1ro1 wants to merge 6 commits into
Draft
Conversation
Co-authored-by: Codex <noreply@openai.com>
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.
Add the SM100
nvfp4_moekernel package for routed-expert training, exposed through the kernel registry andprime_rl::grouped_nvfp4_gemm. The implementation packs weights with per-expert global scales and activations with per-token global scales, runs NVFP4 grouped GEMM, and supportsdequant_bf16backward using the packed forward operands orbf16backward using the master operands.NVFP4GroupedGemm(four_over_six=True)enables adaptive 4/6 quantization for weights and both activation inputs. It matches FlashInfer's default 4/6 recipe: 448 normalization, MAE, strict reconstruction-error scoring, and default approximate candidate arithmetic. The option defaults toFalse. The wrapper remains traceable withtorch.compile(fullgraph=False).Declare the CUTLASS build dependency and header paths in
kernels.toml, resolving build dependencies per selected kernel. Include the source license, package documentation, and focused numerical tests.Stacked on #9 with
gh stack: main → #9 → #12. This PR contains only the NVFP4 changes. The tested source commit436719dand release wheel are unchanged. Prime-RL integration: PrimeIntellect-ai/prime-rl#3511.Validation on GB200 with CUDA 13, torch 2.13.0 and FlashInfer 0.6.18, using the locally built release wheel: