{"record":{"id":"4878fa0df5204e3b","repo":"tracel-ai/burn","slug":"invalid-concreate-ref-layout","errorCode":null,"errorMessage":"Invalid concreate ref layout","messagePattern":"Invalid concreate ref layout","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-cubecl-fusion/src/optim/elemwise/optimization.rs","lineNumber":96,"sourceCode":"pub struct ElemwiseRunner;\n\nimpl Vectorization for ElemwiseRunner {}\nimpl TraceRunner for ElemwiseRunner {\n    type Error = LaunchError; // No error possible\n\n    fn run<'a>(\n        &'a self,\n        client: &'a Client,\n        inputs: GlobalArgsLaunch,\n        outputs: GlobalArgsLaunch,\n        configs: &[FuseBlockConfig],\n    ) -> Result<(), Self::Error> {\n        let config = &configs[0];\n        let shape = match &config.ref_layout {\n            RefLayout::Concrete(arg) => match arg {\n                FuseArg::Input(..) => inputs.shape_ref(&config.ref_layout, config.rank),\n                FuseArg::Output(..) => outputs.shape_ref(&config.ref_layout, config.rank),\n                _ => panic!(\"Invalid concreate ref layout\"),\n            },\n            RefLayout::Virtual(_) => inputs.shape_ref(&config.ref_layout, config.rank),\n        };\n        let working_units = shape.iter().product::<usize>() / config.width;\n        let cube_dim = CubeDim::new(client, working_units);\n        let cube_count = calculate_cube_count_elemwise(client, working_units, cube_dim);\n        let address_type = inputs\n            .required_address_type()\n            .max(outputs.required_address_type());\n\n        unsafe {\n            elemwise_fuse::launch_unchecked(\n                client,\n                cube_count,\n                cube_dim,\n                address_type,\n                inputs,\n                outputs,","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-cubecl-fusion/src/optim/elemwise/optimization.rs#L78-L114","documentation":"This panic fires in the elementwise fusion optimization's `run` when it resolves the shape for the fused kernel launch. `RefLayout::Concrete` must point at a `FuseArg::Input` or `FuseArg::Output`; any other FuseArg variant (e.g. a local/constant arg) reaching a Concrete ref layout is an internal invariant violation of the fusion optimizer.","triggerScenarios":"Running a fused elementwise kernel whose `RefLayout::Concrete` wraps a FuseArg variant other than Input or Output — i.e. a bug in optimization construction, not in user code.","commonSituations":"Custom fusion optimization providers built against burn-cubecl-fusion internals; serialized/restored fusion states produced by a different burn version whose FuseArg enum changed.","solutions":["Check which code constructs the RefLayout::Concrete and ensure it only ever wraps FuseArg::Input or FuseArg::Output","If using a custom fusion provider, audit your optimization's ref_layout construction","Update burn and burn-cubecl-fusion together; this is likely an internal bug — file an issue with the fusion config"],"exampleFix":"// before\nRefLayout::Concrete(FuseArg::Scalar(..)) // invalid\n// after\nRefLayout::Concrete(FuseArg::Input(pos, ..)) // or FuseArg::Output(pos, ..)","handlingStrategy":"validation","validationCode":"if let RefLayout::Concrete(FuseArg::Input(_) | FuseArg::Output(_)) = &config.ref_layout {\n    // safe to run\n} else {\n    // reject or rebuild the optimization config\n}","typeGuard":"fn is_concrete_input_or_output(l: &RefLayout) -> bool {\n    matches!(l, RefLayout::Concrete(FuseArg::Input(..) | FuseArg::Output(..)) | RefLayout::Virtual(_))\n}","tryCatchPattern":null,"preventionTips":["Only build RefLayout::Concrete from Input or Output args","Add constructor helpers that make invalid FuseArg variants unrepresentable","Keep all burn crate versions in lockstep"],"tags":["fusion","gpu","internal-invariant","burn"],"backgroundTag":"invalid-fusion-ref-layout","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"}