Skip to content

vllm.v1.attention.backends.mla.compressor_utils

Functions:

get_compressed_slot_mapping(num_tokens, slot_mapping, query_start_loc, seq_lens, block_table, block_size, compress_ratio, out=None, dcp_world_size=1, cp_interleave=1)

Slot mapping for writing the compressed states of num_tokens tokens.

Every compress_ratio tokens share one compressed state, written by the last of them: that token maps to the state's slot, the others to PAD. A token whose own slot_mapping entry is PAD maps to PAD too: SWA bounded replay recomputes tokens whose KV is cached already, and their compressed states must not be rewritten either.

get_dspark_swa_index_width(window_size, num_speculative_tokens)

Return the padded width of non-causal DSpark SWA indices.