[Hardware][XPU] Align memory usage with cuda on xpu (#37029)

Signed-off-by: Kunshang Ji <jikunshang95@gmail.com>
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
Kunshang Ji
2026-03-25 18:14:29 +08:00
committed by GitHub
parent 04cec4f927
commit e9ae3f8077

View File

@@ -236,6 +236,7 @@ class XPUPlatform(Platform):
def get_current_memory_usage(
cls, device: torch.types.Device | None = None
) -> float:
torch.xpu.empty_cache()
torch.xpu.reset_peak_memory_stats(device)
return torch.xpu.max_memory_allocated(device)