From 50ed01674ea1b80eb9e2a224c7b889652adda5a9 Mon Sep 17 00:00:00 2001 From: Polisetty V R K Jyothendra Varma Date: Sat, 9 May 2026 07:09:34 +0530 Subject: [PATCH] fix is_arch_support_pdl function usage (#24600) Signed-off-by: P V R K Jyothendra Varma Co-authored-by: Ma Mingfei --- python/sglang/srt/layers/attention/triton_backend.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/layers/attention/triton_backend.py b/python/sglang/srt/layers/attention/triton_backend.py index 9747787c1..d80a87ead 100644 --- a/python/sglang/srt/layers/attention/triton_backend.py +++ b/python/sglang/srt/layers/attention/triton_backend.py @@ -6,7 +6,6 @@ from typing import TYPE_CHECKING, List, Optional import torch import triton import triton.language as tl -from sgl_kernel.utils import is_arch_support_pdl from sglang.srt.configs.model_config import AttentionArch from sglang.srt.layers.attention.base_attn_backend import AttentionBackend @@ -20,9 +19,15 @@ from sglang.srt.utils import ( get_bool_env_var, get_device_core_count, get_int_env_var, + is_cuda, next_power_of_2, ) +_is_cuda = is_cuda() + +if _is_cuda: + from sgl_kernel.utils import is_arch_support_pdl + if TYPE_CHECKING: from sglang.srt.layers.radix_attention import RadixAttention from sglang.srt.model_executor.model_runner import ModelRunner @@ -148,7 +153,10 @@ class TritonAttnBackend(AttentionBackend): self.device_core_count, self.max_context_len, ) - self.use_pdl = is_arch_support_pdl() + if _is_cuda: + self.use_pdl = is_arch_support_pdl() + else: + self.use_pdl = False self.allow_bidirectional_attention_in_extend = ( model_runner.server_args.disable_cuda_graph