sgl-project/sglang · error · RuntimeError
unsupported input for causal Conv3D cat/pad CUDA
Error message
unsupported input for causal Conv3D cat/pad CUDA
What it means
The CUDA fused path for causal Conv3D cat/pad only runs on 5D, contiguous CUDA tensors whose padding configuration is accepted by can_use_fused_causal_conv3d_cat_pad_cuda. Any deviation (CPU tensor, wrong rank, non-contiguous memory, or an unsupported padding layout) triggers this guard.
Source
Thrown at python/sglang/kernels/ops/diffusion/layout/causal_conv3d_cat_pad_jit.py:115
def fused_causal_conv3d_cat_pad_cuda(
x: torch.Tensor,
cache_x: torch.Tensor,
padding: list[int] | tuple[int, ...],
) -> torch.Tensor:
if x.dtype not in _SUPPORTED_DTYPES:
raise RuntimeError(f"unsupported dtype for causal Conv3D cat/pad: {x.dtype}")
if not torch.compiler.is_compiling():
if (
not x.is_cuda
or not cache_x.is_cuda
or x.dim() != 5
or cache_x.dim() != 5
or not x.is_contiguous()
or not cache_x.is_contiguous()
or not can_use_fused_causal_conv3d_cat_pad_cuda(x, cache_x, padding)
):
raise RuntimeError("unsupported input for causal Conv3D cat/pad CUDA")
return _causal_conv3d_cat_pad_custom_op(x, cache_x, *padding)
def can_use_fused_causal_conv3d_cat_pad_cuda(
x: torch.Tensor,
cache_x: torch.Tensor,
padding: list[int] | tuple[int, ...],
) -> bool:
if x.dtype not in _SUPPORTED_DTYPES:
return False
pad_w_left, pad_w_right, pad_h_top, pad_h_bottom, pad_d_left, pad_d_right = padding
cache_t = cache_x.shape[2]
depth_left = pad_d_left - cache_t
if depth_left < 0 or pad_d_right != 0:
return False
out_numel = (
x.shape[0]
* x.shape[1]View on GitHub (pinned to 0132848349)
Solutions
- Call .contiguous() on x and cache_x before invoking
- Verify x.dim() == 5 and both tensors are on CUDA
- Pre-check with can_use_fused_causal_conv3d_cat_pad_cuda(x, cache_x, padding) and use the fused_causal_conv3d_cat_pad dispatcher or eager fallback otherwise
- Adjust padding to a supported configuration
Example fix
# before y = fused_causal_conv3d_cat_pad_cuda(x[::1], cache, padding) # after x = x.contiguous(); cache = cache.contiguous() y = fused_causal_conv3d_cat_pad_cuda(x, cache, padding) if can_use_fused_causal_conv3d_cat_pad_cuda(x, cache, padding) else eager_path(x, cache, padding)
Defensive patterns
Strategy: validation
Validate before calling
from sglang.kernels.ops.diffusion.layout.causal_conv3d_cat_pad_jit import can_use_fused_causal_conv3d_cat_pad_cuda x = x.contiguous(); cache_x = cache_x.contiguous() assert x.is_cuda and x.dim() == 5 use_fused = can_use_fused_causal_conv3d_cat_pad_cuda(x, cache_x, padding)
Type guard
def usable(x, c, p) -> bool:
return x.is_cuda and c.is_cuda and x.dim() == 5 and c.dim() == 5 and x.is_contiguous() and c.is_contiguous() and can_use_fused_causal_conv3d_cat_pad_cuda(x, c, p) Prevention
- Always .contiguous() after slicing/permute
- Use the dispatcher fused_causal_conv3d_cat_pad which picks a working path
When it happens
Trigger: Calling fused_causal_conv3d_cat_pad_cuda with non-CUDA tensors, tensors whose dim() != 5, non-contiguous x or cache_x (e.g. sliced/permuted views), or padding values the fused kernel cannot handle (checked by can_use_fused_causal_conv3d_cat_pad_cuda).
Common situations: Passing a permuted/sliced activation from a prior layer without calling .contiguous(); running the diffusion pipeline with padding configs only the Triton/eager fallback supports; accidental CPU tensors in tests.
Related errors
- q must be contiguous
- kv must be contiguous
- unsupported dtype for causal Conv3D cat/pad: {x.dtype}
- unsupported input for usp_merge_heads CUDA
- unsupported input for modulate_scale_shift CUDA
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/1b6c468c3f230896.
Report an issue: GitHub.