[2/N][warmup][DSv4] Migrate sequence and DCP kernels (#53564)
Signed-off-by: LopezCastroRoberto <rocastro@redhat.com> Co-authored-by: Codex <codex@openai.com> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Codex
OpenAI Codex
Lucas Wilkinson
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
ecd600d91e
commit
1713b9866a
@@ -768,7 +768,8 @@ class SparseAttnIndexer(CustomOp):
|
||||
# DCP scalars are constant for the run; resolve them here (config is set
|
||||
# during model construction) and pass them into the custom op, rather
|
||||
# than threading them through per-step metadata.
|
||||
parallel_config = get_current_vllm_config().parallel_config
|
||||
vllm_config = get_current_vllm_config()
|
||||
parallel_config = vllm_config.parallel_config
|
||||
self._parallel_config = parallel_config
|
||||
self.dcp_world_size = parallel_config.decode_context_parallel_size
|
||||
self.dcp_rank = get_dcp_group().rank_in_group if self.dcp_world_size > 1 else 0
|
||||
@@ -780,6 +781,28 @@ class SparseAttnIndexer(CustomOp):
|
||||
"the current vLLM environment."
|
||||
)
|
||||
|
||||
if vllm_config.kernel_config.enable_jit_warmup:
|
||||
from vllm.v1.attention.ops.common import (
|
||||
_PACK_SEQ_TRITON_KERNEL,
|
||||
_UNPACK_SEQ_TRITON_KERNEL,
|
||||
)
|
||||
|
||||
pack_dtype = torch.uint8 if use_fp4_cache else current_platform.fp8_dtype()
|
||||
_PACK_SEQ_TRITON_KERNEL.register_warmup(
|
||||
dtype=pack_dtype,
|
||||
pad_value=0 if use_fp4_cache else -float("inf"),
|
||||
)
|
||||
_UNPACK_SEQ_TRITON_KERNEL.register_warmup()
|
||||
|
||||
if self.dcp_world_size > 1 and current_platform.is_cuda() and has_cutedsl():
|
||||
from vllm.model_executor.kernels.attention.dsa.dcp_indexer_cutedsl import ( # noqa: E501
|
||||
_PACK_DCP_TOPK_CANDIDATES_KERNEL,
|
||||
_STABLE_TOPK_FROM_GATHERED_CANDIDATES_KERNEL,
|
||||
)
|
||||
|
||||
_PACK_DCP_TOPK_CANDIDATES_KERNEL.register_warmup()
|
||||
_STABLE_TOPK_FROM_GATHERED_CANDIDATES_KERNEL.register_warmup()
|
||||
|
||||
@property
|
||||
def cp_kv_cache_interleave_size(self) -> int:
|
||||
"""With PD+DCP, the real value isn't known until block_size is finalized,
|
||||
|
||||
Reference in New Issue
Block a user