[ROCm][DSv4] Enable DSpark adaptive verification (#52362)

Signed-off-by: Tuukka Sarvi <tuukka.sarvi@amd.com>
Signed-off-by: larryli2-amd <larryli2@amd.com>
Co-authored-by: larryli2-amd <larryli2@amd.com>
This commit is contained in:
Tuukka Sarvi
2026-09-21 10:03:41 -05:00
committed by GitHub
co-authored by larryli2-amd
parent 21aa17c128
commit e34685dfc0
6 changed files with 725 additions and 7 deletions
+28 -1
View File
@@ -237,6 +237,15 @@ class KpoolTailBackend(DeepseekV32IndexerBackend):
class DeepseekV4IndexerBackend(DeepseekV32IndexerBackend):
@classmethod
def supports_device_cpu_query_lens_mismatch(cls) -> bool:
# ROCm runs adaptive verification through the per-token flattened
# indexer path, which derives row ownership from device decode lengths.
return (
current_platform.is_rocm()
or super().supports_device_cpu_query_lens_mismatch()
)
@staticmethod
def get_name() -> str:
return "DEEPSEEK_V4_INDEXER"
@@ -254,6 +263,12 @@ class DeepseekV4IndexerBackend(DeepseekV32IndexerBackend):
class DeepseekV41IndexerBackend(DeepseekV4IndexerBackend):
@classmethod
def supports_device_cpu_query_lens_mismatch(cls) -> bool:
# The ROCm flattened-query support above is validated for the
# DeepSeek-V4 adaptive DSpark path only.
return DeepseekV32IndexerBackend.supports_device_cpu_query_lens_mismatch()
@staticmethod
def get_name() -> str:
return "DEEPSEEK_V41_INDEXER"
@@ -802,6 +817,15 @@ def _supports_flattened_device_query_lens() -> bool:
)
def _rocm_supports_flattened_device_query_lens(vllm_config: VllmConfig) -> bool:
model_config = vllm_config.model_config
return (
current_platform.is_rocm()
and model_config is not None
and "DeepseekV4ForCausalLM" in model_config.architectures
)
def _supports_native_decode(next_n: int) -> bool:
"""Whether decode can pass `next_n` Q rows per request to the kernel
instead of flattening to one single-token row per query, which re-reads
@@ -822,7 +846,10 @@ def _use_flattening(vllm_config: VllmConfig) -> bool:
return not _supports_native_decode(next_n) or (
speculative_config is not None
and speculative_config.enable_adaptive_verification
and _supports_flattened_device_query_lens()
and (
_supports_flattened_device_query_lens()
or _rocm_supports_flattened_device_query_lens(vllm_config)
)
)