sgl-project/sglang · error · ValueError

The hpc_ops MoE runner backend does not support apply_router

Error message

The hpc_ops MoE runner backend does not support apply_router_weight_on_input.

What it means

The hpc_ops MoE runner backend does not implement apply_router_weight_on_input (multiplying router weights into hidden states before dispatch). _check_runner_config_supported rejects this runner config option because the fused kernel applies routing weights internally.

Source

Thrown at python/sglang/srt/layers/moe/moe_runner/hpc_ops.py:107

    gate_up_alphas: Optional[torch.Tensor] = None
    down_alphas: Optional[torch.Tensor] = None
    w13_input_scale: Optional[torch.Tensor] = None
    w2_input_scale: Optional[torch.Tensor] = None


def _check_runner_config_supported(runner_config: MoeRunnerConfig) -> None:
    if runner_config.activation != "silu" or not runner_config.is_gated:
        raise ValueError(
            "The hpc_ops MoE runner backend only supports the gated silu "
            f"activation, got activation={runner_config.activation}, "
            f"is_gated={runner_config.is_gated}."
        )
    if runner_config.num_fused_shared_experts != 0:
        raise ValueError(
            "The hpc_ops MoE runner backend does not support fused shared experts."
        )
    if runner_config.apply_router_weight_on_input:
        raise ValueError(
            "The hpc_ops MoE runner backend does not support "
            "apply_router_weight_on_input."
        )
    if runner_config.no_combine:
        raise ValueError(
            "The hpc_ops MoE runner backend does not support no_combine "
            "(the fused kernel always reduces over top-k experts)."
        )
    if (
        runner_config.gemm1_alpha is not None
        or runner_config.gemm1_clamp_limit is not None
        or runner_config.swiglu_limit is not None
    ):
        raise ValueError(
            "The hpc_ops MoE runner backend runs a plain SiLU-and-mul; it does "
            "not support gemm1_alpha / gemm1_clamp_limit / swiglu_limit."
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Use a different MoE runner backend (triton or the model default)
  2. Use a model that does not set apply_router_weight_on_input
  3. Patch/override the model config to disable the flag only if semantics are understood
Defensive patterns

Strategy: validation

Validate before calling

if server_args.moe_runner_backend == 'hpc_ops' and getattr(model_config, 'apply_router_weight_on_input', False):
    server_args.moe_runner_backend = None  # fall back to default

Prevention

When it happens

Trigger: Loading a model config with apply_router_weight_on_input=true (e.g. some GPT-OSS / Mixtral variants) while --moe-runner-backend hpc_ops is active; check runs when the none->hpc_ops fused-experts path is registered/invoked.

Common situations: Enabling hpc_ops for a model whose architecture applies router weights on input; copying server args from a benchmark script to a different model family.

Related errors


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