sgl-project/sglang · error · ValueError

No valid partitions found for total SMs {total_sms} with con

Error message

No valid partitions found for total SMs {total_sms} with constraints (min per part: {min_per_part}, multiple: {multiple})

What it means

divide_sm searches for a first-partition size >= min_per_part, a multiple of 'multiple', where the first part covers at least half the SMs (x >= total - x) and the remainder keeps >= 16 SMs. On small GPUs or with Hopper's (8,8) constraints no candidate may exist.

Source

Thrown at python/sglang/srt/multiplex/pdmux_context.py:83

        return 8, 8
    else:
        raise ValueError(f"Unsupported compute capability: {major}.{minor}")


def divide_sm(total_sms, compute_capability, groups):
    """
    :param total_sms: total sm count on a single GPU
    :param compute_capability: (major, minor)
    :return: SM partition group(prefill sm, decode sm)
    """
    min_per_part, multiple = get_arch_constraints(compute_capability)
    possible_values = [
        x
        for x in range(min_per_part, total_sms - min_per_part + 1, multiple)
        if x >= total_sms - x and total_sms - x >= 16
    ]
    if not possible_values:
        raise ValueError(
            f"No valid partitions found for total SMs {total_sms} "
            f"with constraints (min per part: {min_per_part}, multiple: {multiple})"
        )

    if len(possible_values) >= groups:
        step = max(1, len(possible_values) // groups)
        selected_values = possible_values[::step][:groups]
    else:
        selected_values = possible_values

    divisions = []
    for part1 in selected_values:
        part2 = total_sms - part1
        divisions.append((part1, part2))

    divisions.reverse()  # Reverse to have larger prefill SM first

    return divisions

View on GitHub (pinned to 0132848349)

Solutions

  1. Disable PD multiplexing on this GPU — it cannot be partitioned under current constraints
  2. Use a GPU with more SMs (constraints effectively require >= ~32+ SMs depending on arch)
  3. File an issue with your total SM count and compute capability so constraints can be relaxed/extended
Defensive patterns

Strategy: fallback

Validate before calling

total = torch.cuda.get_device_properties(0).multi_processor_count
major, minor = torch.cuda.get_device_capability()
# conservative precheck for CC 9.0 constraints (min 8, multiple 8, remainder >= 16)
assert total >= 32 and any(x for x in range(8, total - 15, 8) if x >= total - x), 'SM partitioning infeasible'

Prevention

When it happens

Trigger: initialize_stream_groups on e.g. a small GPU (few SMs) with CC 9.0 constraints min_per_part=8, multiple=8 — e.g. total_sms where no multiple-of-8 x satisfies x >= total-x and total-x >= 16, like total_sms=24.

Common situations: Running PD multiplexing on entry-level GPUs (few SMs); future GPUs with unusual SM counts; total_sms not divisible-friendly with the required multiple.

Related errors


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