Skip to content

vllm.v1.worker.gpu.block_table

Classes:

Functions:

BlockTables

Methods:

gather_block_tables(idx_mapping, num_reqs_padded, out=None, out_ptrs=None, num_computed_tokens=None)

Gather the batch's block-table rows into the forward-pass tables.

When num_computed_tokens ([max_num_reqs], indexed like the block tables) is given, sliding-window groups get every entry wholly below the window of the request's first scheduled token replaced by the null block. Those blocks may already have been freed by the sliding-window manager and reused, while attention kernels can still load them as part of a KV tile that straddles the window start: masked-out NaN in such a tile propagates into the output.

make_slot_mappings(num_groups, num_tokens, device)

Allocate a [num_groups, num_tokens] int64 slot-mapping buffer.

Each group's row is handed to attention as its own tensor, and some kernels assume an aligned base address (DeepSeek-V4's CuTe DSL compressor requires 64 bytes). Pad the row stride so every row starts 128-byte aligned whatever num_tokens is.