[Attention][AMD] Standardize kv layout to blocks first for AMD (#43660)
Signed-off-by: NickLucche <nlucches@redhat.com>
This commit is contained in:
@@ -240,6 +240,10 @@ class AttentionBackend(ABC):
|
||||
def supports_batch_invariance(cls) -> bool:
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def supports_kv_connector(cls) -> bool:
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def supports_attn_type(cls, attn_type: str) -> bool:
|
||||
"""Check if backend supports a given attention type.
|
||||
@@ -283,6 +287,7 @@ class AttentionBackend(ABC):
|
||||
attn_type: str,
|
||||
use_non_causal: bool = False,
|
||||
use_batch_invariant: bool = False,
|
||||
use_kv_connector: bool = False,
|
||||
) -> list[str]:
|
||||
invalid_reasons = []
|
||||
if not cls.supports_head_size(head_size):
|
||||
@@ -319,6 +324,8 @@ class AttentionBackend(ABC):
|
||||
invalid_reasons.append("non-causal attention not supported")
|
||||
if use_batch_invariant and not cls.supports_batch_invariance():
|
||||
invalid_reasons.append("batch invariance not supported")
|
||||
if use_kv_connector and not cls.supports_kv_connector():
|
||||
invalid_reasons.append("KV connector not supported")
|
||||
combination_reason = cls.supports_combination(
|
||||
head_size,
|
||||
dtype,
|
||||
|
||||
Reference in New Issue
Block a user