{"record":{"id":"720a9ac0c8808028","repo":"sgl-project/sglang","slug":"enable-unified-memory-with-pd-disaggregation-doe","errorCode":null,"errorMessage":"--enable-unified-memory with PD disaggregation does not support hybrid-SWA models yet (no whole-envelope transfer scheme for the SWA sub-pool). Drop --enable-unified-memory or run without PD.","messagePattern":"--enable-unified-memory with PD disaggregation does not support hybrid-SWA models yet \\(no whole-envelope transfer scheme for the SWA sub-pool\\)\\. Drop --enable-unified-memory or run without PD\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/kv_cache_configurator.py","lineNumber":402,"sourceCode":"        # (req_to_token_pool is None); supports hybrid Mamba and hybrid SWA (not DSV4).\n        if get_memory().enable_unified_memory and req_to_token_pool is None:\n            pd_enabled = get_disagg().disaggregation_mode != \"null\"\n            if self.mambaish_config is not None:\n                if pd_enabled and not self.use_mla_backend:\n                    raise ValueError(\n                        \"--enable-unified-memory with PD disaggregation \"\n                        \"currently supports only MLA hybrid-Mamba models \"\n                        \"(e.g. kimi-linear); this model uses the MHA full-\"\n                        \"attention pool. Drop --enable-unified-memory or run \"\n                        \"without PD disaggregation.\"\n                    )\n                bundle = self._init_unified_mamba_pools(\n                    max_num_reqs=sizes.max_running_requests,\n                    max_total_num_tokens=sizes.max_total_num_tokens,\n                )\n            elif self.is_hybrid_swa and not is_deepseek_v4(self.model_config.hf_config):\n                if pd_enabled:\n                    raise ValueError(\n                        \"--enable-unified-memory with PD disaggregation does \"\n                        \"not support hybrid-SWA models yet (no whole-envelope \"\n                        \"transfer scheme for the SWA sub-pool). Drop \"\n                        \"--enable-unified-memory or run without PD.\"\n                    )\n                bundle = self._init_unified_swa_pools(\n                    max_num_reqs=sizes.max_running_requests,\n                    full_max_total_num_tokens=sizes.full_max_total_num_tokens,\n                    swa_max_total_num_tokens=sizes.swa_max_total_num_tokens,\n                )\n            else:\n                # Fail loud, not silently fall through to the normal pools (which would\n                # leave the flag a no-op). The feature replaces the HYBRID pools only.\n                raise ValueError(\n                    \"--enable-unified-memory only supports hybrid Mamba and \"\n                    \"hybrid sliding-window-attention models (DeepSeek-V4 excluded); \"\n                    f\"the current model ({self.model_config.hf_config.architectures}) \"\n                    \"is neither, so the unified memory pool cannot be built. Drop \"","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/kv_cache_configurator.py#L384-L420","documentation":"Raised during KV pool initialization when --enable-unified-memory is combined with prefill/decode (PD) disaggregation on a hybrid sliding-window-attention (SWA) model. There is no whole-envelope transfer scheme for the SWA sub-pool, so the unified pool cannot be transferred between prefill and decode workers.","triggerScenarios":"Boot a server with --enable-unified-memory on a hybrid-SWA architecture while PD disaggregation is enabled; _init_pools raises before any pool is created.","commonSituations":"Trying the new unified memory pool on a hybrid-SWA model in a PD-disaggregated deployment before that combination was implemented.","solutions":["Remove --enable-unified-memory from the server args","Run the same model without PD disaggregation (single-node / non-PD topology)","Wait for a release that implements SWA sub-pool whole-envelope transfer"],"exampleFix":"# before\npython -m sglang.launch_server --model hybrid-swa-model --enable-unified-memory --disagg-pd ...\n# after\npython -m sglang.launch_server --model hybrid-swa-model --disagg-pd ...","handlingStrategy":"validation","validationCode":"from sglang.srt.utils import is_hybrid_swa  # conceptual\npd_enabled = server_args.disaggregation_mode in (\"prefill\", \"decode\")\nif server_args.enable_unified_memory and pd_enabled and is_hybrid_swa(model_config):\n    raise SystemExit(\"unified-memory + PD unsupported for hybrid-SWA; dropping --enable-unified-memory\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate --enable-unified-memory in launch scripts on the model family and PD mode","Keep a support matrix of flag combinations in deployment configs"],"tags":["unified-memory","pd-disaggregation","hybrid-swa","kv-cache","boot-config"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}