[AMD] feat: add DLLM support for AMD GPUs with LLaDA2 testing (#15560)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -2425,7 +2425,19 @@ class ServerArgs:
|
||||
def _handle_dllm_inference(self):
|
||||
if self.dllm_algorithm is None:
|
||||
return
|
||||
if not self.disable_cuda_graph:
|
||||
# On AMD/HIP, disable cuda graph for DLLM and use triton backend
|
||||
if is_hip():
|
||||
if not self.disable_cuda_graph:
|
||||
logger.warning(
|
||||
"Cuda graph is disabled for diffusion LLM inference on AMD GPUs"
|
||||
)
|
||||
self.disable_cuda_graph = True
|
||||
if self.attention_backend not in ["triton", "aiter"]:
|
||||
logger.warning(
|
||||
"Attention backend is set to triton for diffusion LLM inference on AMD GPUs"
|
||||
)
|
||||
self.attention_backend = "triton"
|
||||
elif not self.disable_cuda_graph:
|
||||
if self.cuda_graph_bs != [1]:
|
||||
logger.warning(
|
||||
"Cuda graph bs is set to [1] because of using diffusion LLM inference"
|
||||
|
||||
Reference in New Issue
Block a user