{"record":{"id":"106ab09058a13044","repo":"sgl-project/sglang","slug":"unsupported-input-for-ltx2-qknorm-split-rope-cuda","errorCode":null,"errorMessage":"unsupported input for LTX2 QKNorm split-RoPE CUDA","messagePattern":"unsupported input for LTX2 QKNorm split-RoPE CUDA","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/diffusion/rope/ltx2_qknorm_split_rope_jit.py","lineNumber":192,"sourceCode":"    k_weight: torch.Tensor,\n    *,\n    eps: float,\n    num_heads: int,\n    head_dim: int,\n) -> tuple[torch.Tensor, torch.Tensor]:\n    if not can_use_ltx2_qknorm_split_rope_cuda(\n        q,\n        q_cos,\n        q_sin,\n        q_weight,\n        k,\n        k_cos,\n        k_sin,\n        k_weight,\n        num_heads=num_heads,\n        head_dim=head_dim,\n    ):\n        raise RuntimeError(\"unsupported input for LTX2 QKNorm split-RoPE CUDA\")\n    return _ltx2_qknorm_split_rope_custom_op(\n        q,\n        q_cos,\n        q_sin,\n        q_weight,\n        k,\n        k_cos,\n        k_sin,\n        k_weight,\n        float(eps),\n        int(num_heads),\n        int(head_dim),\n    )\n","sourceCodeStart":174,"sourceCodeEnd":206,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/diffusion/rope/ltx2_qknorm_split_rope_jit.py#L174-L206","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the _supported_inputs predicate in ltx2_qknorm_split_rope_jit.py and satisfy each condition (bf16 dtype, CUDA, matching shapes/strides).","If you control the caller, rely on the existing try/except fallback to the unfused path rather than fixing inputs.","Verify cos/sin devices match q/k and weights are contiguous."],"exampleFix":"// before\nq = q.half()  # fp16 unsupported\nltx2_qknorm_split_rope_cuda(q, q_cos, q_sin, q_w, k, k_cos, k_sin, k_w, ...)\n// after\nq, k = q.bfloat16(), k.bfloat16()\nltx2_qknorm_split_rope_cuda(q, q_cos, q_sin, q_w, k, k_cos, k_sin, k_w, ...)","handlingStrategy":"fallback","validationCode":"# mirror the kernel's supported-input predicate\nok = (q.dtype is torch.bfloat16 and q.is_cuda\n      and cos.device == q.device and q.stride(-1) == 1\n      and q_weight.is_contiguous())","typeGuard":null,"tryCatchPattern":"try:\n    out = ltx2_qknorm_split_rope_cuda(...)\nexcept RuntimeError:\n    out = eager_ltx2_qknorm_split_rope(...)  # fallback path","preventionTips":["Keep the eager fallback wired in callers.","Check bf16, device, contiguity before the fused call."],"tags":["ltx","qknorm","rope","cuda","input-validation"],"backgroundTag":"unsupported-kernel-input","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}