[diffusion] [AMD] model: allow AITER backends in Flux 2 pipeline (#22802)

This commit is contained in:
Aleksi Vesanto
2026-04-22 08:15:44 -07:00
committed by GitHub
parent 8b78e0888c
commit ac351c1f04
2 changed files with 6 additions and 6 deletions
@@ -71,16 +71,14 @@ class AITerImpl(AttentionImpl):
Performs attention using aiter.flash_attn_func. Performs attention using aiter.flash_attn_func.
Args: Args:
query: Query tensor of shape [batch_size, num_heads, seq_len, head_dim] query: Query tensor of shape [batch_size, seq_len, num_heads, head_dim]
key: Key tensor of shape [batch_size, num_heads, seq_len, head_dim] key: Key tensor of shape [batch_size, seq_len, num_heads, head_dim]
value: Value tensor of shape [batch_size, num_heads, seq_len, head_dim] value: Value tensor of shape [batch_size, seq_len, num_heads, head_dim]
attn_metadata: Metadata for the attention operation (unused). attn_metadata: Metadata for the attention operation (unused).
Returns: Returns:
Output tensor of shape [batch_size, num_heads, seq_len, head_dim] Output tensor of shape [batch_size, seq_len, num_heads, head_dim]
""" """
# aiter.flash_attn_func expects tensors in [B, H, S, D] layout,
# which is what ring_attn provides.
output, _ = aiter.flash_attn_func( output, _ = aiter.flash_attn_func(
query, query,
key, key,
@@ -865,6 +865,8 @@ class Flux2Transformer2DModel(CachableDiT, OffloadableDiTMixin):
_supported_attention_backends = { _supported_attention_backends = {
AttentionBackendEnum.TORCH_SDPA, AttentionBackendEnum.TORCH_SDPA,
AttentionBackendEnum.FA, AttentionBackendEnum.FA,
AttentionBackendEnum.AITER,
AttentionBackendEnum.AITER_SAGE,
} }
def post_load_weights(self) -> None: def post_load_weights(self) -> None: