{"record":{"id":"45c3764496d7fdb6","repo":"sgl-project/sglang","slug":"dsa-indexer-only-supports-cuda-hip-and-npu","errorCode":null,"errorMessage":"DSA indexer only supports CUDA, HIP, and NPU","messagePattern":"DSA indexer only supports CUDA, HIP, and NPU","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/layers/attention/dsa/dsa_indexer.py","lineNumber":1899,"sourceCode":"                    return maybe_capture_indexer_topk(layer_id, topk_result)\n                else:\n                    # In-graph (PCG/BCG) non-CP prefill is handled earlier by the\n                    # graph DSA split-op dispatch, so only the eager path reaches\n                    # here.\n                    assert not in_piecewise_or_breakable_cuda_graph, (\n                        \"Internal error: in-graph DSA prefill must go through the \"\n                        \"graph DSA split-op dispatch\"\n                    )\n                    topk_result = self._get_topk_ragged(\n                        enable_dual_stream,\n                        forward_batch,\n                        layer_id,\n                        q_fp8,\n                        weights,\n                        metadata,\n                    )\n        else:\n            raise NotImplementedError(\"DSA indexer only supports CUDA, HIP, and NPU\")\n        topk_result = _broadcast_indexer_topk_from_rank0(topk_result)\n        return maybe_capture_indexer_topk(layer_id, topk_result)\n","sourceCodeStart":1881,"sourceCodeEnd":1902,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/attention/dsa/dsa_indexer.py#L1881-L1902","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run DSA models on CUDA, ROCm (HIP), or Ascend NPU devices","For XPU/other accelerators, use a non-DSA model variant (e.g. DeepSeek without the sparse indexer) until a backend is added","Contribute/await an indexer kernel implementation for your device"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import torch\ndev = torch.get_device_type(x.device) if hasattr(torch, \"get_device_type\") else x.device.type\nif dev not in {\"cuda\", \"hip\", \"npu\"}:\n    raise SystemExit(\"DSA models need CUDA/HIP/NPU; pick a non-DSA checkpoint\")","typeGuard":"def dsa_device_supported(device) -> bool:\n    return device.type in {\"cuda\", \"hip\", \"npu\"}","tryCatchPattern":null,"preventionTips":["Screen model choice against device support before porting to new accelerators","Remember forward_xpu aliasing forward_cuda does not imply XPU DSA support"],"tags":["dsa","device-support","xpu","not-implemented","deepseek","sglang"],"backgroundTag":"platform-not-supported","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}