[Mlir-commits] [mlir] [mlir][spirv][gpu] Add lowering for gpu.subgroup_broadcast (PR #187947)

Igor Wodiany llvmlistbot at llvm.org
Mon Mar 23 02:36:37 PDT 2026


================
@@ -542,6 +554,32 @@ LogicalResult GPURotateConversion::matchAndRewrite(
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// Subgroup broadcast
+//===----------------------------------------------------------------------===//
+
+LogicalResult GPUSubgroupBroadcastConversion::matchAndRewrite(
+    gpu::SubgroupBroadcastOp op, OpAdaptor adaptor,
+    ConversionPatternRewriter &rewriter) const {
+  Location loc = op.getLoc();
+  auto scope = rewriter.getAttr<spirv::ScopeAttr>(spirv::Scope::Subgroup);
+  Value result;
+
+  switch (op.getBroadcastType()) {
----------------
IgWod wrote:

Is is possible for the op to have neither of specified types? If so we should add a default that returns with a failure. Otherwise I would suggest we still add a default but just stick `llvm_unreachable(...)` in there just in case.

https://github.com/llvm/llvm-project/pull/187947


More information about the Mlir-commits mailing list