feat(grpc): add KV event source discovery (#50033)
Signed-off-by: Connor Carpenter <connorc@nvidia.com> Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
co-authored by
Nick Hill
parent
2ecd8645d8
commit
48fc2e2797
@@ -272,6 +272,10 @@ class EventPublisher(ABC):
|
||||
def shutdown(self) -> None:
|
||||
"""Shutdown the publisher."""
|
||||
|
||||
def get_publisher_config(self) -> KVEventsConfig | None:
|
||||
"""Return the publisher's resolved runtime configuration."""
|
||||
return None
|
||||
|
||||
|
||||
class NullEventPublisher(EventPublisher):
|
||||
"""No-op implementation (default when disabled)."""
|
||||
@@ -335,6 +339,17 @@ class ZmqEventPublisher(EventPublisher):
|
||||
self._replay_endpoint = self.offset_endpoint_port(
|
||||
replay_endpoint, self._dp_rank
|
||||
)
|
||||
assert self._endpoint is not None
|
||||
self._publisher_config = KVEventsConfig(
|
||||
enable_kv_cache_events=True,
|
||||
publisher="zmq",
|
||||
endpoint=self._endpoint,
|
||||
replay_endpoint=self._replay_endpoint,
|
||||
buffer_steps=buffer_steps,
|
||||
hwm=hwm,
|
||||
max_queue_size=max_queue_size,
|
||||
topic=topic,
|
||||
)
|
||||
self._hwm = hwm
|
||||
self._socket_setup()
|
||||
|
||||
@@ -351,6 +366,9 @@ class ZmqEventPublisher(EventPublisher):
|
||||
)
|
||||
self._thread.start()
|
||||
|
||||
def get_publisher_config(self) -> KVEventsConfig:
|
||||
return self._publisher_config
|
||||
|
||||
def publish(self, events: EventBatch) -> None:
|
||||
if not self._running:
|
||||
raise RuntimeError("Publisher is closed")
|
||||
|
||||
@@ -9,6 +9,7 @@ from vllm.multimodal import MULTIMODAL_REGISTRY, MultiModalRegistry
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.config import VllmConfig
|
||||
from vllm.config.kv_events import KVEventsConfig
|
||||
from vllm.distributed.ec_transfer.ec_connector.base import ECConnectorBase
|
||||
from vllm.distributed.kv_transfer.kv_connector.v1 import KVConnectorBase_V1
|
||||
from vllm.v1.core.sched.output import GrammarOutput, SchedulerOutput
|
||||
@@ -256,3 +257,6 @@ class SchedulerInterface(ABC):
|
||||
|
||||
def get_ec_connector(self) -> "ECConnectorBase | None":
|
||||
return None
|
||||
|
||||
def get_kv_event_publisher_config(self) -> "KVEventsConfig | None":
|
||||
return None
|
||||
|
||||
@@ -8,7 +8,7 @@ from dataclasses import replace
|
||||
from typing import Any
|
||||
|
||||
from vllm.compilation.cuda_graph import CUDAGraphStat
|
||||
from vllm.config import VllmConfig
|
||||
from vllm.config import KVEventsConfig, VllmConfig
|
||||
from vllm.distributed.ec_transfer.ec_connector.base import (
|
||||
ECConnectorBase,
|
||||
ECConnectorMetadata,
|
||||
@@ -2554,6 +2554,9 @@ class Scheduler(SchedulerInterface):
|
||||
def get_ec_connector(self) -> ECConnectorBase | None:
|
||||
return self.ec_connector
|
||||
|
||||
def get_kv_event_publisher_config(self) -> KVEventsConfig | None:
|
||||
return self.kv_event_publisher.get_publisher_config()
|
||||
|
||||
def _connector_finished(
|
||||
self, request: Request
|
||||
) -> tuple[bool, dict[str, Any] | None]:
|
||||
|
||||
@@ -11,6 +11,7 @@ import msgspec
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from vllm.config.kv_events import KVEventsConfig
|
||||
from vllm.lora.request import LoRARequest
|
||||
from vllm.multimodal.inputs import MultiModalFeatureSpec
|
||||
from vllm.pooling_params import PoolingParams
|
||||
@@ -90,6 +91,7 @@ class EngineCoreReadyResponse:
|
||||
# KV cache capacity (None for encoder-only/attention-free models).
|
||||
kv_cache_size_tokens: int | None = None
|
||||
kv_cache_max_concurrency: float | None = None
|
||||
kv_events_config: KVEventsConfig | None = None
|
||||
|
||||
|
||||
class EngineCoreRequest(
|
||||
|
||||
@@ -1639,6 +1639,7 @@ class EngineCoreProc(EngineCore):
|
||||
max_num_seqs=scheduler_config.max_num_seqs,
|
||||
max_num_batched_tokens=scheduler_config.max_num_batched_tokens,
|
||||
instance_id=self.vllm_config.instance_id,
|
||||
kv_events_config=self.scheduler.get_kv_event_publisher_config(),
|
||||
)
|
||||
|
||||
def process_input_sockets(
|
||||
|
||||
Reference in New Issue
Block a user