[Bugfix] Guard merge_state sgl_kernel import on non-CUDA platforms (#42682)

This commit is contained in:
Rumit Desai
2026-10-06 14:19:20 +08:00
committed by GitHub
parent 40fb5935c0
commit 33ce0943e9
@@ -1,13 +1,15 @@
from typing import Optional, Tuple
import torch
from sgl_kernel import merge_state_v2
from sglang.kernels.ops.attention.merge_state import merge_state_triton
from sglang.srt.utils import is_cuda
_is_cuda = is_cuda()
if _is_cuda:
from sgl_kernel import merge_state_v2
# Automatically fallback to the Triton kernel in some cases
# (e.g., for AMD GPUs, when the head dimension is not a multiple