[feature][kv_offload] Self-describing KV events for OffloadingConnector (#43468)
Signed-off-by: Change72 <changg@nvidia.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -147,6 +147,16 @@ class OffloadingHistogramMetadata(OffloadingMetricMetadata):
|
||||
buckets: tuple[float, ...] | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class OffloadingKVEventsConfig:
|
||||
# Global vLLM KV event publishing flag. When false, connector-specific
|
||||
# event capture must stay inert because take_events() is not drained.
|
||||
enable_kv_cache_events: bool
|
||||
# OffloadingConnector opt-in for self-describing BlockStored payloads.
|
||||
# Effective only when enable_kv_cache_events is true.
|
||||
self_describing_kv_events: bool
|
||||
|
||||
|
||||
class OffloadingManager(ABC):
|
||||
@abstractmethod
|
||||
def lookup(self, key: OffloadKey, req_context: ReqContext) -> bool | None:
|
||||
@@ -443,6 +453,15 @@ class OffloadingSpec(ABC):
|
||||
kv_transfer_config = vllm_config.kv_transfer_config
|
||||
assert kv_transfer_config is not None
|
||||
self.extra_config = kv_transfer_config.kv_connector_extra_config
|
||||
kv_events_config = vllm_config.kv_events_config
|
||||
self.kv_events_config = OffloadingKVEventsConfig(
|
||||
enable_kv_cache_events=(
|
||||
kv_events_config is not None and kv_events_config.enable_kv_cache_events
|
||||
),
|
||||
self_describing_kv_events=bool(
|
||||
self.extra_config.get("self_describing_kv_events", False)
|
||||
),
|
||||
)
|
||||
|
||||
# When True, only prompt (prefill) blocks are offloaded; decode-phase
|
||||
# blocks (KV generated after the prompt) are skipped. Useful when prior
|
||||
|
||||
Reference in New Issue
Block a user