Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding remove_caches API to Float8Tensor class #1425

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

youngeunkwon0405
Copy link
Collaborator

Description

Add remove_caches API for Float8Tensor.
This API frees the allocated memory for the transpose cache.
This API is required for FSDP use cases.

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

Signed-off-by: Youngeun Kwon <[email protected]>
@youngeunkwon0405
Copy link
Collaborator Author

/te-ci pytorch L1

Copy link
Collaborator

@timmoon10 timmoon10 left a comment

Choose a reason for hiding this comment

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

Seems reasonable, although I'd like to wait until after the 2.0 release to merge.

transformer_engine/pytorch/tensor/float8_tensor.py Outdated Show resolved Hide resolved
@@ -919,6 +919,14 @@ def _reset_caches(self) -> None:
"""
self._transpose_invalid = True

def remove_caches(self) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: I'd prefer if we treated this as an internal function and not a public API that can be relied on.

Suggested change
def remove_caches(self) -> None:
def _remove_caches(self) -> None:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @timmoon10, ADLR asked for a public API that is able to remove the transpose cache, which is the reason I am working on this PR. I guess it will be better to have public API to meet their request if you are also okay with that.

@youngeunkwon0405
Copy link
Collaborator Author

Seems reasonable, although I'd like to wait until after the 2.0 release to merge.

Thank you for the review! I will wait for the 2.0 release to be merged. Can I know a rough ETA of that?

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