sgl-project/sglang · critical · NotImplementedError

DSA indexer only supports CUDA, HIP, and NPU

Error message

DSA indexer only supports CUDA, HIP, and NPU

What it means

The DSA indexer forward_cuda dispatches on device type (CUDA kernels, HIP via ROCm, NPU via Ascend). Reaching the final else branch means the tensor's device is none of those — e.g. XPU or an unrecognized accelerator — so the indexer has no implementation and raises NotImplementedError.

Source

Thrown at python/sglang/srt/layers/attention/dsa/dsa_indexer.py:1899

                    return maybe_capture_indexer_topk(layer_id, topk_result)
                else:
                    # In-graph (PCG/BCG) non-CP prefill is handled earlier by the
                    # graph DSA split-op dispatch, so only the eager path reaches
                    # here.
                    assert not in_piecewise_or_breakable_cuda_graph, (
                        "Internal error: in-graph DSA prefill must go through the "
                        "graph DSA split-op dispatch"
                    )
                    topk_result = self._get_topk_ragged(
                        enable_dual_stream,
                        forward_batch,
                        layer_id,
                        q_fp8,
                        weights,
                        metadata,
                    )
        else:
            raise NotImplementedError("DSA indexer only supports CUDA, HIP, and NPU")
        topk_result = _broadcast_indexer_topk_from_rank0(topk_result)
        return maybe_capture_indexer_topk(layer_id, topk_result)

View on GitHub (pinned to 0132848349)

Solutions

  1. Run DSA models on CUDA, ROCm (HIP), or Ascend NPU devices
  2. For XPU/other accelerators, use a non-DSA model variant (e.g. DeepSeek without the sparse indexer) until a backend is added
  3. Contribute/await an indexer kernel implementation for your device
Defensive patterns

Strategy: validation

Validate before calling

import torch
dev = torch.get_device_type(x.device) if hasattr(torch, "get_device_type") else x.device.type
if dev not in {"cuda", "hip", "npu"}:
    raise SystemExit("DSA models need CUDA/HIP/NPU; pick a non-DSA checkpoint")

Type guard

def dsa_device_supported(device) -> bool:
    return device.type in {"cuda", "hip", "npu"}

Prevention

When it happens

Trigger: DSAIndexer.forward (forward_cuda, also aliased by forward_xpu) invoked with input/device on a device type other than cuda/hip/npu — commonly Intel XPU GPUs or other experimental backends attempting to serve DeepSeek sparse-attention models.

Common situations: Porting SGLang to Intel GPU (XPU) or a new accelerator and loading a DSA model; forward_xpu aliasing forward_cuda making XPU look 'supported' until this check fires.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/45c3764496d7fdb6. Report an issue: GitHub.