[ROCm][Engine] Fix GPU memory leaks in engine shutdown and test workaround for async KV prefix cache reset (#38503)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
import gc
|
||||
import os
|
||||
import queue
|
||||
import signal
|
||||
@@ -574,6 +575,12 @@ class EngineCore:
|
||||
if self.scheduler:
|
||||
self.scheduler.shutdown()
|
||||
|
||||
# Undo the gc.freeze() from __init__ so that the objects allocated
|
||||
# during engine startup (model weights, KV caches, etc.) become
|
||||
# visible to the garbage collector again. Without this, deleting
|
||||
# the engine in-process (e.g. unit tests) leaks GPU memory.
|
||||
gc.unfreeze()
|
||||
|
||||
def profile(self, is_start: bool = True, profile_prefix: str | None = None):
|
||||
self.model_executor.profile(is_start, profile_prefix)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user