Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/entrypoints/test_async_omni_pause_sleep_routing.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -7,6 +10,8 @@
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
Expand Down Expand Up @@ -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"])
Expand Down
19 changes: 6 additions & 13 deletions vllm_omni/entrypoints/async_omni.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project

"""
AsyncOmni - Refactored async orchestrator using AsyncOmniEngine.

Expand Down Expand Up @@ -1421,19 +1424,9 @@ async def reset_mm_cache(self) -> None:
``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.
Expand Down
Loading