sgl-project/sglang · error · ValueError

Unsupported SANA-WM gdn_backend: {self.gdn_backend}. Expecte

Error message

Unsupported SANA-WM gdn_backend: {self.gdn_backend}. Expected one of auto, torch, triton.

What it means

gdn_backend selects the kernel implementation and must be 'auto', 'torch', or 'triton'. Validation happens at block construction so invalid backend names never reach dispatch.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py:1895

        self.in_dim = in_dim
        self.out_dim = out_dim
        self.heads = heads
        self.dim = head_dim
        self.eps = eps
        self.softmax_main = softmax_main
        self.update_rule = update_rule
        self.cam_update_rule = cam_update_rule
        self.chunk_gdn_chunk_size = chunk_gdn_chunk_size
        self.use_chunked_softmax_attention = use_chunked_softmax_attention
        self.gdn_backend = gdn_backend
        if self.update_rule not in ("torch_chunk", "torch_recurrent"):
            raise ValueError(f"Unsupported SANA-WM update_rule: {self.update_rule}")
        if self.cam_update_rule not in ("torch_chunk", "torch_recurrent"):
            raise ValueError(
                f"Unsupported SANA-WM cam_update_rule: {self.cam_update_rule}"
            )
        if self.gdn_backend not in ("auto", "torch", "triton"):
            raise ValueError(
                "Unsupported SANA-WM gdn_backend: "
                f"{self.gdn_backend}. Expected one of auto, torch, triton."
            )

        # Fused QKV + output proj (proj shared with cam branch).
        self.qkv = nn.Linear(in_dim, 3 * out_dim, bias=False)
        self.proj = nn.Linear(out_dim, out_dim, bias=True)

        if qk_norm:
            self.q_norm = _RMSNorm(in_dim, eps=1e-5)
            self.k_norm = _RMSNorm(in_dim, eps=1e-5)
            self.q_norm_cam = _RMSNorm(in_dim, eps=1e-5)
            self.k_norm_cam = _RMSNorm(in_dim, eps=1e-5)
        else:
            self.q_norm = nn.Identity()
            self.k_norm = nn.Identity()
            self.q_norm_cam = nn.Identity()
            self.k_norm_cam = nn.Identity()

View on GitHub (pinned to 0132848349)

Solutions

  1. Use 'auto' (preferred; falls back to torch when Triton prechecks fail), 'torch', or 'triton'
  2. Remember: update_rule/cam_update_rule pick the algorithm, gdn_backend picks the kernel — set Triton via gdn_backend

Example fix

# before
GDNBlock(dim, gdn_backend="cuda")
# after
GDNBlock(dim, gdn_backend="auto")
Defensive patterns

Strategy: validation

Validate before calling

assert gdn_backend in ("auto", "torch", "triton"), gdn_backend

Type guard

def valid_gdn_backend(b: str) -> bool: return b in ("auto", "torch", "triton")

Prevention

When it happens

Trigger: Instantiating the GDN block with gdn_backend='cuda', 'cuda_kernel', 'fused', or a version-specific name.

Common situations: Configs copied from another codebase whose backend names differ; users assuming Triton selection also goes through update_rule and setting both incorrectly.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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