{"record":{"id":"eb9d4385b581570d","repo":"sgl-project/sglang","slug":"pd-decode-dcp-currently-requires-prefill-attention","errorCode":null,"errorMessage":"PD decode DCP currently requires prefill attention CP=1, got {info.attn_cp_size}.","messagePattern":"PD decode DCP currently requires prefill attention CP=1, got (.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/disaggregation/common/conn.py","lineNumber":648,"sourceCode":"            )\n\n        if (\n            info.kv_cache_dtype is not None\n            and info.kv_cache_dtype != self.kv_cache_dtype_str\n        ):\n            raise RuntimeError(\n                f\"KV cache dtype mismatch: prefill server has kv_cache_dtype={info.kv_cache_dtype}, \"\n                f\"but decode server has kv_cache_dtype={self.kv_cache_dtype_str}. \"\n                f\"Both servers must use the same --kv-cache-dtype value.\"\n            )\n\n        if self.dcp_size > 1:\n            if not (self.is_mla_backend or self.is_hybrid_mla_backend):\n                raise RuntimeError(\n                    \"PD decode DCP requires an MLA or hybrid-MLA KV pool.\"\n                )\n            if info.attn_cp_size != 1:\n                raise RuntimeError(\n                    \"PD decode DCP currently requires prefill attention CP=1, \"\n                    f\"got {info.attn_cp_size}.\"\n                )\n\n        self._resolve_rank_mapping(info)\n        self.prefill_info_table[bootstrap_addr] = info\n        logger.debug(f\"Prefill parallel info for [{bootstrap_addr}]: {info}\")\n        return True\n\n    def _resolve_rank_mapping(self, info: PrefillServerInfo) -> None:\n        \"\"\"Compute TP/CP/PP rank mapping and store on the PrefillServerInfo object.\n        Deterministic for a given (bootstrap_addr, decode engine) pair.\"\"\"\n        # TP rank mapping\n        if self.attn_tp_size == info.attn_tp_size:\n            target_tp_rank = self.kv_args.engine_rank % self.attn_tp_size\n            required_dst_info_num = 1\n            required_prefill_response_num = 1\n            target_tp_ranks = [target_tp_rank]","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/disaggregation/common/conn.py#L630-L666","documentation":"Raised in try_ensure_parallel_info when decode DCP is enabled and the prefill server reports attn_cp_size != 1. The current PD DCP implementation can only shard/sync the MLA latent on the decode side if prefill runs attention without context parallelism, so any prefill CP > 1 is rejected.","triggerScenarios":"Decode server with dcp_size > 1 bootstraps against a prefill server launched with attention context parallelism (attn CP > 1, e.g. --enable-dp-attention style CP configs or cp-size > 1).","commonSituations":"Reusing a large-MLA prefill config that enabled attention CP for long context, then wiring it to a DCP decode pool; version upgrades where prefill CP and decode DCP combos are not jointly tested.","solutions":["Relaunch the prefill server with attention CP disabled (attn_cp_size=1)","Keep DCP on decode only and ensure prefill uses plain TP/DP attention","Check both servers' logs for their reported CP sizes and reconcile the launch flags"],"exampleFix":"# before\n# prefill: --cp-size 2 ...\n# after\n# prefill: --cp-size 1 ... (plain TP instead)","handlingStrategy":"validation","validationCode":"if decode_args.dcp_size > 1:\n    assert prefill_args.attn_cp_size == 1, 'PD DCP requires prefill attention CP=1'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't reuse CP-enabled prefill configs when attaching DCP decode pools","Log attn CP size at prefill startup and compare before wiring PD"],"tags":["disaggregation","dcp","attention-parallelism","prefill","config-mismatch"],"backgroundTag":"server-config-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}