[Core] Support reseting all running requests' KV while calling reset_prefix_cache (#28827)

Signed-off-by: Zhuohan Li <zhuohan123@gmail.com>
Signed-off-by: Nick Hill <nhill@redhat.com>
Co-authored-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
Zhuohan Li
2025-12-02 02:25:05 +00:00
committed by GitHub
co-authored by Nick Hill
parent fa8804ad9c
commit d0cd728907
16 changed files with 315 additions and 35 deletions
+2 -2
View File
@@ -750,8 +750,8 @@ class AsyncLLM(EngineClient):
self.input_processor.clear_mm_cache()
await self.engine_core.reset_mm_cache_async()
async def reset_prefix_cache(self) -> None:
await self.engine_core.reset_prefix_cache_async()
async def reset_prefix_cache(self, reset_running_requests: bool = False) -> bool:
return await self.engine_core.reset_prefix_cache_async(reset_running_requests)
async def sleep(self, level: int = 1) -> None:
await self.reset_prefix_cache()
+2 -2
View File
@@ -483,8 +483,8 @@ class EngineCore:
self.model_executor.reset_mm_cache()
def reset_prefix_cache(self):
self.scheduler.reset_prefix_cache()
def reset_prefix_cache(self, reset_running_requests: bool = False) -> bool:
return self.scheduler.reset_prefix_cache(reset_running_requests)
def sleep(self, level: int = 1):
self.model_executor.sleep(level)
+14 -8
View File
@@ -138,7 +138,7 @@ class EngineCoreClient(ABC):
def reset_mm_cache(self) -> None:
raise NotImplementedError
def reset_prefix_cache(self) -> None:
def reset_prefix_cache(self, reset_running_requests: bool = False) -> bool:
raise NotImplementedError
def sleep(self, level: int = 1) -> None:
@@ -208,7 +208,9 @@ class EngineCoreClient(ABC):
async def reset_mm_cache_async(self) -> None:
raise NotImplementedError
async def reset_prefix_cache_async(self) -> None:
async def reset_prefix_cache_async(
self, reset_running_requests: bool = False
) -> bool:
raise NotImplementedError
async def sleep_async(self, level: int = 1) -> None:
@@ -287,8 +289,8 @@ class InprocClient(EngineCoreClient):
def reset_mm_cache(self) -> None:
self.engine_core.reset_mm_cache()
def reset_prefix_cache(self) -> None:
self.engine_core.reset_prefix_cache()
def reset_prefix_cache(self, reset_running_requests: bool = False) -> bool:
return self.engine_core.reset_prefix_cache(reset_running_requests)
def sleep(self, level: int = 1) -> None:
self.engine_core.sleep(level)
@@ -751,8 +753,8 @@ class SyncMPClient(MPClient):
def reset_mm_cache(self) -> None:
self.call_utility("reset_mm_cache")
def reset_prefix_cache(self) -> None:
self.call_utility("reset_prefix_cache")
def reset_prefix_cache(self, reset_running_requests: bool = False) -> bool:
return self.call_utility("reset_prefix_cache", reset_running_requests)
def add_lora(self, lora_request: LoRARequest) -> bool:
return self.call_utility("add_lora", lora_request)
@@ -955,8 +957,12 @@ class AsyncMPClient(MPClient):
async def reset_mm_cache_async(self) -> None:
await self.call_utility_async("reset_mm_cache")
async def reset_prefix_cache_async(self) -> None:
await self.call_utility_async("reset_prefix_cache")
async def reset_prefix_cache_async(
self, reset_running_requests: bool = False
) -> bool:
return await self.call_utility_async(
"reset_prefix_cache", reset_running_requests
)
async def sleep_async(self, level: int = 1) -> None:
await self.call_utility_async("sleep", level)
+2 -2
View File
@@ -329,8 +329,8 @@ class LLMEngine:
self.input_processor.clear_mm_cache()
self.engine_core.reset_mm_cache()
def reset_prefix_cache(self):
self.engine_core.reset_prefix_cache()
def reset_prefix_cache(self, reset_running_requests: bool = False) -> bool:
return self.engine_core.reset_prefix_cache(reset_running_requests)
def sleep(self, level: int = 1):
self.engine_core.sleep(level)