{"record":{"id":"2088da43f182b4e9","repo":"tracel-ai/burn","slug":"0-kernel-failed-device-1-dtype-2-3","errorCode":null,"errorMessage":"{0} kernel failed (device={1:?}, dtype={2:?}): {3}","messagePattern":"(.+?) kernel failed \\(device=(.+?), dtype=(.+?)\\): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-cubecl/src/kernel/pool/base.rs","lineNumber":385,"sourceCode":"    );\n\n    let mode = PoolMode::from(AdaptiveAvgPoolOptions::new([out_h, out_w]));\n\n    pool2d_backward(\n        &output.client,\n        input.clone().binding(),\n        out_grad.clone().binding(),\n        output.clone().binding(),\n        mode,\n        dtype_to_storage_type(output.dtype),\n    )\n    .unwrap_or_else(|e| pool_panic(\"adaptive_avg_pool2d_backward\", &input, e));\n\n    permute_nhwc_to_nchw(output)\n}\n\nfn pool_panic(label: &str, input: &CubeTensor, error: PoolError) -> ! {\n    panic!(\n        \"{0} kernel failed (device={1:?}, dtype={2:?}): {3}\",\n        label, input.device, input.dtype, error\n    )\n}\n","sourceCodeStart":367,"sourceCodeEnd":390,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-cubecl/src/kernel/pool/base.rs#L367-L390","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet out = max_pool2d(x, [3, 3], [0, 0], [1, 1]); // window larger than 2x2 input\n// after: pad or shrink the kernel to fit the input\nlet out = max_pool2d(x, [2, 2], [0, 0], [1, 1]);","handlingStrategy":"validation","validationCode":"assert!(stride.iter().all(|&s| s > 0), \"pool stride must be > 0\");\nlet padded = (h + 2 * pad).ge(&kernel[0]);\nassert!(padded, \"pool kernel larger than (padded) input\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["gpu","pooling","kernel-launch","burn"],"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"}