{"record":{"id":"48d040d55ae563eb","repo":"tracel-ai/burn","slug":"rfft-kernel-launch-failed-device-input-device","errorCode":null,"errorMessage":"rfft kernel launch failed (device={input_device:?}, dtype={input_dtype:?}, dim={dim}, requested_n={requested_n}, fft_size={fft_size}): {e}","messagePattern":"rfft kernel launch failed \\(device=(.+?), dtype=(.+?), dim=(.+?), requested_n=(.+?), fft_size=(.+?)\\): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-cubecl/src/kernel/fft/base.rs","lineNumber":82,"sourceCode":"        signal.dtype,\n    );\n    let output_im = empty_device_dtype(\n        signal.client.clone(),\n        signal.device.clone(),\n        output_shape.clone(),\n        signal.dtype,\n    );\n\n    rfft_launch(\n        &signal.client.clone(),\n        signal.binding(),\n        output_re.clone().binding(),\n        output_im.clone().binding(),\n        dim,\n        dtype,\n    )\n    .unwrap_or_else(|e| {\n        panic!(\n            \"rfft kernel launch failed (device={input_device:?}, dtype={input_dtype:?}, \\\n             dim={dim}, requested_n={requested_n}, fft_size={fft_size}): {e}\"\n        )\n    });\n\n    (output_re, output_im)\n}\n\n/// Launch the irfft kernel with optional padding for non-power-of-two sizes.\npub fn irfft(\n    spectrum_re: CubeTensor,\n    spectrum_im: CubeTensor,\n    dim: usize,\n    n: Option<usize>,\n) -> CubeTensor {\n    assert!(\n        spectrum_re.shape() == spectrum_im.shape(),\n        \"irfft: spectrum_re and spectrum_im shapes must match\"","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-cubecl/src/kernel/fft/base.rs#L64-L100","documentation":"The rfft kernel launch itself returned an error (e.g. kernel compilation failure, out-of-memory, invalid launch configuration); the wrapper panics with a diagnostic message containing device, dtype, dim, requested_n, and fft_size to aid debugging.","triggerScenarios":"GPU kernel launch failure inside `rfft`: unsupported/failed kernel compilation on the backend, insufficient memory for the pow2-padded FFT buffer, or a device/runtime error from the compute backend.","commonSituations":"Very large `n` values exhausting GPU memory after power-of-two padding; experimental/unstable backends lacking the FFT kernel; driver/runtime issues on the target device.","solutions":["Read the wrapped error `e` in the panic message for the root cause","Reduce `n`/input size or chunk the signal to fit in GPU memory","Verify the backend (wgpu/cuda) supports the FFT kernels and update burn/cubecl","Run on a different device to rule out driver issues"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// estimate padded buffer size before calling\nlet n = n.unwrap_or(signal.shape()[dim]);\nlet fft_size = n.next_power_of_two();\nlet elems = signal.shape().iter().product::<usize>() / signal.shape()[dim] * fft_size;\nassert!(elems * 4 < free_gpu_memory_hint(), \"FFT buffer may exceed GPU memory\");","typeGuard":null,"tryCatchPattern":"// panic-based API; isolate and fall back:\nlet result = std::panic::catch_unwind(|| tensor.clone().rfft(dim, n));\nmatch result {\n    Ok((re, im)) => { /* use outputs */ },\n    Err(_) => { /* retry on CPU backend or with smaller n */ }\n}","preventionTips":["Keep n modest or chunk long signals to bound memory","Keep GPU drivers and burn/cubecl updated","Test FFT on the target backend early in development","Use device with sufficient free memory for pow2-padded buffers"],"tags":["gpu","fft","kernel-launch","cuda","wgpu"],"backgroundTag":"gpu-kernel-launch-failed","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}