[Bugfix] Narrow AuxOutput KV restrictions to known PD connectors (#58150)
Signed-off-by: aoshen02 <aoshen@inferact.ai>
This commit is contained in:
@@ -7,6 +7,7 @@ from typing import Any
|
||||
import pytest
|
||||
|
||||
from vllm.config import AuxOutputConfig, VllmConfig
|
||||
from vllm.config.kv_transfer import KVRole, KVTransferConfig
|
||||
from vllm.engine.arg_utils import EngineArgs
|
||||
|
||||
pytestmark = pytest.mark.cpu_test
|
||||
@@ -19,6 +20,7 @@ def _config(
|
||||
dcp: int = 1,
|
||||
pcp: int = 1,
|
||||
connector: str | None = None,
|
||||
kv_role: KVRole = "kv_both",
|
||||
runner_type: str = "generate",
|
||||
is_moe: bool = True,
|
||||
sliding_window: int | None = None,
|
||||
@@ -51,9 +53,9 @@ def _config(
|
||||
kv_transfer_config=(
|
||||
None
|
||||
if connector is None
|
||||
else SimpleNamespace(
|
||||
is_kv_transfer_instance=True,
|
||||
else KVTransferConfig(
|
||||
kv_connector=connector,
|
||||
kv_role=kv_role,
|
||||
)
|
||||
),
|
||||
)
|
||||
@@ -95,7 +97,6 @@ def test_legacy_routed_experts_flag_updates_aux_output_config():
|
||||
({"pp": 2}, "pipeline parallelism"),
|
||||
({"dcp": 2}, "context parallelism"),
|
||||
({"pcp": 2}, "context parallelism"),
|
||||
({"connector": "MooncakeConnector"}, "incompatible with KV connectors"),
|
||||
],
|
||||
)
|
||||
def test_aux_output_connector_rejects_unsupported_configuration(kwargs, error):
|
||||
@@ -103,6 +104,45 @@ def test_aux_output_connector_rejects_unsupported_configuration(kwargs, error):
|
||||
VllmConfig._verify_aux_output_compatibility(_config(**kwargs))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("connector", "blocked"),
|
||||
[
|
||||
("NixlConnector", True),
|
||||
("NixlPullConnector", True),
|
||||
("NixlPushConnector", True),
|
||||
("MoRIIOConnector", True),
|
||||
("MooncakeConnector", True),
|
||||
("MooncakeStoreConnector", False),
|
||||
("OffloadingConnector", False),
|
||||
("LMCacheConnectorV1", False),
|
||||
("LMCacheMPConnector", False),
|
||||
("SimpleCPUOffloadConnector", False),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("kv_role", ["kv_both", "kv_producer", "kv_consumer"])
|
||||
@pytest.mark.parametrize("multi", [False, True])
|
||||
def test_aux_output_connector_policy_is_independent_of_role(
|
||||
connector, blocked, kv_role, multi
|
||||
):
|
||||
config = _config(connector=connector, kv_role=kv_role)
|
||||
if multi:
|
||||
config.kv_transfer_config = KVTransferConfig(
|
||||
kv_connector="MultiConnector",
|
||||
kv_role=kv_role,
|
||||
kv_connector_extra_config={
|
||||
"connectors": [
|
||||
{"kv_connector": "OffloadingConnector", "kv_role": "kv_both"},
|
||||
{"kv_connector": connector, "kv_role": kv_role},
|
||||
]
|
||||
},
|
||||
)
|
||||
if blocked:
|
||||
with pytest.raises(ValueError, match=f"incompatible with {connector}"):
|
||||
VllmConfig._verify_aux_output_compatibility(config)
|
||||
else:
|
||||
VllmConfig._verify_aux_output_compatibility(config)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"kwargs",
|
||||
[{"sliding_window": 4096}, {"attention_chunk_size": 4096}],
|
||||
|
||||
+13
-8
@@ -1126,14 +1126,19 @@ class VllmConfig:
|
||||
)
|
||||
|
||||
kv_transfer_config = self.kv_transfer_config
|
||||
if (
|
||||
kv_transfer_config is not None
|
||||
and kv_transfer_config.is_kv_transfer_instance
|
||||
):
|
||||
raise ValueError(
|
||||
"--enable-return-routed-experts is incompatible with KV "
|
||||
"connectors (PD disaggregation and KV cache offload)."
|
||||
)
|
||||
if kv_transfer_config is not None:
|
||||
for connector_name in (
|
||||
"NixlConnector",
|
||||
"NixlPullConnector",
|
||||
"NixlPushConnector",
|
||||
"MoRIIOConnector",
|
||||
"MooncakeConnector",
|
||||
):
|
||||
if kv_transfer_config.has_connector(connector_name):
|
||||
raise ValueError(
|
||||
"--enable-return-routed-experts is incompatible with "
|
||||
f"{connector_name}; PD auxiliary output is not supported."
|
||||
)
|
||||
|
||||
def _verify_kv_transfer_compat(self) -> None:
|
||||
"""Reject configurations that silently corrupt KV transfers."""
|
||||
|
||||
Reference in New Issue
Block a user