@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 14d03b8ddb
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 9, 17:06 UTC

[Perf] Cache xpu_get_mem_info() result to avoid duplicate calls (#32983)

Signed-off-by: 7. Sun <jhao.sun@gmail.com>

7. Sun committed Jan 24, 2026 at 04:56 UTC 14d03b8ddb383a114e9085f7ece48629e11991b5
1 file changed +2 -1
vllm/v1/worker/xpu_worker.py
+2 -1
@@ -107,7 +107,8 @@ class XPUWorker(Worker):
107
108 torch.xpu.empty_cache()
109 torch_allocated_bytes = torch.xpu.memory_stats()["allocated_bytes.all.current"]
110 - total_allocated_bytes = self.xpu_get_mem_info()[1] - self.xpu_get_mem_info()[0]
110 + free_mem, total_mem = self.xpu_get_mem_info()
111 + total_allocated_bytes = total_mem - free_mem
112
113 non_torch_allocations = total_allocated_bytes - torch_allocated_bytes
114 if non_torch_allocations > 0: