{"record":{"id":"716f03d38cebfdda","repo":"sgl-project/sglang","slug":"dspark-speculative-decoding-only-supports-cuda-or","errorCode":null,"errorMessage":"DSpark speculative decoding only supports CUDA or NPU device.","messagePattern":"DSpark speculative decoding only supports CUDA or NPU device\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/speculative_hook.py","lineNumber":351,"sourceCode":"        )\n        logger.warning(\n            \"Mixed chunked prefill is disabled because of using dflash speculative decoding.\"\n        )\n\n\ndef _target_checkpoint_bundles_dspark_draft(server_args: ServerArgs) -> bool:\n    from sglang.srt.speculative.dspark_components.dspark_config import (\n        checkpoint_bundles_dspark_draft,\n    )\n\n    return checkpoint_bundles_dspark_draft(server_args.get_model_config().hf_config)\n\n\ndef _handle_dspark(server_args: ServerArgs) -> None:\n    cfg = resolving_view(server_args)\n    _is_npu = cfg.device.startswith(\"npu\")\n    if not cfg.device.startswith((\"cuda\", \"npu\")):\n        raise ValueError(\n            \"DSpark speculative decoding only supports CUDA or NPU device.\"\n        )\n\n    # dp_size==1 with dp_attention is a degenerate flag under DSV4 CP; skip DP-only checks.\n    if cfg.enable_dp_attention and cfg.dp_size > 1:\n        if not cfg.enable_dp_lm_head:\n            raise ValueError(\"DSpark with dp attention requires --enable-dp-lm-head.\")\n        if not _is_npu and cfg.moe_a2a_backend not in (\"none\", \"megamoe\"):\n            raise ValueError(\n                \"DSpark with dp attention supports moe_a2a_backend 'none' \"\n                \"(built-in TP MoE) or 'megamoe', got \"\n                f\"{cfg.moe_a2a_backend!r}.\"\n            )\n        if not _is_npu and cfg.moe_a2a_backend != \"none\":\n            from sglang.srt.speculative.ragged_verify import (\n                RaggedVerifyMode,\n                read_ragged_verify_mode,\n            )","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/speculative_hook.py#L333-L369","documentation":"DSpark speculative decoding is implemented only for CUDA and NPU accelerators. The hook checks cfg.device and rejects anything else (e.g. ROCm/HIP reported as 'rocm', xpu, cpu) at server-args time.","triggerScenarios":"Launching with speculative_algorithm=DSPARK on a device string that does not start with 'cuda' or 'npu' (e.g. AMD GPUs where device resolves to 'rocm.hip').","commonSituations":"Running on AMD/ROCm clusters and reusing DSpark launch configs from NVIDIA machines; CPU-only smoke tests with spec decoding enabled.","solutions":["Run DSpark only on CUDA or NPU hardware","Switch to a speculative algorithm supported on your device","Check SGLANG_DEVICE / device override env vars are not forcing an unsupported device string"],"exampleFix":"# before (on ROCm)\n--speculative-algorithm DSPARK\n# after\n--speculative-algorithm EAGLE  # or run on a CUDA/NPU host","handlingStrategy":"validation","validationCode":"if not (args.device.startswith('cuda') or args.device.startswith('npu')):\n    raise SystemExit(f'DSPARK unsupported on device {args.device}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate speculative-algorithm selection on the detected device in cluster launchers"],"tags":["speculative-decoding","dspark","device-support","cuda","npu"],"backgroundTag":"unsupported-device","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}