Skip to content

vllm.benchmarks.forward.kv_init

KV blocks of a benchmark case: initialization and the blocks a step writes.

Only the case's blocks are touched, group by group: groups can alias one allocation with different layouts, and the batch builder keeps their block IDs disjoint. Zero KV times within a few percent of random KV, even for sparse attention (DeepSeek-V4.1, ~100K context), so zeros are the only init for now.

Functions:

  • touched_kv_views –

    Views a step may write: attention tails and all recurrent state slots.

_block_dim(tensor, num_blocks)

Return (block dim, kernel blocks per allocator block).

touched_kv_views(kv_caches, attn_groups, batch, num_blocks, dcp_size, lookahead=0)

Views a step may write: attention tails and all recurrent state slots.