{"record":{"id":"c9a019a0591a7f3f","repo":"sgl-project/sglang","slug":"hidden-size-is-outside-the-supported-ltx2-fast-pat","errorCode":null,"errorMessage":"hidden size is outside the supported LTX2 fast-path range","messagePattern":"hidden size is outside the supported LTX2 fast-path range","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/kernels/ops/diffusion/modulate/ltx2_ada_values_triton.py","lineNumber":164,"sourceCode":"    if not timestep.is_contiguous():\n        raise ValueError(\"timestep must be contiguous\")\n    if scale_shift_table.ndim != 2 or scale_shift_table.shape[0] != 9:\n        raise ValueError(\"scale_shift_table must have shape [9, D]\")\n    if (\n        not scale_shift_table.is_cuda\n        or scale_shift_table.dtype not in (torch.bfloat16, torch.float32)\n        or scale_shift_table.stride(-1) != 1\n    ):\n        raise ValueError(\n            \"scale_shift_table must be CUDA, bf16/fp32, last-dim contiguous\"\n        )\n\n    total_params = int(scale_shift_table.shape[0])\n    hidden = int(scale_shift_table.shape[1])\n    if hidden <= 0 or timestep.shape[-1] != total_params * hidden:\n        raise ValueError(\"timestep last dim must equal 9 * hidden\")\n    if hidden % 256 != 0 or hidden > 8192:\n        raise ValueError(\"hidden size is outside the supported LTX2 fast-path range\")\n\n    batch, seq, _ = timestep.shape\n    rows = int(batch * seq)\n    # Each returned output is a disjoint, contiguous view, so one allocation\n    # avoids nine allocator round trips per transformer block.\n    output_storage = torch.empty(\n        (9, batch, seq, hidden), device=timestep.device, dtype=timestep.dtype\n    )\n    outs = tuple(output_storage.unbind(dim=0))\n    _ltx2_ada_values9_kernel[(rows,)](\n        timestep,\n        scale_shift_table,\n        *outs,\n        rows,\n        hidden,\n        total_params,\n        scale_shift_table.stride(0),\n        scale_shift_table.stride(1),","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/kernels/ops/diffusion/modulate/ltx2_ada_values_triton.py#L146-L182","documentation":"The LTX2 fast-path Triton kernel only supports hidden sizes that are multiples of 256 up to 8192 (kernel block-size constraints). Hidden sizes outside this range raise this error instead of launching the kernel.","triggerScenarios":"Calling ltx2_ada_values9 with a scale_shift_table whose hidden dim D is not a multiple of 256 (e.g. 1536 is fine, 1280 or 1000 is not) or larger than 8192.","commonSituations":"Custom LTX2 variants with unusual hidden dims; resized checkpoints; hidden sizes from other DiT architectures being routed into the LTX2 fused path.","solutions":["Pad or choose a hidden size that is a multiple of 256 and <= 8192","Fall back to the non-fused reference AdaLN computation for unsupported hidden sizes (the _ltx2_try_fused_ada_values9 caller should catch this and use eager)","Extend the kernel's block-size handling if a genuinely new range is needed"],"exampleFix":"# before\nvals = ltx2_ada_values9(table_d1280, t)  # raises\n# after\ntry:\n    vals = ltx2_ada_values9(table, t)\nexcept ValueError:\n    vals = reference_ltx2_ada_values9(table, t)","handlingStrategy":"fallback","validationCode":"hidden = scale_shift_table.shape[1]\nfused_ok = hidden % 256 == 0 and hidden <= 8192","typeGuard":"def hidden_supported(table: torch.Tensor) -> bool:\n    h = table.shape[1]\n    return h % 256 == 0 and h <= 8192","tryCatchPattern":"try:\n    vals = ltx2_ada_values9(table, timestep)\nexcept ValueError:\n    vals = reference_ltx2_ada_values9(table, timestep)","preventionTips":["Keep hidden size a multiple of 256 in custom configs","Catch ValueError in _ltx2_try_fused_ada_values9-style wrappers and use eager"],"tags":["hidden-size","kernel-limits","ltx2","triton"],"backgroundTag":"unsupported-hidden-size","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}