Skip to content

[PyTorch] Avoid registering FP8 scale update in ops without backward pass#2063

Merged
timmoon10 merged 2 commits intoNVIDIA:mainfrom
timmoon10:debug-ops-with-no-bprop
Aug 14, 2025
Merged

[PyTorch] Avoid registering FP8 scale update in ops without backward pass#2063
timmoon10 merged 2 commits intoNVIDIA:mainfrom
timmoon10:debug-ops-with-no-bprop

Conversation

@timmoon10
Copy link
Collaborator

Description

We keep track of the first TE module within an fp8_autocast context so that we can perform an FP8 scale update during its backward pass. However, the op fuser does not consider the possibility that it might not perform a backward pass. This was causing divergence problems in some finetuning workflows where the first layer does not require any grads.

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

  • Avoid registering FP8 scale update in ops without backward pass

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

Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10 timmoon10 added the bug Something isn't working label Aug 12, 2025
Signed-off-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
@timmoon10
Copy link
Collaborator Author

/te-ci pytorch

@timmoon10 timmoon10 merged commit 26b4b71 into NVIDIA:main Aug 14, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant