sgl-project/sglang · error · RuntimeError

SANA-WM Triton camera GDN backend unavailable: {reason}

Error message

SANA-WM Triton camera GDN backend unavailable: {reason}

What it means

After casting q/k/v to float32 contiguous, a second precheck validates shapes/dtypes for the cam_scan_bidi_chunkwise Triton kernel. With forced gdn_backend='triton', a failure raises; otherwise it returns None for torch fallback.

Source

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

            precheck_reason = "requires eval/inference mode"
        elif not q.is_cuda:
            precheck_reason = "requires CUDA tensor"

        if precheck_reason is not None:
            if self.gdn_backend == "triton":
                raise RuntimeError(
                    "SANA-WM Triton camera GDN backend unavailable: "
                    f"{precheck_reason}"
                )
            return None

        q = q.float().contiguous()
        k = k.float().contiguous()
        v = v.float().contiguous()
        reason = self._triton_cam_gdn_unavailable_reason(q, k, v, beta, decay, HW)
        if reason is not None:
            if self.gdn_backend == "triton":
                raise RuntimeError(
                    f"SANA-WM Triton camera GDN backend unavailable: {reason}"
                )
            return None

        try:
            from sglang.kernels.ops.diffusion import cam_scan_bidi_chunkwise

            B, heads, _, _ = q.shape
            T, H_sp, W_sp = HW
            S = H_sp * W_sp
            if beta.ndim == 3:
                beta_in = beta.unsqueeze(-1).expand(B, heads, T, S).contiguous()
            else:
                beta_in = beta.contiguous()
            out = cam_scan_bidi_chunkwise(
                q,
                k,
                v,

View on GitHub (pinned to 0132848349)

Solutions

  1. Switch to gdn_backend='auto'
  2. Check the camera branch tensor shapes (q/k/v float32 CUDA, beta/decay broadcastable) against the kernel's constraints
  3. Upgrade sglang so the diffusion Triton ops include cam_scan_bidi_chunkwise

Example fix

# before
GDNBlock(dim, cam_update_rule="torch_chunk", gdn_backend="triton")
# after
GDNBlock(dim, cam_update_rule="torch_chunk", gdn_backend="auto")
Defensive patterns

Strategy: fallback

Validate before calling

use gdn_backend="auto"; verify q/k/v are float32 CUDA and contiguous before forcing triton

Try / catch

except RuntimeError as e:
    if "camera GDN backend unavailable" in str(e):
        block.gdn_backend = "auto"
        out = block(...)
    else:
        raise

Prevention

When it happens

Trigger: Forcing gdn_backend='triton' with camera-branch tensors whose head counts, sequence lengths, or beta/decay shapes are outside cam_scan_bidi_chunkwise's supported set, or missing the kernel import.

Common situations: Non-standard attention head configs; older sglang builds lacking cam_scan_bidi_chunkwise in kernels.ops.diffusion; custom camera ray features with unexpected dims.

Related errors


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