[Rebase] Rebase to vllm 0.27.0 (#5976)

Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Zhou TaichangandClaude Opus 5 authored and GitHub committed 2026-08-11 15:23:46 +00:00
1 parent 584d78c673
commit 2ce15ab7a0
55 files changed
+1335 -93

No files matched your search

+9 -3
View File
@@ -104,10 +104,16 @@ def register_omni_models_to_vllm():
_register_omni_hf_configs()
supported_archs = ModelRegistry.get_supported_archs()
# Unconditionally (re)register every omni arch into the upstream global
# ModelRegistry: vLLM 0.27 added some omni archs (e.g.
# Qwen3OmniMoeForConditionalGeneration) to its own registry, but resolves
# them to upstream classes that lack omni features (e.g.
# buffer_realtime_audio for the realtime endpoint). Registering here
# overwrites those entries with the vllm-omni classes, which is the
# behavior entrypoints resolving through the global registry rely on
# (and matches OmniModelRegistry's omni-wins ordering).
for arch, (mod_folder, mod_relname, cls_name) in _OMNI_MODELS.items():
if arch not in supported_archs:
ModelRegistry.register_model(arch, f"vllm_omni.model_executor.models.{mod_folder}.{mod_relname}:{cls_name}")
ModelRegistry.register_model(arch, f"vllm_omni.model_executor.models.{mod_folder}.{mod_relname}:{cls_name}")
# Register omni-specific reasoning parsers (e.g., step_audio).
import vllm_omni.reasoning # noqa: F401
+2
View File
@@ -539,6 +539,7 @@ class AsyncOmniEngine:
if not isinstance(mm_data, dict) or not mm_data:
return
from vllm.config.multimodal import _get_mm_hasher_algorithm
from vllm.multimodal.hasher import MultiModalHasher
existing_uuids = prompt.get("multi_modal_uuids")
@@ -565,6 +566,7 @@ class AsyncOmniEngine:
base_uuid = None
else:
base_uuid = MultiModalHasher.hash_kwargs(
_get_mm_hasher_algorithm(),
model_id=model_id,
**{modality: item},
)
+51 -11
View File
@@ -896,23 +896,59 @@ def connect_remote_diffusion_proc(
def scoped_spawn_device_env(
stage_visible_devices: str | None,
spawn_device_lock: threading.Lock | None,
*,
stage_id: int | None = None,
replica_id: int | None = None,
) -> Iterator[None]:
"""Briefly scope device visibility while spawning a stage subprocess."""
if stage_visible_devices is None or spawn_device_lock is None:
with _scoped_replica_compile_cache_env(stage_id, replica_id):
if stage_visible_devices is None or spawn_device_lock is None:
yield
return
device_control_env = current_omni_platform.device_control_env_var
with spawn_device_lock:
previous_visible_devices = os.environ.get(device_control_env)
try:
current_omni_platform.set_device_control_env_var(stage_visible_devices)
yield
finally:
if previous_visible_devices is None:
current_omni_platform.unset_device_control_env_var()
else:
current_omni_platform.set_device_control_env_var(previous_visible_devices)
_COMPILE_CACHE_ENV_LOCK = threading.Lock()
@contextlib.contextmanager
def _scoped_replica_compile_cache_env(stage_id: int | None, replica_id: int | None) -> Iterator[None]:
"""Give additional replicas an isolated VLLM_CACHE_ROOT at spawn time.
Replicas of the same stage compile the same model concurrently; vLLM
0.27's AOT compile (TritonBundler) races on the shared cache dir and a
replica can then die with 'Cubin file saved by TritonBundler not found'
(build 2954, Multi-Replica perf). Replica 0 keeps the default shared
cache so single-replica deployments stay warm; every further replica
compiles into its own subdirectory.
"""
if not replica_id or replica_id <= 0:
yield
return
device_control_env = current_omni_platform.device_control_env_var
with spawn_device_lock:
previous_visible_devices = os.environ.get(device_control_env)
base = os.environ.get("VLLM_CACHE_ROOT") or os.path.expanduser("~/.cache/vllm")
isolated = os.path.join(base, f"omni_stage{stage_id if stage_id is not None else 'x'}_replica{replica_id}")
with _COMPILE_CACHE_ENV_LOCK:
previous = os.environ.get("VLLM_CACHE_ROOT")
os.environ["VLLM_CACHE_ROOT"] = isolated
try:
current_omni_platform.set_device_control_env_var(stage_visible_devices)
yield
finally:
if previous_visible_devices is None:
current_omni_platform.unset_device_control_env_var()
if previous is None:
os.environ.pop("VLLM_CACHE_ROOT", None)
else:
current_omni_platform.set_device_control_env_var(previous_visible_devices)
os.environ["VLLM_CACHE_ROOT"] = previous
@contextlib.contextmanager
@@ -1007,7 +1043,9 @@ def _launch_omni_core_engines(
# an OmniCoordClientForStage and heartbeats to the coordinator.
from vllm_omni.engine.stage_engine_core_proc_manager import StageEngineCoreProcManager
with scoped_spawn_device_env(stage_visible_devices, spawn_device_lock):
with scoped_spawn_device_env(
stage_visible_devices, spawn_device_lock, stage_id=stage_id, replica_id=replica_id
):
local_engine_manager: CoreEngineProcManager = StageEngineCoreProcManager(
local_engine_count=local_engine_count,
start_index=start_index,
@@ -1022,7 +1060,9 @@ def _launch_omni_core_engines(
omni_replica_base_id=replica_id,
)
else:
with scoped_spawn_device_env(stage_visible_devices, spawn_device_lock):
with scoped_spawn_device_env(
stage_visible_devices, spawn_device_lock, stage_id=stage_id, replica_id=replica_id
):
local_engine_manager = CoreEngineProcManager(
local_engine_count=local_engine_count,
start_index=start_index,
@@ -1104,7 +1144,7 @@ def launch_stage_replica(
addresses = get_engine_zmq_addresses(vllm_config)
handshake_address = get_open_zmq_ipc_path()
engines_to_handshake = [CoreEngine(index=0, local=True)]
with scoped_spawn_device_env(stage_visible_devices, spawn_device_lock):
with scoped_spawn_device_env(stage_visible_devices, spawn_device_lock, stage_id=stage_id, replica_id=replica_id):
engine_manager = StageEngineCoreProcManager(
local_engine_count=1,
start_index=0,