[Mlir-commits] [mlir] [mlir][Transform] Provide a minimal set of utils that allow implementing a simple transform dialect interpreter pass (PR #68330)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Thu Oct 5 10:50:14 PDT 2023


================
@@ -2079,18 +2079,19 @@ LogicalResult transform::detail::verifyTransformOpInterface(Operation *op) {
 // Entry point.
 //===----------------------------------------------------------------------===//
 
-LogicalResult
-transform::applyTransforms(Operation *payloadRoot,
-                           TransformOpInterface transform,
-                           const RaggedArray<MappedValue> &extraMapping,
-                           const TransformOptions &options) {
+LogicalResult transform::applyTransforms(
+    Operation *payloadRoot, TransformOpInterface transform,
+    const RaggedArray<MappedValue> &extraMapping,
+    const TransformOptions &options, bool enforceToplevelTransformOp) {
 #ifndef NDEBUG
-  if (!transform->hasTrait<PossibleTopLevelTransformOpTrait>() ||
-      transform->getNumOperands() != 0) {
-    transform->emitError()
-        << "expected transform to start at the top-level transform op";
-    llvm::report_fatal_error("could not run transforms",
-                             /*gen_crash_diag=*/false);
+  if (enforceToplevelTransformOp) {
----------------
ftynse wrote:

I suspect we may need a check that whatever is the `transform` operation, it has a region with the number of arguments (and their types) matching `payloadRoot` + `extraMapping` when the trait is not enforced.

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


More information about the Mlir-commits mailing list