@@ -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 "
0 commit comments