From 2307a1d16cdd0077cd882bb9fc41b453f6f1999e Mon Sep 17 00:00:00 2001 From: Oxana Korzh Date: Wed, 16 Sep 2026 20:30:59 -0600 Subject: [PATCH] [Core] Don't issue a blocking collective RPC during engine handshake (#57226) Signed-off-by: okorzh Co-authored-by: Andreas Karatzas --- tests/v1/engine/test_engine_core_client.py | 38 ++++++++++++++++++++++ vllm/v1/engine/core.py | 2 ++ 2 files changed, 40 insertions(+) diff --git a/tests/v1/engine/test_engine_core_client.py b/tests/v1/engine/test_engine_core_client.py index a23ae46b8f..a153b23b10 100644 --- a/tests/v1/engine/test_engine_core_client.py +++ b/tests/v1/engine/test_engine_core_client.py @@ -1452,3 +1452,41 @@ def test_engine_core_proc_instantiation_cuda_empty(monkeypatch: pytest.MonkeyPat ) engine_core_proc.shutdown() + + +def _ready_response_with_weight_transfer(weight_transfer_config): + """Build a ready response against a mock executor.""" + from vllm.v1.engine.core import EngineCoreProc + + executor = MagicMock() + executor.supports_draft_weight_updates.return_value = True + + proc = MagicMock() + proc.model_executor = executor + proc.vllm_config = MagicMock() + proc.vllm_config.weight_transfer_config = weight_transfer_config + proc.vllm_config.lora_config = None + proc.vllm_config.model_config.enable_sleep_mode = False + proc.scheduler = MagicMock() + + response = EngineCoreProc._make_ready_response(proc) + return response, executor + + +def test_ready_response_skips_draft_rpc_without_weight_transfer(): + """No weight-transfer config: the executor must not be consulted.""" + response, executor = _ready_response_with_weight_transfer(None) + + executor.supports_draft_weight_updates.assert_not_called() + assert response.supports_draft_weight_updates is False + + +def test_ready_response_queries_executor_with_weight_transfer(): + """Weight transfer configured: the executor is still consulted.""" + weight_transfer_config = MagicMock() + weight_transfer_config.backend = "nixl" + + response, executor = _ready_response_with_weight_transfer(weight_transfer_config) + + executor.supports_draft_weight_updates.assert_called_once() + assert response.supports_draft_weight_updates is True diff --git a/vllm/v1/engine/core.py b/vllm/v1/engine/core.py index 9c84827a63..7da7f2e0ec 100644 --- a/vllm/v1/engine/core.py +++ b/vllm/v1/engine/core.py @@ -1691,6 +1691,8 @@ class EngineCoreProc(EngineCore): enable_sleep_mode=self.vllm_config.model_config.enable_sleep_mode, supports_draft_weight_updates=( self.model_executor.supports_draft_weight_updates() + if self.vllm_config.weight_transfer_config is not None + else False ), )