[Perf][Qwen3-TTS] Enable event-driven orchestration by default (#7088)
Signed-off-by: Sy03 <1370724210@qq.com>
This commit is contained in:
13 files changed
+231
-27
No files matched your search
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""Event-driven orchestration loop (``VLLM_OMNI_EVENT_DRIVEN_ORCH=1``) tests.
|
||||
|
||||
Parity suite: re-runs the legacy orchestration scenarios from
|
||||
@@ -19,7 +19,10 @@ import pytest
|
||||
|
||||
from vllm_omni.engine.async_omni_engine import AsyncOmniEngine
|
||||
from vllm_omni.engine.messages import ShutdownRequestMessage
|
||||
from vllm_omni.engine.orchestrator import _event_driven_orch_enabled
|
||||
from vllm_omni.engine.orchestrator import (
|
||||
_event_driven_orch_default_for_pipeline,
|
||||
_event_driven_orch_enabled,
|
||||
)
|
||||
|
||||
from . import test_orchestrator as legacy
|
||||
from . import test_orchestrator_error_handling as legacy_errors
|
||||
@@ -125,6 +128,19 @@ def test_flag_parsing(monkeypatch) -> None:
|
||||
assert _event_driven_orch_enabled() is False
|
||||
|
||||
|
||||
def test_only_qwen3_tts_has_a_pipeline_default() -> None:
|
||||
assert _event_driven_orch_default_for_pipeline("qwen3_tts") is True
|
||||
for model_type in (None, "qwen3_omni_moe", "minicpmo_4_5", "moss_tts_delay"):
|
||||
assert _event_driven_orch_default_for_pipeline(model_type) is False
|
||||
|
||||
|
||||
def test_explicit_event_driven_value_overrides_pipeline_default(monkeypatch) -> None:
|
||||
monkeypatch.delenv("VLLM_OMNI_EVENT_DRIVEN_ORCH", raising=False)
|
||||
assert _event_driven_orch_enabled(default=True) is True
|
||||
monkeypatch.setenv("VLLM_OMNI_EVENT_DRIVEN_ORCH", "0")
|
||||
assert _event_driven_orch_enabled(default=True) is False
|
||||
|
||||
|
||||
def test_default_is_legacy_loop(monkeypatch) -> None:
|
||||
"""Without the env flag, the harness runs the legacy poll loop."""
|
||||
monkeypatch.delenv("VLLM_OMNI_EVENT_DRIVEN_ORCH", raising=False)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
import json
|
||||
import time
|
||||
|
||||
@@ -45,6 +48,8 @@ def test_note_loop_and_flush_json(tmp_path, monkeypatch):
|
||||
monitor.register_replica(0, 0)
|
||||
|
||||
monitor.note_loop(idle=False)
|
||||
monitor.set_dispatch_queue_size(9)
|
||||
monitor.set_dispatch_queue_size(7)
|
||||
monitor.note_loop(idle=True)
|
||||
|
||||
now[0] = 1.5
|
||||
@@ -54,10 +59,37 @@ def test_note_loop_and_flush_json(tmp_path, monkeypatch):
|
||||
assert payload["configured_window_s"] == monitor_mod._WINDOW_S
|
||||
assert payload["windows"]["loop_idle"] == [1]
|
||||
assert payload["windows"]["loop_active"] == [1]
|
||||
assert payload["windows"]["dispatch_queue_size"] == [7]
|
||||
assert payload["windows"]["dispatch_queue_high_water"] == [9]
|
||||
assert payload["replicas"]["stage=0,replica=0"]["outputs_queue_size"] == [5]
|
||||
assert payload["replicas"]["stage=0,replica=0"]["inflight"] == [10]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("drain", [False, True])
|
||||
def test_dispatch_backlog_carries_across_windows(tmp_path, monkeypatch, drain):
|
||||
out_path = tmp_path / "orch_monitor.json"
|
||||
monkeypatch.setenv("VLLM_OMNI_ORCH_MONITOR_PATH", str(out_path))
|
||||
now = [0.0]
|
||||
monkeypatch.setattr(time, "monotonic", lambda: now[0])
|
||||
monitor = OrchestratorMonitor(replica_sampler=lambda: {})
|
||||
monitor.set_dispatch_queue_size(3)
|
||||
monitor.set_dispatch_queue_size(1)
|
||||
|
||||
now[0] = monitor_mod._WINDOW_S
|
||||
monitor.note_loop(idle=False)
|
||||
if drain:
|
||||
monitor.set_dispatch_queue_size(0)
|
||||
now[0] += monitor_mod._WINDOW_S
|
||||
monitor.note_loop(idle=False)
|
||||
now[0] += monitor_mod._WINDOW_S
|
||||
monitor.flush()
|
||||
|
||||
windows = json.loads(out_path.read_text())["windows"]
|
||||
remaining = 0 if drain else 1
|
||||
assert windows["dispatch_queue_size"] == [1, remaining, remaining]
|
||||
assert windows["dispatch_queue_high_water"] == [3, 1, remaining]
|
||||
|
||||
|
||||
def test_register_replica_backfills_prior_windows(tmp_path, monkeypatch):
|
||||
out_path = tmp_path / "orch_monitor.json"
|
||||
monkeypatch.setenv("VLLM_OMNI_ORCH_MONITOR_PATH", str(out_path))
|
||||
|
||||
@@ -17,7 +17,12 @@ from vllm.v1.engine.utils import EngineZmqAddresses
|
||||
|
||||
from vllm_omni.config.config_factory import StageConfigFactory
|
||||
from vllm_omni.config.omni_config import VllmOmniARStageConfig, VllmOmniDiffusionStageConfig
|
||||
from vllm_omni.config.stage_config import DuplexSessionRuntimeConfig, StageExecutionType, StagePipelineConfig
|
||||
from vllm_omni.config.stage_config import (
|
||||
DuplexSessionRuntimeConfig,
|
||||
PipelineConfig,
|
||||
StageExecutionType,
|
||||
StagePipelineConfig,
|
||||
)
|
||||
from vllm_omni.engine.async_omni_engine import AsyncOmniEngine
|
||||
from vllm_omni.engine.stage_engine_core_client import StageEngineCoreClientBase
|
||||
from vllm_omni.engine.stage_engine_startup import (
|
||||
@@ -393,6 +398,7 @@ class TestSingleStageModeDetection:
|
||||
stage_cfgs: list[Any] | None = None,
|
||||
resolved_config_path: str = "/fake/path",
|
||||
patch_deploy_config: bool = True,
|
||||
resolved_pipeline: PipelineConfig | None = None,
|
||||
**kwargs: Any,
|
||||
) -> AsyncOmniEngine:
|
||||
mock_stage_configs = stage_cfgs or [_make_stage_cfg(0)]
|
||||
@@ -407,10 +413,19 @@ class TestSingleStageModeDetection:
|
||||
"vllm_omni.engine.omni_engine_base.load_deploy_config",
|
||||
return_value=SimpleNamespace(duplex_session=DuplexSessionRuntimeConfig()),
|
||||
)
|
||||
|
||||
def resolve_stage_configs(engine, *args, **kwargs):
|
||||
if resolved_pipeline is not None:
|
||||
engine._config_resolution = SimpleNamespace(
|
||||
pipeline_config=resolved_pipeline, config_path=resolved_config_path
|
||||
)
|
||||
return resolved_config_path, mock_stage_configs
|
||||
|
||||
mocker.patch.object(
|
||||
AsyncOmniEngine,
|
||||
"_resolve_stage_configs",
|
||||
return_value=(resolved_config_path, mock_stage_configs),
|
||||
autospec=True,
|
||||
side_effect=resolve_stage_configs,
|
||||
)
|
||||
mocker.patch.object(AsyncOmniEngine, "_bootstrap_orchestrator")
|
||||
mock_thread_cls = mocker.patch("threading.Thread")
|
||||
@@ -435,6 +450,19 @@ class TestSingleStageModeDetection:
|
||||
)
|
||||
assert engine.single_stage_mode is True
|
||||
|
||||
@pytest.mark.parametrize("model_type, expected", [("qwen3_tts", True), ("qwen3_omni_moe", False)])
|
||||
def test_event_driven_default_uses_resolved_pipeline(self, mocker, model_type, expected):
|
||||
pipeline = PipelineConfig(
|
||||
model_type=model_type,
|
||||
stages=(StagePipelineConfig(stage_id=0, model_stage="a", final_output=True),),
|
||||
)
|
||||
engine = self._make_engine_no_thread(mocker, resolved_pipeline=pipeline)
|
||||
|
||||
StageConfigFactory.get_pipeline_config.assert_called_once_with(
|
||||
model="fake-model", trust_remote_code=False, deploy_config_path=None
|
||||
)
|
||||
assert engine._event_driven_orch_default is expected
|
||||
|
||||
def test_stage_id_kwarg_promotes_to_single_stage_mode(self, mocker: MockerFixture):
|
||||
engine = self._make_engine_no_thread(
|
||||
mocker,
|
||||
|
||||
Reference in new issue
Block a user