Skip to content

vllm.v1.attention.backends.rocm_aiter_unified_attn

Attention layer with PagedAttention and Triton prefix prefill.

Classes:

RocmAiterUnifiedAttentionBackend

Bases: RocmAttentionBackend

Methods:

  • customize_spec –

    Keep K and V packed in the content dim, unlike the native HIP

  • supports_attn_type –

    RocmAiterUnifiedAttention supports all attention types.

customize_spec(spec) classmethod

Keep K and V packed in the content dim, unlike the native HIP kernels the base class targets.

supports_attn_type(attn_type) classmethod

RocmAiterUnifiedAttention supports all attention types.

RocmAiterUnifiedAttentionImpl

Bases: RocmAttentionImpl

Methods:

  • forward –

    Forward pass with FlashAttention.

forward(layer, query, key, value, kv_cache, attn_metadata, output, output_scale=None, output_block_scale=None)

Forward pass with FlashAttention.

Parameters:

  • layer

    (Module) –

    The attention layer, providing the q/k/v quantization scales.

  • query

    (Tensor) –

    shape = [num_tokens, num_heads, head_size]

  • key

    (Tensor) –

    shape = [num_tokens, num_kv_heads, head_size]

  • value

    (Tensor) –

    shape = [num_tokens, num_kv_heads, head_size]

  • kv_cache

    (Tensor) –

    shape = [num_blocks, 2, block_size, num_kv_heads, head_size]

  • attn_metadata

    (RocmAttentionMetadata) –

    Metadata for attention.

  • output

    (Tensor) –

    Tensor that the attention result is written into.

  • output_scale

    (Tensor | None, default: None ) –

    Scale for fused output quantization.

  • output_block_scale

    (Tensor | None, default: None ) –

    Block scale for fused output quantization; not supported by this backend.

Returns:

  • Tensor –

    shape = [num_tokens, num_heads * head_size]