block_pool - vLLM
Skip to content

vllm.v1.hisparse.block_pool

Classes:

SharedEventQueueBlockPool

Bases: BlockPool

A pool that publishes into another pool's live KV event queue.

The owner rebinds its queue on every drain, so this reads it through the owner rather than holding a reference.

Source code in vllm/v1/hisparse/block_pool.py
class SharedEventQueueBlockPool(BlockPool):
    """A pool that publishes into another pool's live KV event queue.

    The owner rebinds its queue on every drain, so this reads it through the
    owner rather than holding a reference.
    """

    def __init__(self, *args, event_owner: BlockPool, **kwargs) -> None:
        self._event_owner = event_owner
        super().__init__(*args, **kwargs)

    @property
    def kv_event_queue(self) -> list[KVCacheEvent]:
        return self._event_owner.kv_event_queue

    @kv_event_queue.setter
    def kv_event_queue(self, events: list[KVCacheEvent]) -> None:
        # ``BlockPool.__init__`` seeds an empty queue and ``take_events``
        # swaps in a fresh one; both belong to the owner, which drains it.
        assert not events