[Hardware] Use torch.accelerator.empty_host_cache() for host cache cl… (#51107)

Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
This commit is contained in:
liuzhenwei
2026-08-06 10:27:57 +08:00
committed by GitHub
parent 81bc196913
commit d54b58cc48
+2 -2
View File
@@ -2154,10 +2154,10 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
if not current_platform.is_cpu():
torch.accelerator.empty_cache()
try:
torch._C._host_emptyCache()
torch.accelerator.empty_host_cache()
except AttributeError:
logger.warning(
"torch._C._host_emptyCache() only available in Pytorch >=2.5"
"torch.accelerator.empty_host_cache() only available in Pytorch >=2.9"
)
logger.debug_once("[shutdown] Distributed: cleanup complete")