{"record":{"id":"f3301c1fe6c5fb3a","repo":"tracel-ai/burn","slug":"distributed-operations-are-not-supported-for-devic-f3301c","errorCode":null,"errorMessage":"Distributed operations are not supported for device {other:?}","messagePattern":"Distributed operations are not supported for device (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-dispatch/src/ops/distributed.rs","lineNumber":66,"sourceCode":"                    type B = $crate::backends::$Backend;\n                    let $inner_devices = $devices\n                        .iter()\n                        .map(|d| {\n                            // In a build with only one dispatch variant compiled in, the\n                            // pattern is irrefutable and the else clause is dead — which is\n                            // the point: it only guards the multi-backend builds.\n                            #[allow(irrefutable_let_patterns)]\n                            let DispatchDevice::$Backend(dev) = d else {\n                                unreachable!(\"All devices are expected to be of the same variant.\")\n                            };\n                            dev.clone()\n                        })\n                        .collect::<Vec<_>>();\n                    $body\n                }\n            )*\n            #[allow(unreachable_patterns)]\n            other => panic!(\"Distributed operations are not supported for device {other:?}\"),\n        }\n    };\n    (\n        @autodiff\n        $device:expr,\n        $devices:expr,\n        |$inner_devices:ident| $body:expr;\n        $([$Backend:ident, $cfg:meta]),*\n    ) => {\n        match $device {\n            $(\n                #[cfg($cfg)]\n                $crate::DispatchDevice::$Backend(_) => {\n                    type B = $crate::backends::Autodiff<$crate::backends::$Backend>;\n                    let $inner_devices = $devices\n                        .iter()\n                        .map(|d| {\n                            // In a build with only one dispatch variant compiled in, the","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-dispatch/src/ops/distributed.rs#L48-L84","documentation":"The `dispatch_distributed_device!` macro matches a DispatchDevice against the backends compiled into the dispatch layer. If the device variant does not correspond to any supported backend, it panics with 'Distributed operations are not supported for device {other:?}'.","triggerScenarios":"Invoking a distributed operation (all-reduce, all-gather, etc.) on a device whose DispatchDevice variant is not one of the enabled backend arms, e.g. a device for a backend feature that is not compiled in.","commonSituations":"Running distributed collectives with a backend feature flag missing at compile time; passing a device created under a different feature configuration.","solutions":["Enable the cargo feature for the backend owning the device (e.g. `wgpu`, `cuda`) before dispatching distributed ops","Pass a device created via the correct backend's `default_device()`","Verify the distributed operation supports the target backend"],"exampleFix":"// before\ncargo run --features autodiff        # backend feature missing\n// after\ncargo run --features autodiff,wgpu-spirv  # enable the backend feature for the device","handlingStrategy":"validation","validationCode":"// before dispatch: verify device backend is compiled in and supported\nfn ensure_supported(dev: &DispatchDevice) -> Result<(), String> {\n    matches!(dev, DispatchDevice::Cpu(_) | DispatchDevice::Wgpu(_)).then_some(()).ok_or(\"unsupported device\".into())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable the cargo feature for every backend/device you distribute over","Create devices from `B::default_device()` of a compiled-in backend","Check backend distributed support in docs before using collectives"],"tags":["rust","distributed","device","panic","burn"],"backgroundTag":"unsupported-device-backend","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"}