[Mlir-commits] [mlir] [mlir][linalg] Retain Op Type of linalg ops in fuseWithReshapeByExpansion pattern (PR #129128)

Nirvedh Meshram llvmlistbot at llvm.org
Fri Feb 28 09:54:37 PST 2025


================
@@ -927,17 +927,43 @@ fuseWithReshapeByExpansion(LinalgOp linalgOp, Operation *reshapeOp,
       iteratorTypes[j] = type;
 
   TypeRange resultTypes = ValueRange(outputs).getTypes();
-  auto fusedOp =
-      rewriter.create<GenericOp>(linalgOp.getLoc(), resultTypes,
-                                 /*inputs=*/expandedOpOperands, outputs,
-                                 expandedOpIndexingMaps, iteratorTypes);
-  Region &fusedRegion = fusedOp->getRegion(0);
-  Region &originalRegion = linalgOp->getRegion(0);
-  rewriter.cloneRegionBefore(originalRegion, fusedRegion, fusedRegion.begin());
-
-  // Update the index accesses after the expansion.
-  updateExpandedGenericOpRegion(rewriter, loc, fusedRegion, expansionInfo);
-
+  Operation *fusedOp;
+
+  TypeSwitch<Operation *>(linalgOp.getOperation())
----------------
nirvedhmeshram wrote:

yes, does make sense to default to generic and be more prescriptive when we want to retain the named op, fixed. 

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


More information about the Mlir-commits mailing list