[HMA]Fix corner case when hybrid page_size can not be evenly divided issue (blk_size=64,tp=4) (#37467)

Signed-off-by: Chendi Xue <chendi.xue@intel.com>
Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>
Signed-off-by: Chendi.Xue <chendi.xue@intel.com>
Co-authored-by: Matthew Bonanni <mbonanni@redhat.com>
Co-authored-by: Nicolò Lucchesi <nlucches@redhat.com>
This commit is contained in:
Chendi.Xue
2026-03-30 16:47:30 +00:00
committed by GitHub
co-authored by Matthew Bonanni Nicolò Lucchesi
parent b4a2f3ac36
commit 3b1dbaad4e
12 changed files with 220 additions and 186 deletions
+4
View File
@@ -311,6 +311,10 @@ class AttentionBackend(ABC):
def get_required_kv_cache_layout(cls) -> "KVCacheLayoutType | None":
return None
@classmethod
def is_ssm(cls) -> bool:
return False
class AttentionMetadata:
pass
+7
View File
@@ -43,6 +43,7 @@ from vllm.config import (
from vllm.config.cache import CacheDType
from vllm.distributed.parallel_state import get_dcp_group
from vllm.logger import init_logger
from vllm.platforms import current_platform
from vllm.platforms.interface import DeviceCapability
from vllm.utils.math_utils import cdiv, round_up
from vllm.v1.attention.backend import (
@@ -90,6 +91,12 @@ class FlashAttentionBackend(AttentionBackend):
forward_includes_kv_cache_update: bool = False
@classmethod
def get_preferred_block_size(cls, default_block_size: int) -> int:
if current_platform.is_xpu():
return max(default_block_size, 64)
return super().get_preferred_block_size(default_block_size)
@staticmethod
def get_name() -> str:
return "FLASH_ATTN"
+4
View File
@@ -31,6 +31,10 @@ class GDNAttentionBackend(AttentionBackend):
def get_builder_cls() -> type["GDNAttentionMetadataBuilder"]:
return GDNAttentionMetadataBuilder
@classmethod
def is_ssm(cls) -> bool:
return True
@dataclass
class GDNAttentionMetadata:
@@ -27,6 +27,10 @@ class LinearAttentionBackend(AttentionBackend):
def get_builder_cls() -> type["LinearAttentionMetadataBuilder"]:
return LinearAttentionMetadataBuilder
@classmethod
def is_ssm(cls) -> bool:
return True
@dataclass
class LinearAttentionMetadata:
@@ -20,6 +20,10 @@ class Mamba1AttentionBackend(AttentionBackend):
def get_builder_cls() -> type["Mamba1AttentionMetadataBuilder"]:
return Mamba1AttentionMetadataBuilder
@classmethod
def is_ssm(cls) -> bool:
return True
@dataclass
class Mamba1AttentionMetadata(BaseMambaAttentionMetadata):
@@ -96,6 +96,10 @@ class Mamba2AttentionBackend(AttentionBackend):
def get_builder_cls() -> type["Mamba2AttentionMetadataBuilder"]:
return Mamba2AttentionMetadataBuilder
@classmethod
def is_ssm(cls) -> bool:
return True
@dataclass
class Mamba2AttentionMetadata(BaseMambaAttentionMetadata):
@@ -18,6 +18,10 @@ class ShortConvAttentionBackend(AttentionBackend):
def get_builder_cls() -> type["ShortConvAttentionMetadataBuilder"]:
return ShortConvAttentionMetadataBuilder
@classmethod
def is_ssm(cls) -> bool:
return True
@dataclass
class ShortConvAttentionMetadata(BaseMambaAttentionMetadata):