From f65b2b2b157930e34c99dc659dd12aa8759455b2 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Fri, 28 Aug 2026 14:16:53 -0700 Subject: [PATCH] [Fix] Lazy-import aiter in DSv4 paged_decode to unbreak CPU CI (#36914) --- .../ops/attention/dsv4/unified_kv_kernels/paged_decode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/sglang/kernels/ops/attention/dsv4/unified_kv_kernels/paged_decode.py b/python/sglang/kernels/ops/attention/dsv4/unified_kv_kernels/paged_decode.py index 8774d75f4..376c60209 100644 --- a/python/sglang/kernels/ops/attention/dsv4/unified_kv_kernels/paged_decode.py +++ b/python/sglang/kernels/ops/attention/dsv4/unified_kv_kernels/paged_decode.py @@ -56,7 +56,6 @@ import functools import torch import triton import triton.language as tl -from aiter.ops.triton.utils.device_info import get_num_sms from sglang.kernels.ops.quantization.fp8_kernel import is_fp8_fnuz from sglang.srt.utils import is_hip @@ -94,7 +93,12 @@ def _cu_count() -> int: Wrapped in ``lru_cache`` so the first decode call pays the device-property lookup and all subsequent calls hit the cache — important inside a hot decode loop and CUDAGraph capture (no data-dependent host work). + + ``aiter`` is imported lazily: it is a ROCm-only package, and the pure-Python + heuristics below must stay importable on a machine without it. """ + from aiter.ops.triton.utils.device_info import get_num_sms + return get_num_sms()