[ROCm][DSv4.1] Enable DSpark adaptive verification (#58151)
Signed-off-by: Tuukka Sarvi <tuukka.sarvi@amd.com> Co-authored-by: Kevin H. Luu <khluu000@gmail.com>
This commit is contained in:
co-authored by
Kevin H. Luu
parent
f46021a7fa
commit
10d2c6083d
@@ -8,6 +8,7 @@ from typing import Any, cast
|
||||
|
||||
import torch
|
||||
|
||||
from vllm.config import VllmConfig
|
||||
from vllm.distributed import (
|
||||
get_tensor_model_parallel_world_size,
|
||||
tensor_model_parallel_all_reduce,
|
||||
@@ -41,6 +42,7 @@ from vllm.platforms.rocm import _ON_GFX950
|
||||
from vllm.triton_utils import tl, triton
|
||||
from vllm.utils.multi_stream_utils import execute_in_parallel
|
||||
from vllm.v1.attention.backend import (
|
||||
AttentionCGSupport,
|
||||
CommonAttentionMetadata,
|
||||
MultipleOf,
|
||||
)
|
||||
@@ -61,6 +63,7 @@ from vllm.v1.attention.ops.rocm_aiter_mla_sparse import (
|
||||
from vllm.v1.attention.ops.rocm_paged_mxfp4_indexer import (
|
||||
rocm_paged_mxfp4_cache_layout,
|
||||
)
|
||||
from vllm.v1.kv_cache_interface import KVCacheSpec
|
||||
from vllm.v1.worker.workspace import current_workspace_manager
|
||||
|
||||
logger = init_logger(__name__)
|
||||
@@ -285,7 +288,35 @@ class DeepseekV4ROCMAiterSparseSWAMetadata(DeepseekSparseSWAMetadata):
|
||||
prefill_swa_ragged_indptr: torch.Tensor | None = None
|
||||
|
||||
|
||||
class DeepseekV41ROCMAiterMLASparseMetadataBuilder(DeepseekV4SparseMLAMetadataBuilder):
|
||||
@classmethod
|
||||
def get_cudagraph_support(
|
||||
cls,
|
||||
vllm_config: VllmConfig,
|
||||
kv_cache_spec: KVCacheSpec,
|
||||
) -> AttentionCGSupport:
|
||||
spec_config = vllm_config.speculative_config
|
||||
if spec_config is not None and spec_config.enable_adaptive_verification:
|
||||
# Per-token request ownership and compressed slot mappings are built
|
||||
# from device query boundaries into persistent buffers.
|
||||
return AttentionCGSupport.ALWAYS
|
||||
return super().get_cudagraph_support(vllm_config, kv_cache_spec)
|
||||
|
||||
|
||||
class DeepseekV4ROCMAiterSparseSWAMetadataBuilder(DeepseekV41SparseSWAMetadataBuilder):
|
||||
@classmethod
|
||||
def get_cudagraph_support(
|
||||
cls,
|
||||
vllm_config: VllmConfig,
|
||||
kv_cache_spec: KVCacheSpec,
|
||||
) -> AttentionCGSupport:
|
||||
spec_config = vllm_config.speculative_config
|
||||
if spec_config is not None and spec_config.enable_adaptive_verification:
|
||||
# SWA indices, lengths, and request ownership are built from device
|
||||
# query boundaries and copied into persistent ragged buffers.
|
||||
return AttentionCGSupport.ALWAYS
|
||||
return super().get_cudagraph_support(vllm_config, kv_cache_spec)
|
||||
|
||||
# Keep fused multi-step decode disabled until update_draft_decode_metadata()
|
||||
# also refreshes the ROCm-specific ragged SWA indices and indptrs.
|
||||
supports_draft_decode_metadata_update = False
|
||||
@@ -508,8 +539,8 @@ class DeepseekV4ROCMAiterMLASparseBackend(DeepseekV4SparseMLABackend):
|
||||
return [64, 128]
|
||||
|
||||
@staticmethod
|
||||
def get_builder_cls() -> type[DeepseekV4SparseMLAMetadataBuilder]:
|
||||
return DeepseekV4SparseMLAMetadataBuilder
|
||||
def get_builder_cls() -> type[DeepseekV41ROCMAiterMLASparseMetadataBuilder]:
|
||||
return DeepseekV41ROCMAiterMLASparseMetadataBuilder
|
||||
|
||||
|
||||
class DeepseekV41ROCMAiterSparseSWABackend(DeepseekSparseSWABackend):
|
||||
|
||||
Reference in New Issue
Block a user