[Mlir-commits] [mlir] 3964d94 - [mlir] transform.structured.match fix tilingIface condition (#65337)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 5 09:02:37 PDT 2023


Author: Oleksandr "Alex" Zinenko
Date: 2023-09-05T18:02:33+02:00
New Revision: 3964d943ece15093f5e1691c98b2631389f586ce

URL: https://github.com/llvm/llvm-project/commit/3964d943ece15093f5e1691c98b2631389f586ce
DIFF: https://github.com/llvm/llvm-project/commit/3964d943ece15093f5e1691c98b2631389f586ce.diff

LOG: [mlir] transform.structured.match fix tilingIface condition (#65337)

The matching condition for payload ops implementing TilingInterface was
inverted. Fix it and add a test.

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    mlir/test/Dialect/Linalg/transform-op-match.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 81ca4286e9b6bb..3421a3c169dbba 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -1145,7 +1145,7 @@ transform::MatchOp::apply(transform::TransformRewriter &rewriter,
           !isa<LinalgOp>(op))
         return;
       if (iface == transform::MatchInterfaceEnum::TilingInterface &&
-          isa<TilingInterface>(op))
+          !isa<TilingInterface>(op))
         return;
       if (iface == transform::MatchInterfaceEnum::LoopLikeInterface &&
           !isa<LoopLikeOpInterface>(op))

diff  --git a/mlir/test/Dialect/Linalg/transform-op-match.mlir b/mlir/test/Dialect/Linalg/transform-op-match.mlir
index cbc5504a66fc61..9db63dc0696dab 100644
--- a/mlir/test/Dialect/Linalg/transform-op-match.mlir
+++ b/mlir/test/Dialect/Linalg/transform-op-match.mlir
@@ -39,6 +39,24 @@ transform.sequence failures(propagate) {
 
 // -----
 
+func.func @foo(%a: tensor<4x4xf32>, %b: tensor<4x4xf32>, %c: tensor<4x4xf32>) {
+  %c0 = arith.constant 0.0 : f32
+  // expected-remark @below {{tileable}}
+  %r = linalg.fill ins(%c0 : f32) outs(%c : tensor<4x4xf32>) -> tensor<4x4xf32>
+  // expected-remark @below {{tileable}}
+  linalg.matmul ins(%a, %b : tensor<4x4xf32>, tensor<4x4xf32>) outs(%r : tensor<4x4xf32>) -> tensor<4x4xf32>
+  return
+}
+
+transform.sequence failures(propagate) {
+^bb0(%arg0: !transform.any_op):
+  %matched = transform.structured.match interface{TilingInterface} in %arg0 : (!transform.any_op) -> !transform.any_op
+  transform.test_print_remark_at_operand %matched, "tileable" : !transform.any_op
+  transform.yield
+}
+
+// -----
+
 #map0 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
 #map1 = affine_map<(d0, d1, d2) -> (d1, d0, d2)>
 func.func @match_complex_attribute(%arg0: tensor<12x128x32xf32>)


        


More information about the Mlir-commits mailing list