Skip to content

[PyTorch] Fuse NVFP4 global scales and GEMM alpha in the grouped MLP - #3756

Open
sraman-rgb wants to merge 2 commits into
NVIDIA:mainfrom
sraman-rgb:sraman/nvfp4-fused-global-scale-alpha
Open

sraman-rgb wants to merge 2 commits into
NVIDIA:mainfrom
sraman-rgb:sraman/nvfp4-fused-global-scale-alpha

Conversation

@sraman-rgb

Copy link
Copy Markdown
Collaborator

Compute both operands' per-group NVFP4 global scales and their product (or its square root for dGLU) in one Triton launch instead of several eager elementwise kernels. Bit-identical to the eager ops; falls back to them for unsupported inputs.

Description

Please include a brief summary of the changes, relevant motivation and context.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Compute both operands' per-group NVFP4 global scales and their product
(or its square root for dGLU) in one Triton launch instead of several
eager elementwise kernels. Bit-identical to the eager ops; falls back to
them for unsupported inputs.

Signed-off-by: Siddhartha Raman S <sraman@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

Fuses NVFP4 operand scales and optional GEMM alpha into one Triton launch for the grouped MLP.

  • Grouped MLP scale pairs and GEMM alpha are computed in one Triton launch.

Reviews (2) · Last reviewed commit: "Merge upstream main into sraman/nvfp4-fu..." · Reviewed by Greptile

@ksivaman ksivaman self-assigned this Nov 2, 2026
grouped_mlp.py was restructured upstream (canonical cuDNN layouts, cuBLAS NVFP4-UE5M3, which
removed the UE5M3 grouped-GEMM workaround, BF16 fused grouped MLP). Take upstream's file and
re-apply this PR's change on it: _nvfp4_global_scale_pair at the three remaining operand-pair
sites (wgrad global scales, FC1 alpha, FC2 dSReLU/dGLU alpha).

Signed-off-by: Siddhartha Raman S <sraman@nvidia.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants