sgl-project/sglang · error · ValueError

--enable-hisparse is not supported with the unified-KV path

Error message

--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.

What it means

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.

Source

Thrown at python/sglang/srt/arg_groups/hisparse_hook.py:117

    )

    assert (
        cfg.disable_radix_cache
    ), "Hierarchical sparse attention currently requires --disable-radix-cache."

    # DSv4 hisparse handles its own dtype/backend pairing elsewhere; the dtype-
    # aware checks below only apply to the DSA hisparse path.
    if is_hip and is_v4_hisparse:
        # TEMPORARY GUARD: DSv4 HiSparse is not supported on the unified-KV path.
        # In unified-KV mode c4_kv_pool is None, so DeepSeekV4HiSparseTokenToKVPoolAllocator
        # cannot attach and pool init dies with a cryptic AssertionError. Fail fast
        # at startup with a clear message instead. Remove once unified-KV HiSparse lands.
        from sglang.kernels.ops.attention.dsv4.unified_kv_kernels.env_gate import (
            is_unified_kv_triton,
        )

        if is_unified_kv_triton():
            raise ValueError(
                "--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."
            )
        return

    from sglang.srt.arg_groups.overrides import resolved_view

    if resolved_view(server_args).kv_cache_dtype not in (
        "bfloat16",
        "auto",
        "fp8_e4m3",
    ):
        validate_hisparse_kv_cache_dtype(server_args)

    for attr, label in [

View on GitHub (pinned to 0132848349)

Solutions

  1. Set SGLANG_HACK_FLASHMLA_BACKEND=triton instead
  2. Or unset SGLANG_HACK_FLASHMLA_BACKEND entirely if the default path works
  3. Or drop --enable-hisparse

Example fix

# before
export SGLANG_HACK_FLASHMLA_BACKEND=unified_kv_triton
--enable-hisparse
# after
export SGLANG_HACK_FLASHMLA_BACKEND=triton
--enable-hisparse
Defensive patterns

Strategy: validation

Validate before calling

import os
if enable_hisparse and os.environ.get('SGLANG_HACK_FLASHMLA_BACKEND') == 'unified_kv_triton':
    os.environ['SGLANG_HACK_FLASHMLA_BACKEND'] = 'triton'

Prevention

When it happens

Trigger: 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().

Common situations: A cluster-level env profile sets the unified_kv_triton hack; adding HiSparse flags on top without unsetting the env var.

Related errors


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