sgl-project/sglang · error · RuntimeError

unsupported input for LTX2 QKNorm split-RoPE CUDA

Error message

unsupported input for LTX2 QKNorm split-RoPE CUDA

What it means

ltx2_qknorm_split_rope_cuda validates Q/K, their cos/sin tables, and RMSNorm weights against a supported-input predicate before dispatching to the custom op. If any check fails (dtype, device, shape, contiguity), it raises this generic RuntimeError.

Source

Thrown at python/sglang/kernels/ops/diffusion/rope/ltx2_qknorm_split_rope_jit.py:192

    k_weight: torch.Tensor,
    *,
    eps: float,
    num_heads: int,
    head_dim: int,
) -> tuple[torch.Tensor, torch.Tensor]:
    if not can_use_ltx2_qknorm_split_rope_cuda(
        q,
        q_cos,
        q_sin,
        q_weight,
        k,
        k_cos,
        k_sin,
        k_weight,
        num_heads=num_heads,
        head_dim=head_dim,
    ):
        raise RuntimeError("unsupported input for LTX2 QKNorm split-RoPE CUDA")
    return _ltx2_qknorm_split_rope_custom_op(
        q,
        q_cos,
        q_sin,
        q_weight,
        k,
        k_cos,
        k_sin,
        k_weight,
        float(eps),
        int(num_heads),
        int(head_dim),
    )

View on GitHub (pinned to 0132848349)

Solutions

  1. Inspect the _supported_inputs predicate in ltx2_qknorm_split_rope_jit.py and satisfy each condition (bf16 dtype, CUDA, matching shapes/strides).
  2. If you control the caller, rely on the existing try/except fallback to the unfused path rather than fixing inputs.
  3. Verify cos/sin devices match q/k and weights are contiguous.

Example fix

// before
q = q.half()  # fp16 unsupported
ltx2_qknorm_split_rope_cuda(q, q_cos, q_sin, q_w, k, k_cos, k_sin, k_w, ...)
// after
q, k = q.bfloat16(), k.bfloat16()
ltx2_qknorm_split_rope_cuda(q, q_cos, q_sin, q_w, k, k_cos, k_sin, k_w, ...)
Defensive patterns

Strategy: fallback

Validate before calling

# mirror the kernel's supported-input predicate
ok = (q.dtype is torch.bfloat16 and q.is_cuda
      and cos.device == q.device and q.stride(-1) == 1
      and q_weight.is_contiguous())

Try / catch

try:
    out = ltx2_qknorm_split_rope_cuda(...)
except RuntimeError:
    out = eager_ltx2_qknorm_split_rope(...)  # fallback path

Prevention

When it happens

Trigger: Calling ltx2_qknorm_split_rope_cuda (usually via _ltx2_try_fused_qknorm_split_rope) with unsupported dtype, mismatched devices, wrong shapes, or non-contiguous weights.

Common situations: LTX2 model in fp16 instead of bf16, cos/sin on the wrong device, or a Q/K reshape that breaks contiguity. The caller usually catches this and falls back to the eager path.

Related errors


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