tracel-ai/burn · error
{0} kernel failed (device={1:?}, dtype={2:?}): {3}
Error message
{0} kernel failed (device={1:?}, dtype={2:?}): {3} What it means
pool_panic is the shared fatal-error handler for all pooling kernels (max/avg pool, adaptive avg pool, and their backward passes) on the CubeCL backend. When the pool kernel launch returns a PoolError, it panics with the operation label, input device, dtype, and the error. One panic site covers six public pool operations.
Source
Thrown at crates/burn-cubecl/src/kernel/pool/base.rs:385
);
let mode = PoolMode::from(AdaptiveAvgPoolOptions::new([out_h, out_w]));
pool2d_backward(
&output.client,
input.clone().binding(),
out_grad.clone().binding(),
output.clone().binding(),
mode,
dtype_to_storage_type(output.dtype),
)
.unwrap_or_else(|e| pool_panic("adaptive_avg_pool2d_backward", &input, e));
permute_nhwc_to_nchw(output)
}
fn pool_panic(label: &str, input: &CubeTensor, error: PoolError) -> ! {
panic!(
"{0} kernel failed (device={1:?}, dtype={2:?}): {3}",
label, input.device, input.dtype, error
)
}
View on GitHub (pinned to d16f7ba2ed)
Solutions
- Read the PoolError and the label to identify which pool op failed
- Validate kernel_size/stride/padding: stride > 0 and window not exceeding padded input size
- Ensure input is a valid NCHW tensor with the expected dtype on a supported device
- For backward errors, confirm the output_grad shape equals the forward output shape
Example fix
// before let out = max_pool2d(x, [3, 3], [0, 0], [1, 1]); // window larger than 2x2 input // after: pad or shrink the kernel to fit the input let out = max_pool2d(x, [2, 2], [0, 0], [1, 1]);
Defensive patterns
Strategy: validation
Validate before calling
assert!(stride.iter().all(|&s| s > 0), "pool stride must be > 0"); let padded = (h + 2 * pad).ge(&kernel[0]); assert!(padded, "pool kernel larger than (padded) input");
Prevention
- Validate kernel_size/stride/padding against input spatial dims before pooling
- Use a single config struct for pool hyperparameters so they're checked once
- Confirm grad shapes match forward outputs for pool backward ops
When it happens
Trigger: Calling max_pool2d, avg_pool2d, adaptive_avg_pool2d (or their _backward/_with_indices variants) with kernel_size/stride/padding combinations that produce invalid output shapes, unsupported dtypes/devices, or malformed input channel layout.
Common situations: Pool window larger than the input spatial dims, stride 0, channel-first vs NHWC confusion after permute, f16 pooling on hardware lacking support, or backward grads with mismatched shapes.
Related errors
- irfft kernel launch failed (device={input_device:?}, dtype={
- interpolate_backward kernel failed (device={0:?}, dtype={1:?
- Not a valid DType for tensors.
- Invalid concreate ref layout
- rfft kernel launch failed (device={input_device:?}, dtype={i
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/2088da43f182b4e9.
Report an issue: GitHub.