[Mlir-commits] [mlir] [mlir][linalg] Enable CollapseLinalgDimensions to collapse linalg::CopyOp (PR #68526)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 17 12:54:36 PDT 2023


================
@@ -1434,27 +1441,43 @@ void generateCollapsedIndexingRegion(Location loc, Block *block,
 }
 
 /// Implementation of fusion with reshape operation by collapsing dimensions.
-FailureOr<SmallVector<Value>> mlir::linalg::collapseGenericOpIterationDims(
-    GenericOp genericOp, ArrayRef<ReassociationIndices> foldedIterationDims,
+template <typename LinalgType>
+FailureOr<SmallVector<Value>> mlir::linalg::collapseOpIterationDims(
+    LinalgType op, ArrayRef<ReassociationIndices> foldedIterationDims,
     RewriterBase &rewriter) {
+  static_assert(llvm::is_one_of<LinalgType, GenericOp, CopyOp>::value,
----------------
MaheshRavishankar wrote:

echoing above. `static_asserts` make it harder to deploy. This is an optimization. Return failure with error message allows caller to handle things appropraitely.

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


More information about the Mlir-commits mailing list