Skip to content

Commit baa57ef

Browse files
Revert "[Bugfix][Attention] Temporarily disable FA4 head-dim 256 (vllm-project#52050)"
This reverts commit 1f0e0bf. Signed-off-by: Simon Veitner <sveitner@redhat.com>
1 parent d591d1d commit baa57ef

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

vllm/v1/attention/backends/fa_utils.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def get_flash_attn_version(
7272
head_size: int | None = None,
7373
head_size_v: int | None = None,
7474
has_sinks: bool = False,
75+
requires_local_attention: bool = False,
7576
) -> int | None:
7677
if current_platform.is_xpu():
7778
return 2
@@ -168,26 +169,28 @@ def get_flash_attn_version(
168169
)
169170
fa_version = 2
170171

171-
# TODO: Restore the `requires_local_attention` restriction when FA4
172-
# head-dim 256 is re-enabled.
173-
if fa_version == 4 and device_capability.major >= 10 and head_size == 256:
172+
if (
173+
fa_version == 4
174+
and device_capability.major >= 10
175+
and head_size == 256
176+
and requires_local_attention
177+
):
174178
logger.warning_once(
175-
"FA4 on Blackwell is temporarily disabled for head_size=256, "
176-
"defaulting to FA version 2."
179+
"FA4 on Blackwell does not support local attention with "
180+
"head_size=256, defaulting to FA version 2."
177181
)
178182
fa_version = 2
179183

180184
# FA4 on SM100 (Blackwell) has TMEM capacity limits that restrict
181-
# supported head dimensions to ≤128. The 192/128 MLA prefill case is
182-
# supported; 256 is temporarily disabled until upstream supports the
183-
# required features. Development of symmetric 192, 384, and 512 support
184-
# is tracked in https://github.com/Dao-AILab/flash-attention/issues/2456
185+
# supported head dimensions to ≤128, with exceptions for 256 and 192/128 (MLA
186+
# prefill). Development of symmetric 192, 384, and 512 support is being tracked
187+
# in https://github.com/Dao-AILab/flash-attention/issues/2456
185188
if (
186189
fa_version == 4
187190
and device_capability.major >= 10
188191
and head_size is not None
189192
and head_size > 128
190-
and not (head_size == 192 and head_size_v == 128)
193+
and not (head_size == 256 or (head_size == 192 and head_size_v == 128))
191194
):
192195
logger.warning_once(
193196
"FA4 on Blackwell does not support head_size=%d due to TMEM "

vllm/v1/attention/backends/flash_attn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ def __init__(
860860
self.attn_type = attn_type
861861
self.vllm_flash_attn_version = get_flash_attn_version(
862862
requires_alibi=alibi_slopes is not None,
863+
requires_local_attention=sliding_window is not None,
863864
head_size=head_size,
864865
has_sinks=sinks is not None,
865866
)

0 commit comments

Comments
 (0)