[Mlir-commits] [mlir] 6ebeecf - [mlir][transform] ApplyConversionPatternsOp: Make conversion target optional

Matthias Springer llvmlistbot at llvm.org
Thu Aug 10 04:59:35 PDT 2023


Author: Matthias Springer
Date: 2023-08-10T13:53:25+02:00
New Revision: 6ebeecf452fb236af62346caaba88347fba6d54d

URL: https://github.com/llvm/llvm-project/commit/6ebeecf452fb236af62346caaba88347fba6d54d
DIFF: https://github.com/llvm/llvm-project/commit/6ebeecf452fb236af62346caaba88347fba6d54d.diff

LOG: [mlir][transform] ApplyConversionPatternsOp: Make conversion target optional

A conversion target is not needed. In a partial dialect conversion, ops are rewritten when possible. The dialect conversion succeeds if there are no illegal ops in the resulting IR.

Differential Revision: https://reviews.llvm.org/D157595

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
    mlir/lib/Dialect/Transform/IR/TransformOps.cpp
    mlir/test/Dialect/Transform/test-pattern-application.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
index e1a7a086fe8b94..c87fb557479265 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
@@ -187,8 +187,7 @@ def ApplyConversionPatternsOp : TransformDialectOp<"apply_conversion_patterns",
     default type converter specify their own type converter.)
 
     The `legal_ops`, `illegal_ops`, `legal_dialects`, `illegal_dialects`
-    attributes specify the conversion target. At least one of those four
-    attributes must be specified.
+    attributes specify the conversion target.
 
     This transform consumes the `target` handle and modifies the payload. It
     does not produce any handles.

diff  --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index fc64aef9681892..4547adc5920d9f 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -612,9 +612,6 @@ LogicalResult transform::ApplyConversionPatternsOp::verify() {
       }
     }
   }
-  if (!getLegalOps() && !getIllegalOps() && !getLegalDialects() &&
-      !getIllegalDialects())
-    return emitOpError() << "conversion target is not specified";
   return success();
 }
 

diff  --git a/mlir/test/Dialect/Transform/test-pattern-application.mlir b/mlir/test/Dialect/Transform/test-pattern-application.mlir
index 2a45c9c4182db0..efbdab78d397fa 100644
--- a/mlir/test/Dialect/Transform/test-pattern-application.mlir
+++ b/mlir/test/Dialect/Transform/test-pattern-application.mlir
@@ -307,19 +307,6 @@ transform.sequence failures(propagate) {
 
 // -----
 
-transform.sequence failures(propagate) {
-^bb1(%arg1: !transform.any_op):
-  %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op
-  // expected-error @below{{conversion target is not specified}}
-  transform.apply_conversion_patterns to %0 {
-    transform.apply_conversion_patterns.transform.test_conversion_patterns
-  } with type_converter {
-    transform.apply_conversion_patterns.transform.test_type_converter
-  } : !transform.any_op
-}
-
-// -----
-
 transform.sequence failures(propagate) {
 ^bb1(%arg1: !transform.any_op):
   %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op


        


More information about the Mlir-commits mailing list