[AMD][DSV4] DSV4 MTP graph + sparse triton attn optimizations (#26383)

Co-authored-by: wunhuang <wunhuang@amd.com>
Co-authored-by: Thomas Wang <1am9trash@gmail.com>
Co-authored-by: Xinyi Song <86638975+RolaoDenthu@users.noreply.github.com>
Co-authored-by: HaiShaw <hixiao@gmail.com>
Co-authored-by: amd-danli103 <danli103@amd.com>
Co-authored-by: Lin, Soga <soga.lin@amd.com>
Co-authored-by: Raiden-Makoto <Raiden-Makoto@users.noreply.github.com>
Co-authored-by: Hubert Lu <55214931+hubertlu-tw@users.noreply.github.com>
Co-authored-by: yichiche@amd.com <jacky.cheng>
Co-authored-by: yctseng0211 <yctseng@amd.com>
Co-authored-by: Bingxu Chen <bingxche@amd.com>
This commit is contained in:
kk
2026-05-27 15:23:35 -07:00
committed by GitHub
co-authored by wunhuang Thomas Wang Xinyi Song HaiShaw amd-danli103 Lin, Soga Raiden-Makoto Hubert Lu yichiche@amd.com yctseng0211 Bingxu Chen
parent e06058ed62
commit deaba74745
10 changed files with 659 additions and 65 deletions
+11 -2
View File
@@ -19,6 +19,7 @@ from sglang.srt.server_args import get_global_server_args
from sglang.srt.utils.common import (
get_bool_env_var,
is_cuda,
is_hip,
is_musa,
is_npu,
)
@@ -41,6 +42,9 @@ if is_musa():
top_p_renorm_prob,
)
_use_aiter = get_bool_env_var("SGLANG_USE_AITER") and is_hip()
if _use_aiter:
from aiter import greedy_sample as _aiter_greedy_sample
if is_npu():
import torch_npu
@@ -106,8 +110,13 @@ class Sampler(nn.Module):
logits = self._preprocess_logits(logits, sampling_info)
if sampling_info.is_all_greedy:
# Use torch.argmax if all requests use greedy sampling
batch_next_token_ids = torch.argmax(logits, -1)
if _use_aiter:
batch_next_token_ids = torch.empty(
logits.shape[0], device=logits.device, dtype=torch.int32
)
_aiter_greedy_sample(batch_next_token_ids, logits)
else:
batch_next_token_ids = torch.argmax(logits, -1)
if return_logprob:
original_logprobs = logprobs = torch.nn.functional.log_softmax(
logits, dim=-1