vllm.v1.worker.gpu.attn_utils ¶
Functions:
-
compute_mm_prefix_ranges–Compute PrefixLM bidirectional ranges for multimodal tokens.
_align_mixed_attention_kv_cache_views(attn_groups, kv_caches, kernel_block_sizes, cache_dtype, kv_cache_config) ¶
Align shared attention KV views when backends disagree on layout.
Encoder-decoder models can share one raw allocation between decoder self-attention (K/V-first ROCM_ATTN, block dim 1) and cross-attention (blocks-first backends, block dim 0). Keep the physical storage in the K/V-first layout expected by ROCM_ATTN, and restride the blocks-first logical views so block IDs address the same bytes.
Source code in vllm/v1/worker/gpu/attn_utils.py
compute_mm_prefix_ranges(req_ids, mm_features, sliding_window=None) ¶
Compute PrefixLM bidirectional ranges for multimodal tokens.
Ranges exceeding sliding_window are skipped to prevent early tokens from attending across the entire image span.