[XPU] Optimize XPU worker shutdown logic to prevent resource leak (#46433)

Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com>
This commit is contained in:
Chaojun Zhang
2026-06-30 15:27:21 +08:00
committed by GitHub
parent ba22cb6765
commit 8cc242335d
7 changed files with 41 additions and 5 deletions
+7
View File
@@ -604,6 +604,13 @@ class RemoteVLLMServer:
mem_info = nvmlDeviceGetMemoryInfo(handle)
total_used += mem_info.used
return total_used
elif current_platform.is_xpu():
total_used = 0
device_count = current_platform.device_count()
for i in range(device_count):
free, total = torch.xpu.mem_get_info(i)
total_used += total - free
return total_used
except Exception as e:
print(f"[RemoteOpenAIServer] Could not query GPU memory: {e}")
return None