[Mlir-commits] [mlir] [mlir][linalg] Canonicalize non-identity `linalg.generic` ops (PR #101430)

Han-Chung Wang llvmlistbot at llvm.org
Thu Aug 1 10:20:29 PDT 2024


================
@@ -1217,9 +1217,8 @@ struct EraseIdentityLinalgOp : public OpRewritePattern<OpTy> {
 
   LogicalResult matchAndRewrite(OpTy linalgOp,
                                 PatternRewriter &rewriter) const override {
-    // Check all indexing maps are identity.
-    if (llvm::any_of(linalgOp.getIndexingMapsArray(),
-                     [](AffineMap map) { return !map.isIdentity(); }))
+    // All indexing maps must be equal. It follows that they are permutations.
+    if (!llvm::all_equal(linalgOp.getIndexingMapsArray()))
----------------
hanhanW wrote:

It is hard to provide an example now, but people could generate uncommon linalg ops.

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


More information about the Mlir-commits mailing list