vllm.distributed.kv_transfer.kv_connector.v1.offloading.events ¶
Self-describing KV cache events for the offloading connector.
The OffloadingManager identifies an offloaded chunk only by its OffloadKey, so its raw events carry no token ids, parent hash, or block size. :class:OffloadingEventsTracker snapshots each chunk's full BlockStored payload while the Request is alive and publishes stores as block-granular payloads: a chunk event may carry multiple constituent per-block hashes, and evictions fan out to the same hashes. Chunks overlapping a non-chunk-aligned shared prefix re-announce the shared hashes once per chunk; consumers are expected to deduplicate (reference-count) repeated store/remove announcements of the same hash. Opt-in via kv_connector_extra_config["self_describing_kv_events"]; inert unless KV cache events are enabled. See the PR description for the full design.
Classes:
-
OffloadingEventsTracker–Tracks offloaded chunks' KV event payloads from store to eviction.
OffloadingEventsTracker ¶
Tracks offloaded chunks' KV event payloads from store to eviction.
The scheduler calls :meth:record_store from _build_store_jobs while the Request is available, and routes the manager's raw :class:OffloadingEvent stream through :meth:take_events. All state is bounded by the CPU pool capacity and cleared by :meth:reset.
Methods:
-
record_store–Snapshot the KV cache event payload for one offloaded chunk.
-
reset–Drop all tracked state; pending payloads are stale after a
-
take_events–Translate raw OffloadingEvents into self-describing KV events.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/offloading/events.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
_build_event_metadata(req, group_config, offload_block_idx) ¶
Build the payload snapshot for one offloaded chunk: its constituent per-block hashes, the whole chunk's tokens, and the per-block block_size.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/offloading/events.py
record_store(req, group_config, offload_block_idx, offload_key) ¶
Snapshot the KV cache event payload for one offloaded chunk.
No-op when self-describing event capture is disabled or for sliding-window / SSM groups, which keep the legacy placeholder payload.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/offloading/events.py
reset() ¶
Drop all tracked state; pending payloads are stale after a manager cache reset.
take_events(events) ¶
Translate raw OffloadingEvents into self-describing KV events.
Complete metadata is available only for full-attention groups when the tracker is enabled. Other shapes retain the legacy placeholder payload so consumers can ignore them.
Yields:
-
Iterable[KVCacheEvent]–BlockStoredorBlockRemovedevents corresponding to -
Iterable[KVCacheEvent]–the underlying :class:
OffloadingEventstream.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/offloading/events.py
_OffloadEventMetadata dataclass ¶
BlockStored payload snapshot for one OffloadKey, captured at store time and kept until the matching eviction event. medium is forwarded from the OffloadingEvent.