{"record":{"id":"9f1baff605190975","repo":"sgl-project/sglang","slug":"hisparse-supports-dsa-label-backend-s-sorted-a","errorCode":null,"errorMessage":"HiSparse supports DSA {label} backend(s) {sorted(allowed_backends)} on this platform with --kv-cache-dtype={kv_cache_dtype}, but got --dsa-{label}-backend={backend}. Please use one of {sorted(allowed_backends)}, or omit the option to let SGLang pick a backend for this platform.","messagePattern":"HiSparse supports DSA (.+?) backend\\(s\\) (.+?) on this platform with --kv-cache-dtype=(.+?), but got --dsa-(.+?)-backend=(.+?)\\. Please use one of (.+?), or omit the option to let SGLang pick a backend for this platform\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/hisparse_hook.py","lineNumber":57,"sourceCode":"\n\n# The hisparse DSA backend defaults moved to the resolution pipeline\n# (arg_groups/overrides.py: _dsa_split_backend_resolution, hisparse arm).\n\n\ndef validate_hisparse_dsa_backend(\n    server_args: ServerArgs, attr: str, label: str\n) -> None:\n    from sglang.srt.arg_groups.overrides import resolved_view\n\n    # Invoked after the DSA kv-cache-dtype / split-backend declarations:\n    # read the resolving state through the view.\n    view = resolved_view(server_args)\n    backend = getattr(view, attr)\n    kv_cache_dtype = view.kv_cache_dtype\n    allowed_backends = _hisparse_allowed_backends(kv_cache_dtype)\n    if backend is not None and backend not in allowed_backends:\n        raise ValueError(\n            f\"HiSparse supports DSA {label} backend(s) {sorted(allowed_backends)} \"\n            f\"on this platform with --kv-cache-dtype={kv_cache_dtype}, \"\n            f\"but got --dsa-{label}-backend={backend}. \"\n            f\"Please use one of {sorted(allowed_backends)}, or omit the option \"\n            \"to let SGLang pick a backend for this platform.\"\n        )\n\n\ndef validate_hisparse_kv_cache_dtype(server_args: ServerArgs) -> None:\n    from sglang.srt.arg_groups.overrides import resolved_view\n\n    kv_cache_dtype = resolved_view(server_args).kv_cache_dtype\n    if kv_cache_dtype in HISPARSE_KV_CACHE_DTYPES:\n        return\n\n    choices = \" or \".join(\n        f\"--kv-cache-dtype={dtype}\" for dtype in HISPARSE_KV_CACHE_DTYPES\n    )","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/hisparse_hook.py#L39-L75","documentation":"For HiSparse DSA (DeepSeek sparse attention) prefill/decode backends, the set of allowed backends depends on the platform and the --kv-cache-dtype value. If you explicitly pass --dsa-prefill-backend or --dsa-decode-backend with a value not in the allowed set, SGLang raises this error instead of silently falling back.","triggerScenarios":"Passing --dsa-prefill-backend=<b> or --dsa-decode-backend=<b> where <b> is not returned by _hisparse_allowed_backends(kv_cache_dtype) for the current platform, e.g. selecting a bf16-only kernel while kv_cache_dtype=fp8_e4m3.","commonSituations":"Copying dsa backend flags from a different GPU generation or dtype recipe; upgrading SGLang changed the allowed backend matrix; mixing fp8 KV cache with a kernel that only supports bf16.","solutions":["Omit --dsa-prefill-backend/--dsa-decode-backend and let SGLang auto-pick for the platform","Set the backend to one of the values listed in sorted(allowed_backends) in the message","Change --kv-cache-dtype so the desired backend becomes allowed"],"exampleFix":"# before\n--kv-cache-dtype fp8_e4m3 --dsa-decode-backend tilelang\n# after\n--kv-cache-dtype fp8_e4m3 --dsa-decode-backend flashmla_kv","handlingStrategy":"validation","validationCode":"from sglang.srt.arg_groups.hisparse_hook import _hisparse_allowed_backends\nallowed = _hisparse_allowed_backends(view.kv_cache_dtype)\nif backend is not None and backend not in allowed:\n    backend = None  # let SGLang auto-pick","typeGuard":null,"tryCatchPattern":"except ValueError as e:\n    if 'dsa-' in str(e) and 'backend' in str(e): drop_dsa_backend_flags(); retry()\n    raise","preventionTips":["Omit --dsa-*-backend flags unless you know the platform matrix","Re-validate DSA flags after changing --kv-cache-dtype"],"tags":["hisparse","dsa","attention-backend","kv-cache-dtype","sglang"],"backgroundTag":"unsupported-backend-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}