Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions aphrodite/model_executor/layers/attention/mla_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,14 @@ def forward_impl(
num_mha_tokens = q.size(0) - num_mqa_tokens

if self.impl.is_sparse and num_mha_tokens > 0:
impl_forward_mha = getattr(type(self.impl), "forward_mha", None)
mha_available = impl_forward_mha is not MLAAttentionImpl.forward_mha
prefill = getattr(attn_metadata, "prefill", None)
use_dense_mha = getattr(prefill, "use_dense_mha", False)
use_dense_mha = mha_available and getattr(prefill, "use_dense_mha", False)
prefill_max_seq_len = attn_metadata.prefill_max_seq_len # type: ignore[attr-defined]
use_masked_mha = (
self.prefill_backend is not None
mha_available
and self.prefill_backend is not None
and self.impl.masked_mha_available # type: ignore[attr-defined]
and self.impl.dcp_world_size <= 1
and prefill is not None
Expand Down
5 changes: 5 additions & 0 deletions aphrodite/model_executor/layers/mla.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def __init__(
# the topk_tokens buffer written by a previous layer in the same pass.
# Refer: https://arxiv.org/abs/2603.12201 for more details.
self.skip_topk = skip_topk
# qrep is active when the query projection is a DCP-group-sharded layer
# that materializes the full group head set locally.
q_proj_layer = self.q_b_proj if self.q_lora_rank is not None else self.q_proj
self.dcp_q_replicate = getattr(q_proj_layer, "qrep_active", False)
if self.indexer is not None:
assert hasattr(self.indexer, "topk_tokens")
self.topk_tokens = self.indexer.topk_tokens
Expand All @@ -115,6 +119,7 @@ def __init__(
quant_config=quant_config,
prefix=f"{prefix}.attn",
kv_b_proj=self.kv_b_proj,
dcp_q_replicate=self.dcp_q_replicate,
use_sparse=self.is_sparse,
indexer=self.indexer,
topk_indices_buffer=mla_modules.topk_indices_buffer,
Expand Down
10 changes: 6 additions & 4 deletions aphrodite/platforms/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,10 +694,12 @@ def support_static_graph_mode(cls) -> bool:

@classmethod
def support_deep_gemm(cls) -> bool:
"""Currently, only Hopper and Blackwell GPUs are supported."""
return (
cls.is_device_capability(90) or cls.is_device_capability_family(100) or cls.is_device_capability_family(120)
)
"""Return whether DeepGEMM is validated on this CUDA architecture.

Consumer Blackwell (SM12x) is excluded. The available DeepGEMM
revisions either lack its kernels or produce incorrect results there.
"""
return cls.is_device_capability(90) or cls.is_device_capability_family(100)

@classmethod
def is_integrated_gpu(cls, device_id: int = 0) -> bool:
Expand Down
4 changes: 4 additions & 0 deletions aphrodite/v1/attention/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,10 @@ class MLAAttentionImpl(AttentionImplBase[T], Generic[T]):
"""MLA attention implementation with forward_mqa and forward_mha methods."""

supports_pcp: bool = True
# Masked sparse-MHA prefill is an optional capability implemented by
# SparseMLACommonImpl. Platform-specific sparse MLA backends inherit the
# safe default and continue to route prefills through MQA.
masked_mha_available: bool = False

@abstractmethod
def __init__(
Expand Down
Loading