vllm.v1.simple_kv_offload.worker
¶
Worker-side handler for SimpleCPUOffloadConnector.
Classes:
-
SimpleCPUOffloadWorker–Worker-side handler for CPU offloading transfers.
SimpleCPUOffloadWorker
¶
Worker-side handler for CPU offloading transfers.
Methods:
-
build_connector_worker_meta–Return completed store events since the last call.
-
get_finished–Report completed transfer events to the scheduler.
-
handle_preemptions–Sync all in-flight transfers before preempted blocks are reused.
-
register_kv_caches–Register GPU KV caches and allocate pinned CPU tensors.
-
shutdown–Stop the copy thread and unregister the pinned CPU caches.
-
wait_for_save–Submit async stores.
_alloc_cpu_caches(unique_gpu_caches, pin_memory)
¶
Carve per-layer caches out of one mapping, pinned in bounded chunks.
_flush_and_sync_all()
¶
Synchronize all in-flight transfer events.
_poll_stream_events(is_store)
¶
Non-blocking poll for completed events and return the high-water mark.
build_connector_worker_meta()
¶
Return completed store events since the last call.
get_finished(finished_req_ids)
¶
Report completed transfer events to the scheduler.
Loads are submitted in start_load_kv() and stores in wait_for_save().
Returns:
handle_preemptions(kv_connector_metadata)
¶
Sync all in-flight transfers before preempted blocks are reused.
register_kv_caches(kv_caches)
¶
Register GPU KV caches and allocate pinned CPU tensors. The worker will infer the underlying raw storage from the kv_caches.
Parameters:
shutdown()
¶
Stop the copy thread and unregister the pinned CPU caches.
An in-process engine frees the host mapping without exiting, so a later registration can land on the same addresses. Never raises: it runs on the worker teardown path.
wait_for_save()
¶
Submit async stores.
Stores (GPU->CPU) read the live KV cache, which the compute stream may still be writing under v1 overlapped execution, so they are ordered after a compute-done event recorded on the current stream. See