Skip to content

Relax runtime checks for activation recompute into Warnings - #3436

Draft
ghadiaravi13 wants to merge 3 commits into
NVIDIA:mainfrom
ghadiaravi13:rghadia/nt3-ultra-nvfp4
Draft

Relax runtime checks for activation recompute into Warnings#3436
ghadiaravi13 wants to merge 3 commits into
NVIDIA:mainfrom
ghadiaravi13:rghadia/nt3-ultra-nvfp4

Conversation

@ghadiaravi13

@ghadiaravi13 ghadiaravi13 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

Relax runtime checks into Warnings for activation recompute in MLP from _ScaledUnary class in activation.py

The current gating is strict and doesn't support activation computation for bf16 layers when activation_recompute_in_mlp is set to true (which applies for NVFP4 layers which uses op_fuser for MoE, but not for bf16).

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

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

…_ScaledUnary class in activation.py

Signed-off-by: Ravi Ghadia <rghadia@nvidia.com>
@github-actions github-actions Bot added the community-contribution PRs from external contributor outside the core maintainers, representing community-driven work. label Aug 28, 2026
timmoon10
timmoon10 previously approved these changes Aug 28, 2026

@timmoon10 timmoon10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is reasonable to me. Ignoring activation_recompute_in_mlp outside of the grouped MLP block makes it less brittle (downstream users don't need to be aware of the specifics of the op fuser), but it may also result in silent perf degradation.

I should clarify that the removed check is not redundant. In the grouped MLP fused op, activation_recompute_in_mlp=True means that we do not cache the FC2 input for use in the wgrad GEMM. Rather, we take the cached activation input, recompute the activation, and pass that to the wgrad GEMM. However, in the unfused case, the activation and FC2 have nothing to do with each other. We cache both the activation input and the FC2 input, so we have worst-case memory usage.

@zhongbozhu

Copy link
Copy Markdown
Collaborator

Can we add some unit test to it?

@ghadiaravi13 ghadiaravi13 changed the title Remove redundant runtime checks for activation recompute Relax runtime checks for activation recompute into Warnings Sep 1, 2026
…aledUnary class

Signed-off-by: Ravi Ghadia <rghadia@nvidia.com>
…MLP path

Signed-off-by: Ravi Ghadia <rghadia@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution PRs from external contributor outside the core maintainers, representing community-driven work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants