vllm.v1.attention.ops.triton_merge_attn_states ¶
Functions:
-
mask_empty_context–Neutralize context chunks that cover no keys before merging.
mask_empty_context(lse, output, query_start_loc, context_start_loc) ¶
Neutralize context chunks that cover no keys before merging.
A prefill query whose context chunk is empty attended to no keys, so its partial attention is undefined: the backend leaves the output rows as uninitialized scratch (which may hold NaN/Inf) even when it reports an LSE of -inf. Sanitize both here so merge_attn_states can stay generic: force the LSE to -inf (zero softmax weight) and zero the undefined output rows (so a zero weight cannot combine with NaN/Inf). Emptiness is derived from the context offsets, not from the -inf LSE, so no merge kernel has to reason about undefined partials.
Parameters:
-
(lse¶Tensor) –Chunk log-sum-exp, shape [num_heads, num_tokens].
-
(output¶Tensor) –Chunk attention output, shape [num_tokens, num_heads, ...].
-
(query_start_loc¶Tensor) –Prefill query cumulative offsets, shape [num_reqs + 1].
-
(context_start_loc¶Tensor) –Chunk context cumulative offsets, shape [num_reqs + 1]; an empty chunk has a zero-length span.