{"record":{"id":"725607771563a6e2","repo":"sgl-project/sglang","slug":"triton-is-not-supported-on-current-platform-roll","errorCode":null,"errorMessage":"Triton is not supported on current platform, roll back to CPU.","messagePattern":"Triton is not supported on current platform, roll back to CPU\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"python/sglang/kernels/ops/attention/fla/utils.py","lineNumber":223,"sourceCode":"                },\n            )\n\n        return wrapper\n\n    return decorator\n\n\ndef checkpoint(fn):\n    def wrapper(*args, **kwargs):\n        return torch.utils.checkpoint.checkpoint(fn, *args, **kwargs)\n\n    return wrapper\n\n\ndef _cpu_device_warning():\n    import warnings\n\n    warnings.warn(\n        (\"Triton is not supported on current platform, roll back to CPU.\"), stacklevel=1\n    )\n\n\n@lru_cache(maxsize=None)\ndef get_multiprocessor_count(tensor_idx: int = 0) -> int:\n    try:\n        return triton.runtime.driver.active.utils.get_device_properties(tensor_idx)[\n            \"multiprocessor_count\"\n        ]\n    except BaseException:\n        _cpu_device_warning()\n        return -1\n\n\n@lru_cache(maxsize=None)\ndef get_available_device() -> str:\n    try:","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/attention/fla/utils.py#L205-L241","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nCUDA_VISIBLE_DEVICES= python -m pytest tests/  # no GPU visible\n# after\npython -m pytest tests/  # GPU visible; or skip:\npytest.mark.skipif(not torch.cuda.is_available(), reason=\"needs GPU\")","handlingStrategy":"type-guard","validationCode":"import torch\nif not torch.cuda.is_available() or torch.cuda.device_count() == 0:\n    pytest.skip(\"FLA Triton kernels need a visible CUDA GPU\")","typeGuard":"def has_triton_gpu() -> bool:\n    import torch\n    return torch.cuda.is_available() and torch.cuda.device_count() > 0","tryCatchPattern":null,"preventionTips":["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"],"tags":["triton","cuda","device-detection","cpu-fallback","fla"],"backgroundTag":"no-gpu-device-available","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}