sgl-project/sglang · warning
Triton is not supported on current platform, roll back to CP
Error message
Triton is not supported on current platform, roll back to CPU.
What it means
Warning from the FLA (flash-linear-attention) Triton utility layer: no CUDA/GPU device is visible to Triton on this platform, so device-query helpers (multiprocessor count, available device, max shared memory) fall back to CPU values. It signals GPU-less execution of kernels that normally require Triton on CUDA.
Source
Thrown at python/sglang/kernels/ops/attention/fla/utils.py:223
},
)
return wrapper
return decorator
def checkpoint(fn):
def wrapper(*args, **kwargs):
return torch.utils.checkpoint.checkpoint(fn, *args, **kwargs)
return wrapper
def _cpu_device_warning():
import warnings
warnings.warn(
("Triton is not supported on current platform, roll back to CPU."), stacklevel=1
)
@lru_cache(maxsize=None)
def get_multiprocessor_count(tensor_idx: int = 0) -> int:
try:
return triton.runtime.driver.active.utils.get_device_properties(tensor_idx)[
"multiprocessor_count"
]
except BaseException:
_cpu_device_warning()
return -1
@lru_cache(maxsize=None)
def get_available_device() -> str:
try:View on GitHub (pinned to 0132848349)
Solutions
- Ensure a CUDA GPU is available and visible (nvidia-smi works, CUDA_VISIBLE_DEVICES not emptied)
- Install a CUDA-enabled PyTorch/Triton build (e.g. reinstall torch with cu121+ wheels)
- If CPU execution is intended, accept the warning — kernels fall back but performance/features are limited
- In CI, gate GPU-dependent tests with a torch.cuda.is_available() skip
Example fix
# before CUDA_VISIBLE_DEVICES= python -m pytest tests/ # no GPU visible # after python -m pytest tests/ # GPU visible; or skip: pytest.mark.skipif(not torch.cuda.is_available(), reason="needs GPU")
Defensive patterns
Strategy: type-guard
Validate before calling
import torch
if not torch.cuda.is_available() or torch.cuda.device_count() == 0:
pytest.skip("FLA Triton kernels need a visible CUDA GPU") Type guard
def has_triton_gpu() -> bool:
import torch
return torch.cuda.is_available() and torch.cuda.device_count() > 0 Prevention
- Check torch.cuda.is_available() before launching GPU kernels in portable code
- Don't set CUDA_VISIBLE_DEVICES='' globally in dev shells
- Install CUDA-enabled torch/triton wheels in containers that run these kernels
When it happens
Trigger: Calling get_multiprocessor_count / get_available_device / get_all_max_shared_mem (directly or via FLA/gated-delta-net kernels) on a machine with no GPU, with CUDA hidden (CUDA_VISIBLE_DEVICES=''), or on a platform where Triton lacks GPU support (some ROCm/Windows/CPU-only builds).
Common situations: Running unit tests or imports on CPU-only CI boxes, setting CUDA_VISIBLE_DEVICES empty by mistake, using a PyTorch build without CUDA inside containers, or running linear-attention models on unsupported platforms.
Related errors
- This layer norm doesn't support feature dim >= 64KB.
- SANA-WM Triton GDN backend unavailable: {reason}
- {self._op_label()}: no triton backend
- Cannot find NVIDIA Math-DX (cuBLASDx) headers. Install the `
- sparse_attn_v4_paged_decode expects fp16/bf16 q, got {q.dtyp
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/725607771563a6e2.
Report an issue: GitHub.