sgl-project/sglang · error · ValueError

MiniMax-H3 MPS execution does not support torch.compile; pas

Error message

MiniMax-H3 MPS execution does not support torch.compile; pass --enable-torch-compile false

What it means

The MiniMax-H3 MPS execution path (synchronous layerwise offload) is incompatible with torch.compile, so validate_server_args rejects server_args.enable_torch_compile == True on MPS. Compiling graph-broken offload loops yields no benefit and can produce incorrect graphs, so it is hard-disabled.

Source

Thrown at python/sglang/multimodal_gen/configs/pipeline_configs/minimax_h3.py:248

            required_components = (
                "transformer",
                "text_encoder",
                "video_vae",
                "audio_vae",
            )
            missing_components = [
                component
                for component in required_components
                if server_args.residency_mode(component) != LAYERWISE_OFFLOAD
            ]
            if missing_components:
                raise ValueError(
                    "MiniMax-H3 on MPS requires synchronous layerwise offload for "
                    f"{missing_components}; pass --layerwise-offload-components "
                    "transformer text_encoder video_vae audio_vae"
                )
            if server_args.enable_torch_compile:
                raise ValueError(
                    "MiniMax-H3 MPS execution does not support torch.compile; "
                    "pass --enable-torch-compile false"
                )
        selected_backend = self.resolve_transformer_attention_backend(server_args)
        if (
            int(server_args.ring_degree or 1) > 1
            and selected_backend is not AttentionBackendEnum.FA
        ):
            raise ValueError(
                "MiniMax-H3 ring parallelism requires the FlashAttention "
                "backend for the transformer"
            )
        if selected_backend is None:
            return
        get_attn_backend(
            self.dit_config.arch_config.attention_head_dim,
            torch.bfloat16,
            selected_attention_backend=selected_backend,

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass --enable-torch-compile false (or omit the flag) when running on MPS
  2. Strip GPU-specific perf flags from launch scripts when targeting Apple Silicon
  3. If torch.compile is required, run on a CUDA host

Example fix

# before
python -m sglang.launch_server --model MiniMax-H3 --device mps --enable-torch-compile

# after
python -m sglang.launch_server --model MiniMax-H3 --device mps --enable-torch-compile false
Defensive patterns

Strategy: validation

Validate before calling

if server_args.device == "mps":
    assert not server_args.enable_torch_compile, "torch.compile unsupported on MPS path"

Prevention

When it happens

Trigger: Launching MiniMax-H3 on MPS with --enable-torch-compile (or a config defaulting it on) while the MPS layerwise-offload path is active.

Common situations: Reusing a CUDA launch script with --enable-torch-compile on a Mac; profiles/tuning guides written for GPU being applied to MPS runs.

Related errors


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