[PyTorch] Enable NVFP4 row-scaled (per-token) backward for GroupedLinear - #3324
Merged
timmoon10 merged 4 commits intoAug 14, 2026
Merged
Conversation
Extend the row-scaled NVFP4 support added for dense Linear to the MoE GroupedLinear module, so the wgrad is computed in NVFP4 instead of falling back to high precision. Signed-off-by: Cael Ling <caell@nvidia.com>
for more information, see https://pre-commit.ci
Contributor
Greptile SummaryThe PR enables row-scaled NVFP4 weight-gradient computation for PyTorch GroupedLinear by routing affected grouped GEMMs through per-expert dense kernels and allocating columnwise per-column amax metadata.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Sequence DiagramsequenceDiagram
participant GL as GroupedLinear backward
participant GG as general_grouped_gemm
participant DG as per-expert general_gemm
participant Q as NVFP4 quantize/transpose
participant W as Weight gradients
GL->>GG: NT wgrad with expert splits
GG->>DG: Route each row-scaled expert
DG->>Q: Quantize activation and gradient operands
Q-->>DG: FP4 data and row/column amax metadata
DG-->>GG: Expert weight gradient
GG-->>W: Combined expert gradients
Reviews (3): Last reviewed commit: "Remove unnecessary comment" | Re-trigger Greptile |
timmoon10
reviewed
Aug 11, 2026
Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Signed-off-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
Member
|
/te-ci |
timmoon10
reviewed
Aug 14, 2026
Signed-off-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
timmoon10
approved these changes
Aug 14, 2026
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.
Description
Extend the row-scaled NVFP4 support added for dense Linear (originally #2931 and #3206) to the MoE GroupedLinear module, so the wgrad is computed in NVFP4 instead of falling back to high precision.
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: