{"record":{"id":"d50d436c46ec5961","repo":"sgl-project/sglang","slug":"enable-two-batch-overlap-is-not-supported-with-d","errorCode":null,"errorMessage":"--enable-two-batch-overlap is not supported with DSA index-topk sharing (index_topk_freq > 1 or an index_topk_pattern containing shared layers): the TBO op path does not propagate topk indices across layers, so shared layers would run sparse attention without indices.","messagePattern":"--enable-two-batch-overlap is not supported with DSA index-topk sharing \\(index_topk_freq > 1 or an index_topk_pattern containing shared layers\\): the TBO op path does not propagate topk indices across layers, so shared layers would run sparse attention without indices\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":5879,"sourceCode":"                    # When threshold is not manually set, set it to the index topk of model\n                    from sglang.srt.configs.model_config import get_dsa_index_topk\n\n                    envs.SGLANG_DSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD.set(\n                        get_dsa_index_topk(hf_config)\n                    )\n                    logger.warning(\n                        f\"Set dense attention kv len threshold to model index_topk={envs.SGLANG_DSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD.get()} for DeepSeek with DSA.\"\n                    )\n                # The \"dsa\" attention fill moved to the override registry\n                # (arg_groups/overrides.py: _deepseek_family_overrides).\n\n                index_topk_freq = getattr(hf_config, \"index_topk_freq\", 1) or 1\n                index_topk_pattern = getattr(hf_config, \"index_topk_pattern\", None)\n                if cfg.enable_two_batch_overlap and (\n                    index_topk_freq > 1\n                    or (index_topk_pattern is not None and \"S\" in index_topk_pattern)\n                ):\n                    raise ValueError(\n                        \"--enable-two-batch-overlap is not supported with DSA \"\n                        \"index-topk sharing (index_topk_freq > 1 or an \"\n                        \"index_topk_pattern containing shared layers): the TBO op \"\n                        \"path does not propagate topk indices across layers, so \"\n                        \"shared layers would run sparse attention without indices.\"\n                    )\n\n                if not is_npu() and not is_xpu():  # CUDA or ROCm GPU\n                    if cfg.enable_prefill_cp:\n                        # The DSA CP field declarations moved to the override\n                        # registry (arg_groups/overrides.py:\n                        # _deepseek_family_overrides).\n                        self._declare(\n                            \"_handle_model_specific_adjustments\",\n                            cuda_graph_config=with_phase(\n                                cfg.cuda_graph_config,\n                                Phase.PREFILL,\n                                backend=Backend.DISABLED,","sourceCodeStart":5861,"sourceCodeEnd":5897,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L5861-L5897","documentation":"Two-batch overlap (TBO) is incompatible with DSA index-topk sharing (index_topk_freq > 1 or an index_topk_pattern containing shared 'S' layers): the TBO op path does not propagate topk indices across layers, so shared layers would run sparse attention without indices and produce wrong results. ServerArgs fails fast instead.","triggerScenarios":"Serving a DSA model whose hf_config has index_topk_freq > 1 or index_topk_pattern with shared layers while passing --enable-two-batch-overlap.","commonSituations":"Enabling TBO for throughput on a DSA checkpoint that shares topk indices between layers; flag carried over from a non-sharing DSA config after a checkpoint upgrade.","solutions":["Remove --enable-two-batch-overlap for DSA models with index-topk sharing","Or use a checkpoint/config with index_topk_freq == 1 and no shared layers in index_topk_pattern","Track SGLang releases for TBO support of shared topk indices"],"exampleFix":"# before\n--enable-two-batch-overlap  # DSA model with index_topk_freq=2\n# after\n# (flag removed)","handlingStrategy":"validation","validationCode":"freq = getattr(hf_config, \"index_topk_freq\", 1) or 1\npat = getattr(hf_config, \"index_topk_pattern\", None)\nif args.get(\"enable_two_batch_overlap\") and (freq > 1 or (pat and \"S\" in pat)):\n    args[\"enable_two_batch_overlap\"] = False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Inspect the DSA checkpoint's index_topk settings before enabling TBO","Treat throughput flags like TBO as per-checkpoint, not per-cluster, settings"],"tags":["tbo","dsa","deepseek","flag-conflict"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}