[Mlir-commits] [mlir] [mlir][Transform] Provide a minimal set of utils that allow implementing a simple transform dialect interpreter pass (PR #68330)
Nicolas Vasilache
llvmlistbot at llvm.org
Fri Oct 6 02:21:43 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) {
----------------
nicolasvasilache wrote:
Calling `detail::verifyPossibleTopLevelTransformOpTrait` directly provides part of this in the absence of an op actually subscribing to `PossibleTopLevelTransformOpTrait`.
The extra mappings part is only used in the TransformState.
In the future, we may want to reconsider the top-level trait altogether.
https://github.com/llvm/llvm-project/pull/68330
More information about the Mlir-commits
mailing list