uncomment flex backend for batch invariant mode (#40842)

Signed-off-by: Angel Li <liangel@meta.com>
This commit is contained in:
liangel-02
2026-04-28 21:05:14 -07:00
committed by GitHub
parent 99255f3cb5
commit 7fd05e05ae
2 changed files with 8 additions and 9 deletions
+1
View File
@@ -26,6 +26,7 @@ TEST_MODEL = os.getenv("VLLM_TEST_MODEL", DEFAULT_MODEL)
BACKENDS: list[str] = [
"FLASH_ATTN",
"TRITON_ATTN",
"FLEX_ATTENTION",
]
# FlashInfer temporarily disabled due to invariant CTA sizes.
+7 -9
View File
@@ -99,6 +99,10 @@ class FlexAttentionBackend(AttentionBackend):
"""FlexAttention supports both decoder and encoder-only attention."""
return attn_type in (AttentionType.DECODER, AttentionType.ENCODER_ONLY)
@classmethod
def supports_batch_invariance(cls) -> bool:
return True
@classmethod
def supports_mm_prefix(cls) -> bool:
"""FlexAttention supports full attention for image tokens."""
@@ -326,15 +330,9 @@ class BlockSparsityHint(NamedTuple):
def copy_to_persistent(dst, src):
try:
dst = dst.as_strided(src.shape, src.stride())
except RuntimeError as e:
raise RuntimeError(
f"Fail to re-stride a persistent tensor of shape {dst.shape} "
f"for a tensor of shape {src.shape}"
) from e
dst.copy_(src)
return dst
sliced = dst[tuple(slice(0, s) for s in src.shape)]
sliced.copy_(src)
return sliced
@dataclass