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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions transformer_engine/pytorch/tensor/float8_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

"""
Remove transpose cache and mark it as invalid.
"""
self._transpose_invalid = True
del self._transpose
self._transpose = None
youngeunkwon0405 marked this conversation as resolved.
Show resolved Hide resolved

@classmethod
def __torch_dispatch__(cls, func, types, args, kwargs=None):

Expand Down
Loading