vllm.v1.attention.ops.xpu_mla_sparse
¶
Functions:
-
triton_bf16_mla_sparse_interface–Sparse MLA attention over a BF16 latent KV cache, using Triton.
triton_bf16_mla_sparse_interface(q, kv, indices, sm_scale, d_v=512, block_dpe=64, attn_sink=None)
¶
Sparse MLA attention over a BF16 latent KV cache, using Triton.
Parameters:
-
(q¶Tensor) –Query tensor, [num_tokens, num_heads_q, dim_qk].
-
(kv¶Tensor) –Latent KV cache tensor.
-
(indices¶Tensor) –Sparse KV indices selected for each query token.
-
(sm_scale¶float) –Softmax scale applied to the QK product.
-
(d_v¶int, default:512) –Size of the value dimension.
-
(block_dpe¶int, default:64) –Size of positional embedding portion of dim_qk. Set to 0 when q/kv contain only the nope latent (e.g. DSv4 prefill where RoPE is not split out).
-
(attn_sink¶Tensor | None, default:None) –Optional per-head fp32 sink logit added to the softmax denominator (DSv4). It must be on
q's device, contiguous and at leastnum_heads_qlong (extra padded entries are ignored).-infentries are a no-op. The returnedsoftmax_lseandmax_logitsare over the selected keys only and exclude the sink, so do not merge them with other partial results as if they included it.
Returns: