[Mlir-commits] [mlir] 8d7e90c - [mlir] drop debug tags after TransformInterpreterPassBase
Alex Zinenko
llvmlistbot at llvm.org
Wed May 31 02:15:08 PDT 2023
Author: Alex Zinenko
Date: 2023-05-31T09:14:59Z
New Revision: 8d7e90c3b5d22e31c6af25c2f95b8047038590c4
URL: https://github.com/llvm/llvm-project/commit/8d7e90c3b5d22e31c6af25c2f95b8047038590c4
DIFF: https://github.com/llvm/llvm-project/commit/8d7e90c3b5d22e31c6af25c2f95b8047038590c4.diff
LOG: [mlir] drop debug tags after TransformInterpreterPassBase
The pass attaches attributes to operations for repro generation
purposes, but never removes them. This is not desirable when the pass
actually succeeds.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D151791
Added:
mlir/test/Dialect/Transform/test-repro-dump.mlir
Modified:
mlir/lib/Dialect/Transform/Transforms/TransformInterpreterPassBase.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterPassBase.cpp b/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterPassBase.cpp
index 1f651dcce115a..9dc91612fa434 100644
--- a/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterPassBase.cpp
+++ b/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterPassBase.cpp
@@ -294,6 +294,12 @@ static void performOptionalDebugActions(
debugPayloadRootTag, debugTransformRootTag,
transformLibraryFileName, binaryName);
});
+
+ // Remove temporary attributes if they were set.
+ if (debugPayloadRootTag.empty())
+ target->removeAttr(kTransformDialectTagAttrName);
+ if (debugTransformRootTag.empty())
+ transform->removeAttr(kTransformDialectTagAttrName);
}
/// Replaces external symbols in `block` with their (non-external) definitions
diff --git a/mlir/test/Dialect/Transform/test-repro-dump.mlir b/mlir/test/Dialect/Transform/test-repro-dump.mlir
new file mode 100644
index 0000000000000..036cfec9000b6
--- /dev/null
+++ b/mlir/test/Dialect/Transform/test-repro-dump.mlir
@@ -0,0 +1,31 @@
+// RUN: mlir-opt %s --test-transform-dialect-interpreter \
+// RUN: --mlir-disable-threading \
+// RUN: --debug-only=transform-dialect-dump-repro 2>&1 \
+// RUN: | FileCheck %s
+
+module {
+ transform.sequence failures(propagate) {
+ ^bb0(%arg0: !transform.any_op):
+ transform.test_print_remark_at_operand %arg0, "remark" : !transform.any_op
+ }
+}
+
+// Verify that the repro string is dumped.
+
+// CHECK: Transform Interpreter Repro
+// CHECK: cat <<EOF | mlir-opt --pass-pipeline="builtin.module(test-transform-dialect-interpreter{debug-payload-root-tag=payload_root debug-transform-root-tag=transform_container})"
+
+// Verify that the IR is dumped with tags.
+
+// CHECK: module
+// CHECK-SAME: transform.target_tag = "payload_root"
+// CHECK: transform.sequence
+// CHECK-SAME: transform.target_tag = "transform_container"
+// CHECK: EOF
+
+// Verify that the actual IR after the pass doesn't have the tags.
+
+// CHECK: module
+// CHECK-NOT: transform.target_tag = "payload_root"
+// CHECK: transform.sequence
+// CHECK-NOT: transform.target_tag = "transform_container"
More information about the Mlir-commits
mailing list