{"record":{"id":"50444623e6ee7d6b","repo":"sgl-project/sglang","slug":"attention-group-range-group-start-group-end","errorCode":null,"errorMessage":"attention group range [{group_start}, {group_end}) is outside consumer_count={self.consumer_count}","messagePattern":"attention group range \\[(.+?), (.+?)\\) is outside consumer_count=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/cuda_vmm_transport_utils.py","lineNumber":767,"sourceCode":"    def _pool(self, device_index: int) -> _ImportedCudaVmmPool:\n        return _get_imported_pool(\n            fabric_handle=self.fabric_handle,\n            posix_socket_path=self.posix_socket_path,\n            allocation_size=self.allocation_size,\n            device_index=device_index,\n        )\n\n    def _acknowledgement_range(self, consumer_count: int) -> tuple[int, int]:\n        if consumer_count <= 0:\n            raise ValueError(\"consumer_count must be positive\")\n        if consumer_count == self.consumer_count:\n            return 0, self.consumer_count\n\n        parallel = get_parallel()\n        group_start = parallel.attn_cp_rank * parallel.attn_tp_size\n        group_end = group_start + parallel.attn_tp_size\n        if not 0 <= group_start < group_end <= self.consumer_count:\n            raise ValueError(\n                \"attention group range \"\n                f\"[{group_start}, {group_end}) is outside \"\n                f\"consumer_count={self.consumer_count}\"\n            )\n        if consumer_count == 1:\n            slot = group_start + parallel.attn_tp_rank\n            return slot, slot + 1\n        if consumer_count == parallel.attn_tp_size:\n            return group_start, group_end\n        raise ValueError(\n            \"consumer_count must be 1, the attention TP size, or the full \"\n            f\"consumer count ({self.consumer_count}); got {consumer_count}\"\n        )\n\n    def _resolve_consumer_count(self, consumer_count: int | None) -> int:\n        return 1 if consumer_count is None else consumer_count\n\n    def _acknowledge_consumption(self, device_index: int, consumer_count: int) -> None:","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/cuda_vmm_transport_utils.py#L749-L785","documentation":"Raised when the rank's derived attention-group slot window [cp_rank * tp_size, ...+tp_size) is not a valid subrange of the pool's consumer_count. This means the parallel state (attn_cp_rank, attn_tp_size) is inconsistent with the number of consumers the pool was created with — e.g. more ranks than pool slots.","triggerScenarios":"Consumer pool created with consumer_count smaller than cp_size * tp_size; attn_cp_rank/attn_tp_size read from a parallel state initialized with different world size than the transport pool; mixed single-group and multi-group acknowledgement paths.","commonSituations":"TP/CP world-size mismatch between exporter and importers; test harness constructing pools with a hardcoded consumer count; reranking of ranks after a restart with stale pool config.","solutions":["Recreate the VMM transport with consumer_count equal to the actual number of participating ranks (cp_size * tp_size)","Verify get_parallel() state matches the server_args used to size the pool","Ensure all ranks construct the pool with the same consumer_count"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from sglang.srt.utils import get_parallel\np = get_parallel()\nexpected = (p.attn_cp_size if hasattr(p, 'attn_cp_size') else p.attn_cp_rank + 1) * p.attn_tp_size\nassert expected <= pool.consumer_count","typeGuard":"def group_fits_pool(pool, parallel) -> bool:\n    end = parallel.attn_cp_rank * parallel.attn_tp_size + parallel.attn_tp_size\n    return 0 < end <= pool.consumer_count","tryCatchPattern":null,"preventionTips":["Size consumer_count = cp_size * tp_size when creating the pool","Recreate transport pools after world-size changes"],"tags":["cuda","vmm","parallelism","world-size-mismatch"],"backgroundTag":"parallel-world-size-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}