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 of the KV blocks a step may write: each request's last
_block_dim(tensor, num_blocks)
¶
Return (block dim, kernel blocks per allocator block).
Source code in vllm/benchmarks/forward/kv_init.py
touched_kv_views(static_forward_context, kv_cache_groups, batch, num_blocks, dcp_size)
¶
Views of the KV blocks a step may write: each request's last ceil(scheduled / block_size) + 2 blocks, in every group.