{"record":{"id":"13f752eb1424a2ab","repo":"gfx-rs/wgpu","slug":"not-implemented-13f752","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"naga/src/back/wgsl/writer.rs","lineNumber":1146,"sourceCode":"                    (crate::CollectiveOperation::Reduce, crate::SubgroupOperation::Or) => {\n                        write!(self.out, \"subgroupOr(\")?\n                    }\n                    (crate::CollectiveOperation::Reduce, crate::SubgroupOperation::Xor) => {\n                        write!(self.out, \"subgroupXor(\")?\n                    }\n                    (crate::CollectiveOperation::ExclusiveScan, crate::SubgroupOperation::Add) => {\n                        write!(self.out, \"subgroupExclusiveAdd(\")?\n                    }\n                    (crate::CollectiveOperation::ExclusiveScan, crate::SubgroupOperation::Mul) => {\n                        write!(self.out, \"subgroupExclusiveMul(\")?\n                    }\n                    (crate::CollectiveOperation::InclusiveScan, crate::SubgroupOperation::Add) => {\n                        write!(self.out, \"subgroupInclusiveAdd(\")?\n                    }\n                    (crate::CollectiveOperation::InclusiveScan, crate::SubgroupOperation::Mul) => {\n                        write!(self.out, \"subgroupInclusiveMul(\")?\n                    }\n                    _ => unimplemented!(),\n                }\n                self.write_expr(module, argument, func_ctx)?;\n                writeln!(self.out, \");\")?;\n            }\n            Statement::SubgroupGather {\n                mode,\n                argument,\n                result,\n            } => {\n                write!(self.out, \"{level}\")?;\n                let res_name = Baked(result).to_string();\n                self.start_named_expr(module, result, func_ctx, &res_name)?;\n                self.named_expressions.insert(result, res_name);\n\n                match mode {\n                    crate::GatherMode::BroadcastFirst => {\n                        write!(self.out, \"subgroupBroadcastFirst(\")?;\n                    }","sourceCodeStart":1128,"sourceCodeEnd":1164,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/naga/src/back/wgsl/writer.rs#L1128-L1164","documentation":"The WGSL backend of naga cannot express every combination of SubgroupOperation and CollectiveOperation when lowering naga IR subgroup statements to WGSL builtins. Unhandled combinations (e.g. exclusive scans or operations like Max/Min/And/Or/Xor for some scan modes) fall through to an unimplemented!() panic in write_stmt.","triggerScenarios":"Translating a naga module containing Statement::SubgroupCollectiveOperation (or equivalent) whose (CollectiveOperation, SubgroupOperation) pair is not one of the explicitly handled cases (e.g. ExclusiveScan Add, InclusiveScan Mul is handled, others like Max/Min scans are not) to WGSL.","commonSituations":"Round-tripping shaders with advanced subgroup compute patterns (scans/reductions) through naga into WGSL; using IR generated from SPIR-V with subgroup ops beyond the supported mapping.","solutions":["Rewrite the shader to use only subgroup operations the WGSL backend supports (e.g. subgroupAdd, subgroupInclusiveAdd)","Patch naga's write_stmt to map the missing pair to the appropriate wgsl builtin if the target WGSL environment supports it","Avoid the WGSL backend for shaders using exotic subgroup scans; target SPIR-V/MSL/HLSL backends instead","Check the WGSL spec/subgroup extensions for which builtins exist and constrain shader authoring accordingly"],"exampleFix":"// before (IR): CollectiveOperation::ExclusiveScan + SubgroupOperation::Add -> unimplemented!()\n// after: express the exclusive scan with inclusiveAdd on a shuffled value\n// let excl = subgroupShuffleUp(value, 1); let scanned = subgroupInclusiveAdd(excl);","handlingStrategy":"validation","validationCode":"fn uses_unhandled_subgroup_pair(module: &naga::Module) -> bool {\n    // reject exclusive scans / non-Add-Mul scan combos before WGSL export\n    module.global_expressions.is_empty() && false // placeholder: walk statements for SubgroupCollectiveOperation pairs\n}","typeGuard":null,"tryCatchPattern":"// writer panics rather than returning Err; scan the module statements first:\nif uses_unhandled_subgroup_pair(&module) { /* rewrite shader or pick spv backend */ }","preventionTips":["Restrict shader subgroup usage to subgroupAdd/inclusiveAdd and similar builtins the WGSL backend supports","Prefer SPIR-V output for shaders with advanced subgroup scans","Keep naga updated for new subgroup mappings"],"tags":["naga","wgsl","subgroups","unimplemented"],"backgroundTag":"unimplemented-feature-panic","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}