vllm.v1.attention.backends.rocm_octave_attn
¶
Octave attention backend for AMD GPUs (native kernels: HIP or FlyDSL).
KV cache format and reference: vllm/v1/attention/ops/rocm_octave.py.
RDNA3/CDNA3 use the kernel tiers in csrc/attention/octave_attn.cu.
RDNA4 uses rocm_octave_rdna4_attn.py. See docs/design/rocm_octave.md.
Decode, MTP verification and short continuation chunks (every request with
at most _DECODE_MAX_QUERY_LEN query tokens) run the split-KV decode
kernel over the packed cache; consecutive query tokens of one request share
each K/V read. Longer prefills run the prefill kernel, which reads the cached
prefix from the packed cache and the current chunk's K/V unquantized.
Classes:
RocmOctaveAttentionBackend
¶
Bases: AttentionBackend
Methods:
-
customize_spec–One packed K+V slot per (token, KV head).
customize_spec(spec)
classmethod
¶
One packed K+V slot per (token, KV head).
RocmOctaveAttentionImpl
¶
Bases: AttentionImpl
_mid_o_buffer(num_q, device)
¶
Split-KV partials, from the workspace every layer shares. Without a workspace, a buffer of this layer's own, allocated once at the cudagraph capture size since captured graphs hold its address.
_prefill(out, q, key, value, kv_cache, md)
¶
Requests after the decodes, in the rotated space, without host syncs: one call covers them all, reading the cached prefixes straight from the packed cache and the chunks' own K/V unquantized.
RocmOctaveMetadataBuilder
¶
Bases: AttentionMetadataBuilder[RocmOctaveMetadata]
_fill_query_maps(md)
staticmethod
¶
On the device, without host syncs (also inside graph capture). Queries past the last request (cudagraph padding) get K length 0.
_mid_o_shape(num_q, num_heads, max_splits, capture_size, split_cap=None)
¶
Split-KV partials for num_q queries: every split up to the cudagraph capture size, fewer splits past it so the buffer never outgrows that. With split_cap, small batches spend the same buffer on up to split_cap splits (a wide GPU needs them to fill its CUs with one query).