A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 08:30 UTC
[Bugfix] Set `KVTransferConfig.engine_id` in post_init (#18576)
Signed-off-by: Linkun Chen <github@lkchen.net>
lkchen committed
May 22, 2025 at 19:54 UTC
e44d8ce8c77186e8242d463d14219b405a2e109e
3 files changed
+13
-1
tests/v1/kv_connector/unit/test_multi_connector.py
+8
@@ -239,3 +239,11 @@ def get_connector_events() -> dict[str, list[str]]:
239
print(f"[ERROR] Could not read connector events for {name}: {e}")
240
241
return connector_events
242
+
243
+
244
+def test_engine_id_conflict():
245
+ configs = [KVTransferConfig() for _ in range(2)]
246
+ ids = [config.engine_id for config in configs]
247
+ assert ids[0] != ids[1], (
248
+ "Engine IDs should be different for different configs. "
249
+ f"Got {ids}")
vllm/config.py
+4
-1
@@ -3495,7 +3495,7 @@ class KVTransferConfig:
3495
"""The KV connector for vLLM to transmit KV caches between vLLM instances.
3496
"""
3497
3498
- engine_id: str = str(uuid.uuid4())
3498
+ engine_id: Optional[str] = None
3499
"""The engine id for KV transfers."""
3500
3501
kv_buffer_device: Optional[str] = "cuda"
@@ -3552,6 +3552,9 @@ class KVTransferConfig:
3552
return hash_str
3553
3554
def __post_init__(self) -> None:
3555
+ if self.engine_id is None:
3556
+ self.engine_id = str(uuid.uuid4())
3557
+
3558
if self.kv_role is not None and self.kv_role not in get_args(KVRole):
3559
raise ValueError(f"Unsupported kv_role: {self.kv_role}. "
3560
f"Supported roles are {get_args(KVRole)}")
vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py
+1
@@ -537,6 +537,7 @@ class NixlConnectorWorker:
537
538
def add_remote_agent(self, nixl_agent_meta: NixlAgentMetadata):
539
engine_id = nixl_agent_meta.engine_id
540
+ assert engine_id != self.engine_id, "Conflict engine id found!"
541
if engine_id in self._remote_agents:
542
return
543