{"record":{"id":"c4a6465df68492e4","repo":"sgl-project/sglang","slug":"dcp-replicate-q-proj-requires-dcp-size-1","errorCode":null,"errorMessage":"--dcp-replicate-q-proj requires --dcp-size > 1.","messagePattern":"--dcp-replicate-q-proj requires --dcp-size > 1\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4278,"sourceCode":"            )\n        if cfg.dcp_comm_backend in (\"a2a\", \"fi_a2a\") and cfg.dcp_size <= 1:\n            raise ValueError(\n                f\"--dcp-comm-backend {cfg.dcp_comm_backend} only affects the \"\n                \"decode context-parallel attention reduction and therefore \"\n                \"requires --dcp-size / --decode-context-parallel-size > 1, but \"\n                f\"got dcp_size={cfg.dcp_size}.\"\n            )\n        if cfg.dcp_comm_backend == \"fi_a2a\" and not is_cuda():\n            raise ValueError(\n                \"--dcp-comm-backend fi_a2a delegates the exchange to FlashInfer's \"\n                \"MNNVL All-to-All kernel, which requires an NVIDIA CUDA platform \"\n                \"with SM90+ and MNNVL fabric memory (e.g. GB200 NVL72). The \"\n                \"authoritative fabric probe runs at model-runner init; use 'a2a' \"\n                \"or 'ag_rs' on clusters without MNNVL.\"\n            )\n        if cfg.dcp_replicate_q_proj:\n            if cfg.dcp_size <= 1:\n                raise ValueError(\"--dcp-replicate-q-proj requires --dcp-size > 1.\")\n            if cfg.dcp_comm_backend not in (\"a2a\", \"fi_a2a\"):\n                raise ValueError(\n                    \"--dcp-replicate-q-proj only applies to the a2a/fi_a2a DCP \"\n                    \"communication backend (it removes the head-dim Q all-gather); \"\n                    f\"got --dcp-comm-backend={cfg.dcp_comm_backend}.\"\n                )\n\n    def _handle_load_balance_method(self):\n        cfg = resolving_view(self)\n        if cfg.disaggregation_mode not in (\"null\", \"prefill\", \"decode\"):\n            raise ValueError(f\"Invalid disaggregation_mode={cfg.disaggregation_mode!r}\")\n\n        if cfg.load_balance_method == \"auto\":\n            # Default behavior:\n            # - non-PD: round_robin\n            # - PD prefill: follow_bootstrap_room\n            # - PD decode: round_robin\n            self._declare(","sourceCodeStart":4260,"sourceCodeEnd":4296,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4260-L4296","documentation":"ServerArgs validation error raised when --dcp-replicate-q-proj is enabled but --dcp-size (--decode-context-parallel-size) is 1 or unset. Replicating the Q projection across DCP ranks only makes sense when decode context parallelism actually shards the batch across multiple ranks, so SGLang rejects the flag as meaningless without it.","triggerScenarios":"Launching with --dcp-replicate-q-proj while dcp_size <= 1 (flag omitted or set to 1).","commonSituations":"Copy-pasting a tuned DCP flag set but forgetting --dcp-size; enabling the optimization in a single-rank smoke test; leftover flag from a previous experiment after removing DCP.","solutions":["Set --dcp-size (or --decode-context-parallel-size) to a value > 1, e.g. --dcp-size 4","If you do not intend to use decode context parallelism, remove --dcp-replicate-q-proj entirely"],"exampleFix":"# before\npython -m sglang.launch_server --dcp-replicate-q-proj\n# after\npython -m sglang.launch_server --dcp-size 4 --dcp-comm-backend a2a --dcp-replicate-q-proj","handlingStrategy":"validation","validationCode":"def dcp_flags(dcp_size: int, replicate_q: bool) -> list[str]:\n    flags = [f\"--dcp-size\", str(dcp_size)] if dcp_size > 1 else []\n    if replicate_q:\n        assert dcp_size > 1, \"--dcp-replicate-q-proj requires --dcp-size > 1\"\n        flags.append(\"--dcp-replicate-q-proj\")\n    return flags","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --dcp-replicate-q-proj as part of a DCP flag bundle; never set it without --dcp-size > 1","Keep DCP-related flags in one config block so they are enabled/disabled together"],"tags":["sglang","distributed","dcp","argument-validation"],"backgroundTag":"invalid-cli-arguments","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}