Skip to content

[PyTorch] Update FP8 recipe test to handle recipe changes#834

Merged
timmoon10 merged 1 commit intoNVIDIA:mainfrom
timmoon10:fp8-recipe-test-bugfix
May 7, 2024
Merged

[PyTorch] Update FP8 recipe test to handle recipe changes#834
timmoon10 merged 1 commit intoNVIDIA:mainfrom
timmoon10:fp8-recipe-test-bugfix

Conversation

@timmoon10
Copy link
Collaborator

Description

This PR fixes CI failures in the FP8 recipe test, which did not reflect recent changes in #575 and #825.

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)

Changes

Please list the changes introduced in this PR:

  • Update FP8 recipe test to handle cases where amax history roll is skipped

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

@timmoon10 timmoon10 added the bug Something isn't working label May 3, 2024
@timmoon10 timmoon10 requested a review from ksivaman May 3, 2024 23:42
@timmoon10 timmoon10 self-assigned this May 3, 2024
Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10 timmoon10 force-pushed the fp8-recipe-test-bugfix branch from da50aa4 to d90ee8e Compare May 3, 2024 23:47
@timmoon10
Copy link
Collaborator Author

/te-ci pytorch

ref_scale_inv_forward = torch.reciprocal(ref_scale_forward)
update_weight_scale_inv = is_first_microbatch is None or is_first_microbatch
if not update_weight_scale_inv:
update_weight_amax = is_first_microbatch is None or is_first_microbatch
Copy link
Member

Choose a reason for hiding this comment

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

For our current setup, this should always be True right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The FP8 cast kernel is never called on the weights with is_first_microbatch=False, so the amax is left at zero. #825 changes the FP8 scale update kernel so that it doesn't roll the amax history or update the scales if the amax is zero.

Copy link
Member

@ksivaman ksivaman left a comment

Choose a reason for hiding this comment

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

LGTM

@timmoon10 timmoon10 merged commit a51ff54 into NVIDIA:main May 7, 2024
pggPL pushed a commit to pggPL/TransformerEngine that referenced this pull request May 23, 2024
Update FP8 recipe test to handle recipe changes

Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
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.

2 participants