From 157caf511b5264c1b93610e5dcde04f70fd9d676 Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Tue, 27 Jan 2026 11:45:45 +0800 Subject: [PATCH] [Perf] avoid duplicate mem_get_info() call in get_current_memory_usage (#33064) Signed-off-by: Paco Xu --- vllm/platforms/rocm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/platforms/rocm.py b/vllm/platforms/rocm.py index 6e67456bfb..49225fc2e1 100644 --- a/vllm/platforms/rocm.py +++ b/vllm/platforms/rocm.py @@ -561,7 +561,8 @@ class RocmPlatform(Platform): cls, device: torch.types.Device | None = None ) -> float: torch.cuda.reset_peak_memory_stats(device) - return torch.cuda.mem_get_info(device)[1] - torch.cuda.mem_get_info(device)[0] + free_mem, total_mem = torch.cuda.mem_get_info(device) + return total_mem - free_mem @classmethod def get_device_communicator_cls(cls) -> str: