Skip to content

vllm.v1.kv_cache_layout

Physical KV cache layout descriptor.

A leaf module so vllm.config can import the enum without pulling in the full KV cache interface.

Classes:

  • KVCacheLayout –

    Physical layout descriptor for a KV cache group.

KVCacheLayout

Bases: Enum

Physical layout descriptor for a KV cache group.

The logical shape is always [L, B, H, N, ] (RFC #42082). Each member's value is a stride permutation that maps logical axes to physical (memory) order.

Attributes:

is_block_compact property

True when each page's [H, N, C] bytes form one contiguous run; i.e. the L and B dimensions are outermost.

is_block_contiguous property

True when [H, N, C] is contiguous within a block.

is_block_outermost property

True when B is the outermost physical dimension.

is_layer_compact property

True when the layer is compact; i.e. the L dimension is outermost.

layer_view_order property

Physical axis order of a logical 4D per-layer cache view.