[PCP][DCP] Enable PCP+DCP on sparse-MLA models (#56157)
Signed-off-by: patryk.saffer <patryk.saffer@blc-login-1.blc1.mistralcompute.ai> Signed-off-by: patryk.saffer <patryk.saffer@blc-login-0.blc1.mistralcompute.ai> Signed-off-by: PatrykSaffer <patryk.saffer@mistral.ai> Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: patryk.saffer <patryk.saffer@blc-login-1.blc1.mistralcompute.ai> Co-authored-by: patryk.saffer <patryk.saffer@blc-login-0.blc1.mistralcompute.ai> Co-authored-by: Lucas Wilkinson <lwilkins@redhat.com> Co-authored-by: Patryk Saffer <PatrykSaffer@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
patryk.saffer
patryk.saffer
Lucas Wilkinson
Patryk Saffer
Claude Fable 5.1
parent
72d4d83157
commit
ebe1dec2da
@@ -420,6 +420,9 @@ class MLAAttention(nn.Module, AttentionLayerBase):
|
||||
"""
|
||||
|
||||
supports_dense_mha_prefill: ClassVar[bool] = True
|
||||
# Under PCP+DCP only the decode rows carry an LSE; the base forward
|
||||
# merges a full-batch LSE, so subclasses opt in with their own forward.
|
||||
supports_pcp_dcp: ClassVar[bool] = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -660,6 +663,10 @@ class MLAAttention(nn.Module, AttentionLayerBase):
|
||||
|
||||
_COMPUTE_PREFILL_METADATA_KERNEL.register_warmup()
|
||||
|
||||
if self.use_pcp and self.impl.dcp_world_size > 1 and not self.supports_pcp_dcp:
|
||||
raise NotImplementedError(
|
||||
f"{type(self).__name__} does not support PCP+DCP."
|
||||
)
|
||||
self.dcp_manager: MLADCPManager | None = None
|
||||
if self.impl.dcp_world_size > 1:
|
||||
query_dtype = (
|
||||
|
||||
@@ -190,7 +190,8 @@ class SparseMLACommonMetadataBuilder(AttentionMetadataBuilder[T]):
|
||||
pin_memory=PIN_MEMORY,
|
||||
)
|
||||
parallel_config = vllm_config.parallel_config
|
||||
self.use_pcp = parallel_config.prefill_context_parallel_size > 1
|
||||
self.pcp_world_size = parallel_config.prefill_context_parallel_size
|
||||
self.use_pcp = self.pcp_world_size > 1
|
||||
try:
|
||||
self.dcp_world_size = get_dcp_group().world_size
|
||||
except AssertionError:
|
||||
@@ -409,8 +410,12 @@ class SparseMLACommonMetadataBuilder(AttentionMetadataBuilder[T]):
|
||||
q_data_type=self.model_config.dtype,
|
||||
output_dtype=self.model_config.dtype,
|
||||
prefill_backend=self._prefill_backend,
|
||||
use_dense_mha=_use_dense_mha_prefill(
|
||||
self.vllm_config, prefill_max_seq_len, self.topk_tokens
|
||||
use_dense_mha=(
|
||||
_use_dense_mha_prefill(
|
||||
self.vllm_config, prefill_max_seq_len, self.topk_tokens
|
||||
)
|
||||
# Dense MHA cannot be used under PCP+DCP.
|
||||
and not (self.use_pcp and self.dcp_world_size > 1)
|
||||
),
|
||||
topk_mask_workspace=self.topk_mask_workspace,
|
||||
host_staging_plan=staging_plan,
|
||||
|
||||
Reference in New Issue
Block a user