[Bugfix] Make Attention Backend Auto-Selection Batch-Invariance-Aware (#40193)

Signed-off-by: Srreyansh Sethi <srreyansh.sethi@gmail.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Srreyansh Sethi
2026-04-23 14:57:03 +00:00
committed by GitHub
co-authored by Matthew Bonanni mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent d0009ddb0b
commit b7a2605020
9 changed files with 38 additions and 50 deletions
+4
View File
@@ -103,6 +103,10 @@ class FlashAttentionBackend(AttentionBackend):
def get_name() -> str:
return "FLASH_ATTN"
@classmethod
def supports_batch_invariance(cls) -> bool:
return True
@classmethod
def supports_non_causal(cls) -> bool:
return True
@@ -56,6 +56,10 @@ class FlashAttnMLABackend(MLACommonBackend):
def get_name() -> str:
return "FLASH_ATTN_MLA"
@classmethod
def supports_batch_invariance(cls) -> bool:
return True
@staticmethod
def get_builder_cls() -> type["FlashAttnMLAMetadataBuilder"]:
return FlashAttnMLAMetadataBuilder
@@ -55,6 +55,10 @@ class TritonMLABackend(MLACommonBackend):
def get_name() -> str:
return "TRITON_MLA"
@classmethod
def supports_batch_invariance(cls) -> bool:
return True
@staticmethod
def get_impl_cls() -> type["TritonMLAImpl"]:
return TritonMLAImpl
@@ -296,6 +296,10 @@ class TritonAttentionBackend(AttentionBackend):
def get_name() -> str:
return "TRITON_ATTN"
@classmethod
def supports_batch_invariance(cls) -> bool:
return True
@staticmethod
def get_impl_cls() -> type["TritonAttentionImpl"]:
return TritonAttentionImpl