query (Tensor) – Query tensor; shape (Tq,Hq,D)
key (Tensor) – Key tensor; shape (Tk,Hkv,D), or
(total_pages,page_size,Hkv,D) when is provided.
value (Tensor) – Value tensor; shape (Tk,Hkv,D), or
(total_pages,page_size,Hkv,D) when is provided.
cu_seq_q (Tensor) – Cumulative sequence positions for queries; shape (N+1,)
cu_seq_k (Tensor) – Cumulative sequence positions for keys/values; shape (N+1,)
max_q (int) – Maximum query sequence length in the batch.
max_k (int) – Maximum key/value sequence length in the batch.
return_aux (Optional[AuxRequest]) – If not None and return_aux.lse is True, also returns the logsumexp tensor.
scale (float, optional) – Scaling factor for attention scores
window_size (tuple[int, int], optional) – Window size for sliding window attention as (left, right).
Use (-1, -1) for full attention (default), (-1, 0) for causal attention,
or (W, 0) for causal attention with sliding window of size W.
enable_gqa (bool) – If set to True, enables Grouped Query Attention (GQA)
and allows key/value to have fewer heads than query.
Each KV head is shared by a group of Hq/Hkv query heads,
so Hq must be divisible by .
Default is False.
seqused_k (Tensor, optional) – Number of valid KV tokens per batch element; shape (N,).
When set, only the first seqused_k[i] tokens in the key/value sequence for batch
element i participate in attention. Useful for KV-cache decoding where the cache slot
is larger than the actual sequence. Inference-only (not supported in backward).
block_table (Tensor, optional) –
Block table for paged KV cache; shape
(N,max_pages_per_seq), dtype int32.
Requires seqused_k. Inference-only (not supported in backward).
When block_table is provided, key and value are a “pool” of
pages of tokens of KV data and the pages belong to any sequence/order.
The is what maps each sequence’s logical chunks
back to physical pages in this pool.
num_splits (int, optional) – Number of splits for split-KV. Set to 1
to disable split-KV which enables batch invariance. Split-KV
parallelizes the key/value sequence dimension across multiple thread
blocks and combines partial results. The split decision depends
on max_k (the longest sequence in the batch), so different batch
compositions can change the reduction order and produce different
floating-point results for the same sequence. When this is disabled,
bitwise identical outputs are guaranteed for a given sequence
regardless of what other sequences are in the batch, at the
cost of lower GPU utilization when there are few queries. When
None (default), the kernel chooses automatically.