{"record":{"id":"00402a55dc15f141","repo":"sgl-project/sglang","slug":"enable-hisparse-is-not-supported-with-the-unifie","errorCode":null,"errorMessage":"--enable-hisparse is not supported with the unified-KV path on ROCm(SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton) for DeepSeek-V4: HiSparse currently requires the separate packed KV layout. Either set SGLANG_HACK_FLASHMLA_BACKEND=triton, or run without --enable-hisparse.","messagePattern":"--enable-hisparse is not supported with the unified-KV path on ROCm\\(SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton\\) for DeepSeek-V4: HiSparse currently requires the separate packed KV layout\\. Either set SGLANG_HACK_FLASHMLA_BACKEND=triton, or run without --enable-hisparse\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/hisparse_hook.py","lineNumber":117,"sourceCode":"    )\n\n    assert (\n        cfg.disable_radix_cache\n    ), \"Hierarchical sparse attention currently requires --disable-radix-cache.\"\n\n    # DSv4 hisparse handles its own dtype/backend pairing elsewhere; the dtype-\n    # aware checks below only apply to the DSA hisparse path.\n    if is_hip and is_v4_hisparse:\n        # TEMPORARY GUARD: DSv4 HiSparse is not supported on the unified-KV path.\n        # In unified-KV mode c4_kv_pool is None, so DeepSeekV4HiSparseTokenToKVPoolAllocator\n        # cannot attach and pool init dies with a cryptic AssertionError. Fail fast\n        # at startup with a clear message instead. Remove once unified-KV HiSparse lands.\n        from sglang.kernels.ops.attention.dsv4.unified_kv_kernels.env_gate import (\n            is_unified_kv_triton,\n        )\n\n        if is_unified_kv_triton():\n            raise ValueError(\n                \"--enable-hisparse is not supported with the unified-KV path on ROCm\"\n                \"(SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton) for DeepSeek-V4: \"\n                \"HiSparse currently requires the separate packed KV layout. \"\n                \"Either set SGLANG_HACK_FLASHMLA_BACKEND=triton, or run without \"\n                \"--enable-hisparse.\"\n            )\n        return\n\n    from sglang.srt.arg_groups.overrides import resolved_view\n\n    if resolved_view(server_args).kv_cache_dtype not in (\n        \"bfloat16\",\n        \"auto\",\n        \"fp8_e4m3\",\n    ):\n        validate_hisparse_kv_cache_dtype(server_args)\n\n    for attr, label in [","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/hisparse_hook.py#L99-L135","documentation":"The unified-KV Triton FlashMLA path (SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton, ROCm) uses a fused KV layout that HiSparse's separate packed KV layout does not support yet. Enabling --enable-hisparse together with that env var is rejected at startup.","triggerScenarios":"Setting SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton in the environment while also passing --enable-hisparse for DeepSeek-V4 on ROCm; validate_hisparse detects is_unified_kv_triton().","commonSituations":"A cluster-level env profile sets the unified_kv_triton hack; adding HiSparse flags on top without unsetting the env var.","solutions":["Set SGLANG_HACK_FLASHMLA_BACKEND=triton instead","Or unset SGLANG_HACK_FLASHMLA_BACKEND entirely if the default path works","Or drop --enable-hisparse"],"exampleFix":"# before\nexport SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton\n--enable-hisparse\n# after\nexport SGLANG_HACK_FLASHMLA_BACKEND=triton\n--enable-hisparse","handlingStrategy":"validation","validationCode":"import os\nif enable_hisparse and os.environ.get('SGLANG_HACK_FLASHMLA_BACKEND') == 'unified_kv_triton':\n    os.environ['SGLANG_HACK_FLASHMLA_BACKEND'] = 'triton'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit SGLANG_* env vars before enabling new features","Don't export hack env vars globally in Docker images"],"tags":["hisparse","rocm","flashmla","env-var","sglang"],"backgroundTag":"env-var-conflict","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}