For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
ScratchKVGroupCoordinator
ScratchKVGroupCoordinator
class max.pipelines.kv_cache.paged_kv_cache.scratch_coordinator.ScratchKVGroupCoordinator(pools, leaf_id, group_id, page_size, *, rows=<factory>)
Bases: KVGroupCoordinatorInterface
A group holding one never-published block per request.
The block is drawn on the request’s first grow() and freed at
release(), and nothing in between moves it: a page boundary neither
publishes it nor rotates it, so its id is stable for the request’s whole
life. That is what a ring of recent kernel inputs needs, and it is why
commit(), advance() and shrink_to_fit() do nothing here.
Carrying no hash keeps the group out of every content-addressed path. It answers no hit, contributes no claimable hash, and asks an external tier for nothing.
-
Parameters:
-
- pools (Sequence[JengaBlockPool])
- leaf_id (str)
- group_id (KVCacheGroupId)
- page_size (int)
- rows (dict[RequestID, dict[str, list[LittleKVCacheBlock]]])
advance()
advance(req_id, num_committed_blocks, replica_idx)
Frees nothing: the request reads its block until it is released.
blocks_held_of_connector_hit()
blocks_held_of_connector_hit(num_hit_blocks)
Returns zero: an external tier holds nothing for this group.
claim_hit_blocks()
claim_hit_blocks(desired_hashes, replica_idx)
Returns empty rows: a hit leaves this group nothing to take.
claimable_hashes()
claimable_hashes(desired_hashes)
Returns nothing: this group’s block is never published.
commit()
commit(req_id, hashes, last_block, replica_idx)
Publishes nothing.
forward_blocks()
forward_blocks(batch, num_blocks)
Returns the one block each request’s scratch lives in.
grow()
grow(req_id, num_required_blocks, replica_idx)
Draws the request’s one block, if it does not hold it yet.
grow_with_padding()
grow_with_padding(req_id, num_required_blocks, replica_idx)
Points the row at one null block, however long the dummy is.
shrink_to_fit()
shrink_to_fit(req_id, num_committed_blocks, replica_idx)
Keeps the block: there is no committed prefix to trim it to.