sgl-project/sglang · critical · RuntimeError

[Elastic EP] WORLD MLP sync dp_size exceeds WORLD size: rank

Error message

[Elastic EP] WORLD MLP sync dp_size exceeds WORLD size: rank={torch.distributed.get_rank(group)} live_dp_size={live_dp_size} world_size={world_size} effective_ep_size={effective_ep_size}

What it means

Elastic EP guard: the live attention DP size exceeds the WORLD (process group) size, which is topologically impossible and means the elastic state over-counts replicas relative to actual ranks.

Source

Thrown at python/sglang/srt/managers/scheduler_components/dp_attn.py:77

    from sglang.srt.elastic_ep.elastic_ep import ElasticEPStateManager
    from sglang.srt.layers.dp_attention import get_attention_dp_size

    live_dp_size = get_attention_dp_size()
    effective_ep_size = ElasticEPStateManager.get_effective_ep_size()
    world_size = torch.distributed.get_world_size(group)

    if live_dp_size != effective_ep_size:
        raise RuntimeError(
            "[Elastic EP] WORLD MLP sync dp_size is out of sync: "
            f"rank={torch.distributed.get_rank(group)} "
            f"live_dp_size={live_dp_size} effective_ep_size={effective_ep_size} "
            f"world_size={world_size} server_args_dp_size={dp_size} "
            f"local_num_tokens={local_num_tokens} "
            f"local_forward_mode={local_forward_mode}"
        )
    if live_dp_size > world_size:
        raise RuntimeError(
            "[Elastic EP] WORLD MLP sync dp_size exceeds WORLD size: "
            f"rank={torch.distributed.get_rank(group)} "
            f"live_dp_size={live_dp_size} world_size={world_size} "
            f"effective_ep_size={effective_ep_size}"
        )

    return live_dp_size


@dataclass
class MLPSyncBatchInfo:
    dp_size: int
    tp_size: int
    cp_size: int

    num_tokens: int
    num_tokens_for_logprob: int
    can_run_decode_cuda_graph: bool

View on GitHub (pinned to 0132848349)

Solutions

  1. Verify dp_size * tp/ep configuration divides the actual world size (GPU count) exactly
  2. Recheck elastic EP resize parameters and that no rank applied a stale dp_size
  3. Relaunch with a consistent topology

Example fix

# before
--dp-size 8 --tp 8  # 8 dp ranks needed but world has 8 total
# after
--dp-size 4 --tp 8  # or add GPUs so dp_size <= world_size
Defensive patterns

Strategy: validation

Validate before calling

world = torch.distributed.get_world_size()
assert dp_size <= world, f'dp_size {dp_size} exceeds world {world}'

Prevention

When it happens

Trigger: get_attention_dp_size() > torch.distributed.get_world_size(group) during prepare_mlp_sync_batch_raw, e.g. after a buggy resize that set dp_size beyond the launched world, or launching with dp_size larger than the number of GPUs/ranks.

Common situations: Misconfigured --dp-size vs --tensor-parallel-size/--expert-parallel-size world size; elastic resize arithmetic bugs; env var overrides applied on only some ranks.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/ebb00cc29f46a555. Report an issue: GitHub.