sgl-project/sglang · error · NotImplementedError

Ascend PD transfer does not support HiSparse destination dev

Error message

Ascend PD transfer does not support HiSparse destination device KV indices

What it means

The Ascend (NPU) prefill-decode transfer connection's send_kvcache does not implement transferring into pre-assigned destination device KV indices, which is the HiSparse/HiCache path where the decode side dictates exact slot positions. Passing dst_device_kv_indices raises NotImplementedError.

Source

Thrown at python/sglang/srt/disaggregation/ascend/conn.py:136

                    dst_kv_ptrs[layer_offset + start_layer : layer_offset + end_layer]
                )
        layers_current_pp_stage = len(src_kv_ptrs)
        return src_kv_ptrs, sliced_dst_kv_ptrs, layers_current_pp_stage

    def send_kvcache(
        self,
        mooncake_session_id: str,
        prefill_kv_indices: npt.NDArray[np.int32],
        dst_kv_ptrs: list[int],
        dst_kv_indices: npt.NDArray[np.int32],
        executor: concurrent.futures.ThreadPoolExecutor,
        dst_layer_ids: Optional[List[int]] = None,
        dst_device_kv_indices: Optional[npt.NDArray[np.int32]] = None,
        dst_kv_item_len: Optional[int] = None,
        dst_attn_tp_size: Optional[int] = None,
    ):
        if dst_device_kv_indices is not None:
            raise NotImplementedError(
                "Ascend PD transfer does not support HiSparse "
                "destination device KV indices"
            )
        self._validate_envelope_kv_layout(
            dst_kv_ptrs, dst_kv_item_len, dst_attn_tp_size
        )
        # Group by indices
        prefill_kv_blocks, dst_kv_blocks = group_concurrent_contiguous(
            prefill_kv_indices, dst_kv_indices
        )

        if self.pp_size > 1:
            if self.is_mla_backend:
                src_kv_ptrs, sliced_dst_kv_ptrs, layers_current_pp_stage = (
                    self.get_mla_kv_ptrs_with_pp(self.kv_args.kv_data_ptrs, dst_kv_ptrs)
                )
                layers_params = [
                    (

View on GitHub (pinned to 0132848349)

Solutions

  1. Disable the hierarchical cache (HiSparse) on the decode side for Ascend PD runs so dst_device_kv_indices is not required
  2. Wait for or implement Ascend support for destination device KV indices in disaggregation/ascend/conn.py
  3. Fall back to a non-HiCache KV layout that the Ascend transfer engine supports
Defensive patterns

Strategy: validation

Validate before calling

if conn.__class__.__name__ == 'AscendKVReceiver' or getattr(conn, 'is_ascend', False):\n    assert dst_device_kv_indices is None, 'Ascend PD transfer cannot target device KV indices'

Type guard

def supports_hisparse_dst(conn) -> bool:\n    return not getattr(conn, '_ascend_backend', False)

Try / catch

try:\n    conn.send_kvcache(..., dst_device_kv_indices=idx)\nexcept NotImplementedError:\n    # fall back to non-HiSparse destination layout on Ascend

Prevention

When it happens

Trigger: Calling send_kvcache(..., dst_device_kv_indices=<non-None ndarray>) on the Ascend PD connection — i.e. running prefill-decode disaggregation with a hierarchical-cache (HiSparse) destination layout on Ascend hardware.

Common situations: Enabling --enable-hierarchical-cache / HiCache with PD disaggregation on Ascend NPU; configurations ported from NVIDIA where the Mooncake/NIXL path supports device indices but the Ascend backend does not yet.

Related errors


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