[Bugfix][Frontend] Clear the P0 multimodal cache through the renderer (#7003)
Signed-off-by: ZenAlexa <zimingwang945@gmail.com>
This commit is contained in:
1 parent
2bae550c04
commit
43b697541a
2 files changed
+24
-13
No files matched your search
@@ -1,3 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
"""Unit tests for AR EngineCore vs diffusion worker pause/sleep routing."""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -7,6 +10,8 @@ from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, call
|
||||
|
||||
import pytest
|
||||
from vllm.renderers import BaseRenderer
|
||||
from vllm.v1.engine.input_processor import InputProcessor
|
||||
|
||||
from vllm_omni.diffusion.data import CuMemTag, OmniACK
|
||||
from vllm_omni.entrypoints.async_omni import AsyncOmni
|
||||
@@ -37,6 +42,22 @@ def _make_omni(*, stage_types: list[str]) -> AsyncOmni:
|
||||
return omni
|
||||
|
||||
|
||||
@pytest.mark.cpu
|
||||
def test_reset_mm_cache_routes_through_renderer(mocker):
|
||||
async def run() -> None:
|
||||
omni = object.__new__(AsyncOmni)
|
||||
renderer = mocker.create_autospec(BaseRenderer, instance=True)
|
||||
input_processor = mocker.create_autospec(InputProcessor, instance=True)
|
||||
input_processor.renderer = renderer
|
||||
omni.input_processor = input_processor
|
||||
|
||||
await omni.reset_mm_cache()
|
||||
|
||||
renderer.clear_mm_cache_async.assert_awaited_once_with()
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
@pytest.mark.cpu
|
||||
def test_split_stage_ids_by_type():
|
||||
omni = _make_omni(stage_types=["llm", "diffusion", "llm"])
|
||||
|
||||
@@ -1416,19 +1416,9 @@ class AsyncOmni(EngineClient, OmniBase):
|
||||
``EngineCore.sleep(level>=1)`` already clears the P1 receiver cache.
|
||||
Clearing P0 avoids hash-only follow-up requests after that reset.
|
||||
"""
|
||||
processor = getattr(self, "input_processor", None)
|
||||
if processor is None:
|
||||
processor = getattr(self.engine, "input_processor", None)
|
||||
cache = getattr(processor, "mm_processor_cache", None)
|
||||
if cache is None:
|
||||
logger.debug("[AsyncOmni] reset_mm_cache: no frontend mm_processor_cache")
|
||||
return
|
||||
for name in ("clear", "reset", "clear_cache"):
|
||||
fn = getattr(cache, name, None)
|
||||
if callable(fn):
|
||||
fn()
|
||||
return
|
||||
logger.debug("[AsyncOmni] reset_mm_cache: cache has no clear/reset method")
|
||||
renderer = self.renderer
|
||||
if renderer is not None:
|
||||
await renderer.clear_mm_cache_async()
|
||||
|
||||
async def reset_encoder_cache(self) -> None:
|
||||
"""Reset the encoder cache for all stages.
|
||||
|
||||
Reference in new issue
Block a user