sgl-project/sglang · error · ValueError

The hpc_ops MoE runner backend does not support fused shared

Error message

The hpc_ops MoE runner backend does not support fused shared experts.

What it means

The hpc_ops MoE runner backend in SGLang does not implement fused shared experts (num_fused_shared_experts). The _check_runner_config_supported validation raises this ValueError when the runner config requests fused shared experts while --moe-runner-backend hpc_ops is selected.

Source

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

    w13_weight_scale_inv: Optional[torch.Tensor] = None
    w2_weight_scale_inv: Optional[torch.Tensor] = None
    block_shape: Optional[List[int]] = None
    # Per-tensor path
    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(

View on GitHub (pinned to 0132848349)

Solutions

  1. Switch back to the default/triton MoE runner backend (remove --moe-runner-backend hpc_ops)
  2. Disable shared-expert fusion so num_fused_shared_experts == 0 for this model
  3. Use a model without fused shared experts with hpc_ops

Example fix

# before
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V3 --moe-runner-backend hpc_ops
# after
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V3 --moe-runner-backend triton
Defensive patterns

Strategy: validation

Validate before calling

from sglang.srt.layers.moe.utils import MoeRunnerBackend
backend = server_args.moe_runner_backend
if backend == MoeRunnerBackend.HPC_OPS and model_config.num_fused_shared_experts != 0:
    raise SystemExit("hpc_ops does not support fused shared experts; use triton")

Prevention

When it happens

Trigger: Running a model whose MoE layer sets num_fused_shared_experts != 0 (e.g. DeepSeek-V3-style models with fused shared expert projection) together with --moe-runner-backend hpc_ops; the fused_experts_none_to_hpc_ops fused-func path runs the config check on first MoE invocation.

Common situations: Switching a shared-expert-fused checkpoint (DeepSeek V2/V3 family) to the hpc_ops backend; enabling shared-expert fusion flags or a server args preset that turns on num_fused_shared_experts.

Related errors


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