[AMD] feat: add DLLM support for AMD GPUs with LLaDA2 testing (#15560)

This commit is contained in:
sunxxuns
2026-01-03 10:41:11 +08:00
committed by GitHub
parent 6256936d09
commit 8b869e326c
5 changed files with 144 additions and 4 deletions
@@ -53,7 +53,7 @@ from sglang.srt.layers.dp_attention import (
set_is_extend_in_batch,
)
from sglang.srt.server_args import get_global_server_args
from sglang.srt.utils import get_compiler_backend, is_npu, support_triton
from sglang.srt.utils import get_compiler_backend, is_hip, is_npu, support_triton
from sglang.srt.utils.common import ceil_align
if TYPE_CHECKING:
@@ -490,13 +490,15 @@ class ForwardBatch:
# Override the positions with diffusion LLM or spec_info
if batch.dllm_config is not None:
block_size = batch.dllm_config.block_size
# Use int64 for AMD rotary embedding kernel compatibility
positions_dtype = torch.int64 if is_hip() else torch.int32
ret.positions = torch.tensor(
[
i
for block_offset in batch.dllm_block_offsets
for i in range(block_offset, block_offset + block_size)
],
dtype=torch.int32,
dtype=positions_dtype,
).to(device, non_blocking=True)
elif (
ret.spec_info is not None