Skip to content

Commit

Permalink
Revert "(MTIA) Move "empty_cache" API (pytorch#143402)"
Browse files Browse the repository at this point in the history
This reverts commit c7d9f29.

Reverted pytorch#143402 on behalf of https://github.com/huydhn due to The internal diff D67148738 has been reverted ([comment](pytorch#143402 (comment)))
  • Loading branch information
pytorchmergebot committed Dec 21, 2024
1 parent fecf03f commit dabc956
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion docs/source/mtia.memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ The MTIA backend is implemented out of the tree, only interfaces are be defined
:toctree: generated
:nosignatures:

empty_cache
memory_stats
max_memory_allocated
5 changes: 5 additions & 0 deletions torch/mtia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ def get_device_capability(device: Optional[_device_t] = None) -> Tuple[int, int]
return torch._C._mtia_getDeviceCapability(_get_device_index(device, optional=True))


def empty_cache() -> None:
r"""Empty the MTIA device cache."""
return torch._C._mtia_emptyCache()


def set_stream(stream: Stream):
r"""Set the current stream.This is a wrapper API to set the stream.
Usage of this function is discouraged in favor of the ``stream``
Expand Down
6 changes: 0 additions & 6 deletions torch/mtia/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
from ._utils import _get_device_index


def empty_cache() -> None:
r"""Empty the MTIA device cache."""
return torch._C._mtia_emptyCache()


def max_memory_allocated(device: Optional[_device_t] = None) -> int:
r"""Return the maximum memory allocated in bytes for a given device.
Expand Down Expand Up @@ -42,7 +37,6 @@ def memory_stats(device: Optional[_device_t] = None) -> Dict[str, Any]:


__all__ = [
"empty_cache",
"memory_stats",
"max_memory_allocated",
]

0 comments on commit dabc956

Please sign in to comment.