[1/N][warmup][DSv4] Migrate generic MLA metadata and indexing kernels (#50175)
Signed-off-by: LopezCastroRoberto <rocastro@redhat.com> Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
co-authored by
Codex
parent
188716ace7
commit
e16b5e518d
@@ -353,6 +353,57 @@ class DeepseekV4Attention(nn.Module, AttentionLayerBase, ABC):
|
||||
k_cache_prefix=self.prefix,
|
||||
)
|
||||
|
||||
if vllm_config.kernel_config.enable_jit_warmup:
|
||||
from vllm.v1.attention.backends.mla.sparse_swa import (
|
||||
_COMPUTE_PREFILL_METADATA_KERNEL,
|
||||
_COMPUTE_SWA_INDICES_AND_LENS_KERNEL,
|
||||
)
|
||||
|
||||
_COMPUTE_PREFILL_METADATA_KERNEL.register_warmup()
|
||||
_COMPUTE_SWA_INDICES_AND_LENS_KERNEL.register_warmup(
|
||||
window_size=self.window_size,
|
||||
block_size=self.swa_cache_layer.block_size,
|
||||
)
|
||||
|
||||
if self.compress_ratio > 1:
|
||||
from vllm.v1.attention.backends.mla.compressor_utils import (
|
||||
_COMPRESSED_SLOT_MAPPING_KERNEL,
|
||||
)
|
||||
|
||||
_COMPRESSED_SLOT_MAPPING_KERNEL.register_warmup()
|
||||
|
||||
if self.indexer is not None:
|
||||
from vllm.v1.attention.backends.mla.indexer import (
|
||||
_BUILD_PREFILL_CHUNK_METADATA_KERNEL,
|
||||
_PREPARE_UNIFORM_DECODE_KERNEL,
|
||||
)
|
||||
|
||||
_PREPARE_UNIFORM_DECODE_KERNEL.register_warmup()
|
||||
_BUILD_PREFILL_CHUNK_METADATA_KERNEL.register_warmup()
|
||||
|
||||
spec_config = vllm_config.speculative_config
|
||||
if spec_config is not None and spec_config.use_dspark():
|
||||
from vllm.v1.attention.backends.mla.sparse_swa import (
|
||||
_COMPUTE_DSPARK_NONCAUSAL_SWA_INDICES_KERNEL,
|
||||
)
|
||||
|
||||
_COMPUTE_DSPARK_NONCAUSAL_SWA_INDICES_KERNEL.register_warmup(
|
||||
window_size=self.window_size,
|
||||
num_speculative_tokens=spec_config.num_speculative_tokens,
|
||||
block_size=self.swa_cache_layer.block_size,
|
||||
)
|
||||
|
||||
if self.backend_cls.get_name() in (
|
||||
"FLASHMLA_SPARSE_DSV4",
|
||||
"ROCM_FLASHMLA_SPARSE_DSV4",
|
||||
"XPU_V4_MLA_SPARSE",
|
||||
):
|
||||
from vllm.models.deepseek_v4.common.ops.cache_utils import (
|
||||
_COMBINE_TOPK_SWA_INDICES_KERNEL,
|
||||
)
|
||||
|
||||
_COMBINE_TOPK_SWA_INDICES_KERNEL.register_warmup()
|
||||
|
||||
def forward(
|
||||
self,
|
||||
positions: torch.Tensor,
|
||||
|
||||
Reference in New Issue
Block a user