Skip to content

Remove redundant runtime checks for activation recompute - #3436

Draft
ghadiaravi13 wants to merge 1 commit into
NVIDIA:mainfrom
ghadiaravi13:rghadia/nt3-ultra-nvfp4
Draft

Remove redundant runtime checks for activation recompute#3436
ghadiaravi13 wants to merge 1 commit into
NVIDIA:mainfrom
ghadiaravi13:rghadia/nt3-ultra-nvfp4

Conversation

@ghadiaravi13

Copy link
Copy Markdown

Description

Remove redundant runtime checks for activation recompute in MLP from _ScaledUnary class in activation.py

The current gating is redudant, because the non-fused path already behaves as activation_recompute_in_mlp = true always.

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 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?

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