mstar.engine.resources.kv.cpu_page_pool#
Host-side page pool for KV cache offloading.
When device pages run out, a cold request’s pages move here, into pinned host memory, freeing device pages for the requests that are actually running. They move back when it is scheduled again.
The pool stores pages and the stream metadata that has to survive the round trip; which request to evict, and when, is the worker’s decision.
Classes
|
Host mirror of the paged KV cache, holding whatever is offloaded. |
|
One (request, label) stream living on the host. |
- class mstar.engine.resources.kv.cpu_page_pool.CPUPagePool(config, kv_cache, max_cpu_pages)[source]#
Bases:
objectHost mirror of the paged KV cache, holding whatever is offloaded.
- discard(rid, label)[source]#
Drop a stream that was copied here but never committed to.
The offload aborted after the copy, so the device pages stay live and these host pages go back to the pool.
- offload_stream(rid, label, gpu_kv_cache, gpu_page_indices, stored_len, position, released=0)[source]#
Copy device pages to the host. False when the host pool is full, in which case nothing moved and the caller keeps its device pages.