vllm.v1.attention.backends.mla.compressor_utils
¶
Functions:
-
get_compressed_slot_mapping–Slot mapping for writing the compressed states of
num_tokenstokens. -
get_dspark_swa_index_width–Return the padded width of non-causal DSpark SWA indices.
get_compressed_slot_mapping(num_tokens, slot_mapping, query_start_loc, seq_lens, block_table, block_size, compress_ratio, out=None)
¶
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.
Source code in vllm/v1/attention/backends/mla/compressor_utils.py
get_dspark_swa_index_width(window_size, num_speculative_tokens)
¶
Return the padded width of non-causal DSpark SWA indices.