[AMD] [GLM-5.3-Flash Day 0] Enable speculative decoding (MTP) on ROCm (#39778)

Co-authored-by: Thomas Wang <thomawan@amd.com>
Co-authored-by: Kevin Mi <45493463+kevin-mii@users.noreply.github.com>
This commit is contained in:
Jacob0226
2026-09-22 13:10:39 -07:00
committed by GitHub
co-authored by Thomas Wang Kevin Mi
parent d6cc283da7
commit 077c319914
2 changed files with 5 additions and 3 deletions
@@ -1333,7 +1333,7 @@ class IndexerKPool(MultiPlatformOp):
enable_dual_stream: bool,
return_indices: bool = True,
) -> Optional[torch.Tensor]:
assert is_cuda(), "DSA kpool target_verify is CUDA-only"
assert is_cuda() or is_hip(), "DSA kpool target_verify needs CUDA or ROCm"
plan = metadata.attn_metadata.kpool_write_plan
assert plan is not None, "DSA kpool target_verify requires kpool_write_plan"
num_draft_tokens = plan.num_draft_tokens
@@ -17,7 +17,7 @@ from sglang.srt.layers.attention.dsa.kpool_fp8_index import (
from sglang.srt.layers.attention.dsa.utils import dsa_use_prefill_cp
from sglang.srt.model_executor.forward_context import get_req_to_token_pool
from sglang.srt.runtime_context import get_parallel
from sglang.srt.utils import is_cuda
from sglang.srt.utils import is_cuda, is_hip
if TYPE_CHECKING:
from sglang.srt.layers.attention.dsa.dsa_topk_backend import TopkTransformMethod
@@ -737,7 +737,9 @@ def update_kpool_write_plan(
slots_per_page: int,
effective_n_per_batch: Optional[torch.Tensor] = None,
) -> None:
if not _is_kpool_layout_enabled(pool_size, real_page_size) or not is_cuda():
if not _is_kpool_layout_enabled(pool_size, real_page_size) or not (
is_cuda() or is_hip()
):
return
is_verify = forward_mode.is_target_verify()
is_decode = forward_mode.is_decode_or_idle()