[Mlir-commits] [mlir] [mlir] use transform-interpreter in test passes (PR #70040)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 24 05:59:25 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-gpu
Author: Oleksandr "Alex" Zinenko (ftynse)
<details>
<summary>Changes</summary>
Update most test passes to use the transform-interpreter pass instead of the test-transform-dialect-interpreter-pass. The new "main" interpreter pass has a named entry point instead of looking up the top-level op with `PossibleTopLevelOpTrait`, which is arguably a more understandable interface. The change is mechanical, rewriting an unnamed sequence into a named one and wrapping the transform IR in to a module when necessary.
Add an option to the transform-interpreter pass to target a tagged payload op instead of the root anchor op, which is also useful for repro generation.
Only the test in the transform dialect proper and the examples have not been updated yet. These will be updated separately after a more careful consideration of testing coverage of the transform interpreter logic.
---
Patch is 702.50 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/70040.diff
107 Files Affected:
- (modified) mlir/include/mlir/Dialect/Transform/Transforms/Passes.td (+8)
- (modified) mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h (+12-15)
- (modified) mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp (+47-2)
- (modified) mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp (+2-10)
- (modified) mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir (+17-14)
- (modified) mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir (+19-17)
- (modified) mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm-32b.mlir (+29-27)
- (modified) mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir (+37-35)
- (modified) mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir (+13-11)
- (modified) mlir/test/Dialect/Affine/transform-op-simplify-bounded-affine-ops.mlir (+30-22)
- (modified) mlir/test/Dialect/Bufferization/Transforms/transform-ops.mlir (+55-37)
- (modified) mlir/test/Dialect/GPU/barrier-elimination.mlir (+9-7)
- (modified) mlir/test/Dialect/GPU/subgroup-mma-vector-unroll.mlir (+17-11)
- (modified) mlir/test/Dialect/GPU/transform-gpu-failing.mlir (+126-92)
- (modified) mlir/test/Dialect/GPU/transform-gpu.mlir (+98-70)
- (modified) mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir (+5-3)
- (modified) mlir/test/Dialect/LLVM/transform-e2e.mlir (+26-24)
- (modified) mlir/test/Dialect/Linalg/convert-conv2d-to-img2col.mlir (+74-54)
- (modified) mlir/test/Dialect/Linalg/generalize-tensor-pack-tile.mlir (+19-13)
- (modified) mlir/test/Dialect/Linalg/generalize-tensor-unpack-tile.mlir (+13-7)
- (modified) mlir/test/Dialect/Linalg/hoisting.mlir (+129-97)
- (modified) mlir/test/Dialect/Linalg/match-ops-interpreter.mlir (+24-33)
- (modified) mlir/test/Dialect/Linalg/matmul-shared-memory-padding.mlir (+146-142)
- (modified) mlir/test/Dialect/Linalg/multisize-tiling-full.mlir (+32-28)
- (modified) mlir/test/Dialect/Linalg/one-shot-bufferize-empty-tensor-elimination.mlir (+10-8)
- (modified) mlir/test/Dialect/Linalg/pad-to-specific-memory-space.mlir (+29-25)
- (modified) mlir/test/Dialect/Linalg/promote.mlir (+39-27)
- (modified) mlir/test/Dialect/Linalg/promotion_options.mlir (+8-6)
- (modified) mlir/test/Dialect/Linalg/tile-conv.mlir (+5-3)
- (modified) mlir/test/Dialect/Linalg/tile-indexed.mlir (+13-9)
- (modified) mlir/test/Dialect/Linalg/tile-softmax.mlir (+21-15)
- (modified) mlir/test/Dialect/Linalg/tile-tensors.mlir (+13-7)
- (modified) mlir/test/Dialect/Linalg/tile-to-forall.mlir (+80-58)
- (modified) mlir/test/Dialect/Linalg/transform-lower-pack.mlir (+114-88)
- (modified) mlir/test/Dialect/Linalg/transform-op-bufferize-to-allocation.mlir (+96-76)
- (modified) mlir/test/Dialect/Linalg/transform-op-compose-masked-vectorize-and-cleanups.mlir (+24-22)
- (modified) mlir/test/Dialect/Linalg/transform-op-decompose.mlir (+9-7)
- (modified) mlir/test/Dialect/Linalg/transform-op-fuse-into-containing.mlir (+121-97)
- (modified) mlir/test/Dialect/Linalg/transform-op-fuse.mlir (+46-34)
- (modified) mlir/test/Dialect/Linalg/transform-op-generalize.mlir (+7-5)
- (modified) mlir/test/Dialect/Linalg/transform-op-gpu-map-copy-to-threads.mlir (+189-153)
- (modified) mlir/test/Dialect/Linalg/transform-op-hoist-pad-build-packing-loop-nest.mlir (+81-71)
- (modified) mlir/test/Dialect/Linalg/transform-op-hoist-pad.mlir (+87-77)
- (modified) mlir/test/Dialect/Linalg/transform-op-insert-slice-to-copy.mlir (+46-38)
- (modified) mlir/test/Dialect/Linalg/transform-op-interchange.mlir (+21-16)
- (modified) mlir/test/Dialect/Linalg/transform-op-match.mlir (+53-45)
- (modified) mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir (+11-9)
- (modified) mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir (+35-27)
- (modified) mlir/test/Dialect/Linalg/transform-op-pack.mlir (+229-189)
- (modified) mlir/test/Dialect/Linalg/transform-op-pad.mlir (+88-72)
- (modified) mlir/test/Dialect/Linalg/transform-op-replace.mlir (+30-24)
- (modified) mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir (+65-49)
- (modified) mlir/test/Dialect/Linalg/transform-op-scalarize.mlir (+8-6)
- (modified) mlir/test/Dialect/Linalg/transform-op-split-reduction-by-scaling.mlir (+9-7)
- (modified) mlir/test/Dialect/Linalg/transform-op-split-reduction.mlir (+57-41)
- (modified) mlir/test/Dialect/Linalg/transform-op-split.mlir (+71-51)
- (modified) mlir/test/Dialect/Linalg/transform-op-tile.mlir (+63-47)
- (modified) mlir/test/Dialect/Linalg/transform-op-vectorize.mlir (+43-31)
- (modified) mlir/test/Dialect/Linalg/transform-pack-greedily.mlir (+110-90)
- (modified) mlir/test/Dialect/Linalg/transform-patterns.mlir (+42-30)
- (modified) mlir/test/Dialect/Linalg/transform-promotion.mlir (+22-23)
- (modified) mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir (+28-24)
- (modified) mlir/test/Dialect/Linalg/transform-tile-reduction.mlir (+76-58)
- (modified) mlir/test/Dialect/Linalg/vectorization-scalable.mlir (+25-17)
- (modified) mlir/test/Dialect/Linalg/vectorization-with-patterns.mlir (+394-282)
- (modified) mlir/test/Dialect/Linalg/vectorization.mlir (+93-63)
- (modified) mlir/test/Dialect/Linalg/vectorize-tensor-extract-masked.mlir (+41-29)
- (modified) mlir/test/Dialect/Linalg/vectorize-tensor-extract.mlir (+101-75)
- (modified) mlir/test/Dialect/MemRef/alloc-to-alloca.mlir (+18-16)
- (modified) mlir/test/Dialect/MemRef/extract-address-computations.mlir (+99-75)
- (modified) mlir/test/Dialect/MemRef/make-loop-independent.mlir (+13-9)
- (modified) mlir/test/Dialect/MemRef/transform-ops.mlir (+85-63)
- (modified) mlir/test/Dialect/NVGPU/tmaload-transform.mlir (+17-15)
- (modified) mlir/test/Dialect/NVGPU/transform-create-async-groups.mlir (+53-39)
- (modified) mlir/test/Dialect/NVGPU/transform-matmul-to-nvvm.mlir (+21-17)
- (modified) mlir/test/Dialect/NVGPU/transform-pipeline-shared.mlir (+27-19)
- (modified) mlir/test/Dialect/SCF/transform-loop-fuse-sibling.mlir (+37-29)
- (modified) mlir/test/Dialect/SCF/transform-op-coalesce.mlir (+23-17)
- (modified) mlir/test/Dialect/SCF/transform-op-forall-to-for.mlir (+28-20)
- (modified) mlir/test/Dialect/SCF/transform-op-take-assumed-branch.mlir (+36-30)
- (modified) mlir/test/Dialect/SCF/transform-ops-invalid.mlir (+32-24)
- (modified) mlir/test/Dialect/SCF/transform-ops.mlir (+105-81)
- (modified) mlir/test/Dialect/SparseTensor/transform-ops.mlir (+3-3)
- (modified) mlir/test/Dialect/Tensor/fold-empty-op.mlir (+16-12)
- (modified) mlir/test/Dialect/Tensor/fold-tensor-subset-ops-into-vector-transfers.mlir (+8-6)
- (modified) mlir/test/Dialect/Tensor/rewrite-as-constant.mlir (+8-6)
- (modified) mlir/test/Dialect/Tensor/tiling.mlir (+103-69)
- (modified) mlir/test/Dialect/Tensor/transform-op-make-loop-independent.mlir (+32-22)
- (modified) mlir/test/Dialect/Vector/transform-op-vector-to-llvm.mlir (+11-9)
- (modified) mlir/test/Dialect/Vector/transform-vector.mlir (+50-46)
- (modified) mlir/test/Dialect/Vector/vector-broadcast-lowering-transforms.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-contract-matvec-transforms.mlir (+8-6)
- (modified) mlir/test/Dialect/Vector/vector-contract-to-dot-transforms.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir (+13-11)
- (modified) mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms-unsupported.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-contract-to-outerproduct-transforms.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-contract-to-parallel-arith-transforms.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-mask-lowering-transforms.mlir (+21-17)
- (modified) mlir/test/Dialect/Vector/vector-materialize-mask.mlir (+8-6)
- (modified) mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir (+8-6)
- (modified) mlir/test/Dialect/Vector/vector-multi-reduction-outer-lowering.mlir (+8-6)
- (modified) mlir/test/Dialect/Vector/vector-outerproduct-lowering-transforms.mlir (+13-11)
- (modified) mlir/test/Dialect/Vector/vector-rewrite-narrow-types.mlir (+22-20)
- (modified) mlir/test/Dialect/Vector/vector-scalable-create-mask-lowering.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-shape-cast-lowering-scalable-vectors.mlir (+10-8)
- (modified) mlir/test/Dialect/Vector/vector-shape-cast-lowering-transforms.mlir (+10-8)
- (modified) mlir/unittests/Dialect/Transform/Preload.cpp (+8-6)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
index 286f69bc52486cb..94965a67c0c1233 100644
--- a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
@@ -70,6 +70,14 @@ def InterpreterPass : Pass<"transform-interpreter"> {
}];
let dependentDialects = ["::mlir::transform::TransformDialect"];
let options = [
+ Option<"debugPayloadRootTag", "debug-payload-root-tag", "std::string",
+ /*default=*/[{""}],
+ "Select the operation with 'transform.target_tag' attribute having "
+ "the given value as payload IR root. If empty select the pass "
+ "anchor operation as the payload IR root.">,
+ Option<"disableExpensiveChecks", "disable-expensive-checks", "bool",
+ "false",
+ "Disable expensive checks in the interpreter for a faster run.">,
Option<"entryPoint", "entry-point", "std::string",
/*default=*/[{"__transform_main"}],
"Entry point of the pass pipeline.">,
diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h b/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h
index 3fc02267f26e9da..3828021d9543035 100644
--- a/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h
+++ b/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h
@@ -85,21 +85,18 @@ LogicalResult mergeSymbolsInto(Operation *target,
OwningOpRef<Operation *> other);
} // namespace detail
-/// Standalone util to apply the named sequence `entryPoint` to the payload.
-/// This is done in 3 steps:
-/// 1. lookup the `entryPoint` symbol in `{payload, sharedTransformModule}` by
-/// calling detail::findTransformEntryPoint.
-/// 2. if the entry point is found and not nested under
-/// `sharedTransformModule`, call `detail::defineDeclaredSymbols` to "link" in
-/// the `sharedTransformModule`. Note: this may modify the transform IR
-/// embedded with the payload IR.
-/// 3. apply the transform IR to the payload IR, relaxing the requirement that
-/// the transform IR is a top-level transform op. We are applying a named
-/// sequence anyway.
-LogicalResult applyTransformNamedSequence(
- Operation *payload, ModuleOp transformModule,
- const TransformOptions &options,
- StringRef entryPoint = TransformDialect::kTransformEntryPointSymbolName);
+/// Standalone util to apply the named sequence `transformRoot` to `payload` IR.
+/// This is done in 2 steps:
+/// 1. If `transformModule` is provided and is not nested under
+/// `transformRoot`, it will be "linked into" the IR containing
+/// `transformRoot` to resolve undefined named sequences.
+/// 2. The transforms specified in `transformRoot` are applied to `payload`,
+/// assuming the named sequence has a single argument handle that will be
+/// associated with `payload` on run.
+LogicalResult applyTransformNamedSequence(Operation *payload,
+ Operation *transformRoot,
+ ModuleOp transformModule,
+ const TransformOptions &options);
} // namespace transform
} // namespace mlir
diff --git a/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp b/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp
index 3ec51d88729a0e7..c875519945b9218 100644
--- a/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp
+++ b/mlir/lib/Dialect/Transform/Transforms/InterpreterPass.cpp
@@ -19,6 +19,39 @@ namespace transform {
} // namespace transform
} // namespace mlir
+/// Returns the payload operation to be used as payload root:
+/// - the operation nested under `passRoot` that has the given tag attribute,
+/// must be unique;
+/// - the `passRoot` itself if the tag is empty.
+static Operation *findPayloadRoot(Operation *passRoot, StringRef tag) {
+ // Fast return.
+ if (tag.empty())
+ return passRoot;
+
+ // Walk to do a lookup.
+ Operation *target = nullptr;
+ auto tagAttrName = StringAttr::get(
+ passRoot->getContext(), transform::TransformDialect::kTargetTagAttrName);
+ WalkResult walkResult = passRoot->walk([&](Operation *op) {
+ auto attr = op->getAttrOfType<StringAttr>(tagAttrName);
+ if (!attr || attr.getValue() != tag)
+ return WalkResult::advance();
+
+ if (!target) {
+ target = op;
+ return WalkResult::advance();
+ }
+
+ InFlightDiagnostic diag = op->emitError()
+ << "repeated operation with the target tag '"
+ << tag << "'";
+ diag.attachNote(target->getLoc()) << "previously seen operation";
+ return WalkResult::interrupt();
+ });
+
+ return walkResult.wasInterrupted() ? nullptr : target;
+}
+
namespace {
class InterpreterPass
: public transform::impl::InterpreterPassBase<InterpreterPass> {
@@ -29,10 +62,22 @@ class InterpreterPass
MLIRContext *context = &getContext();
ModuleOp transformModule =
transform::detail::getPreloadedTransformModule(context);
+ Operation *payloadRoot =
+ findPayloadRoot(getOperation(), debugPayloadRootTag);
+ Operation *transformEntryPoint = transform::detail::findTransformEntryPoint(
+ getOperation(), transformModule, entryPoint);
+ if (!transformEntryPoint) {
+ getOperation()->emitError()
+ << "could not find transform entry point: " << entryPoint
+ << " in either payload or transform module";
+ return signalPassFailure();
+ }
+
if (failed(transform::applyTransformNamedSequence(
- getOperation(), transformModule,
- options.enableExpensiveChecks(true), entryPoint)))
+ payloadRoot, transformEntryPoint, transformModule,
+ options.enableExpensiveChecks(!disableExpensiveChecks)))) {
return signalPassFailure();
+ }
}
private:
diff --git a/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp b/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp
index e6d692072267c1f..2e32b7f71d10448 100644
--- a/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp
+++ b/mlir/lib/Dialect/Transform/Transforms/TransformInterpreterUtils.cpp
@@ -409,16 +409,8 @@ transform::detail::mergeSymbolsInto(Operation *target,
}
LogicalResult transform::applyTransformNamedSequence(
- Operation *payload, ModuleOp transformModule,
- const TransformOptions &options, StringRef entryPoint) {
- Operation *transformRoot =
- detail::findTransformEntryPoint(payload, transformModule, entryPoint);
- if (!transformRoot) {
- return payload->emitError()
- << "could not find transform entry point: " << entryPoint
- << " in either payload or transform module";
- }
-
+ Operation *payload, Operation *transformRoot, ModuleOp transformModule,
+ const TransformOptions &options) {
// `transformModule` may not be modified.
if (transformModule && !transformModule->isAncestor(transformRoot)) {
OwningOpRef<Operation *> clonedTransformModule(transformModule->clone());
diff --git a/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir b/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir
index b3883703fcdc1ac..b584d4ce28f52ab 100644
--- a/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir
+++ b/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir
@@ -2,7 +2,7 @@
// RUN: mlir-opt -convert-func-to-llvm='use-bare-ptr-memref-call-conv=1 use-opaque-pointers=1' %s | FileCheck %s --check-prefix=BAREPTR
-// RUN: mlir-opt -test-transform-dialect-interpreter %s | FileCheck %s --check-prefix=BAREPTR
+// RUN: mlir-opt -transform-interpreter %s | FileCheck %s --check-prefix=BAREPTR
// These tests were separated from func-memref.mlir because applying
// -reconcile-unrealized-casts resulted in `llvm.extractvalue` ops getting
@@ -110,17 +110,20 @@ func.func @unranked_memref(%arg0:memref<*xi32>) {
}
func.func private @printMemrefI32(memref<*xi32>)
-transform.sequence failures(propagate) {
-^bb1(%toplevel_module: !transform.any_op):
- %func = transform.structured.match ops{["func.func"]} in %toplevel_module
- : (!transform.any_op) -> !transform.any_op
- transform.apply_conversion_patterns to %func {
- transform.apply_conversion_patterns.func.func_to_llvm
- } with type_converter {
- transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
- {use_bare_ptr_call_conv = true, use_opaque_pointers = true}
- } {
- legal_dialects = ["llvm"],
- partial_conversion
- } : !transform.any_op
+module attributes {transform.with_named_sequence} {
+ transform.named_sequence @__transform_main(
+ %toplevel_module: !transform.any_op {transform.readonly}) {
+ %func = transform.structured.match ops{["func.func"]} in %toplevel_module
+ : (!transform.any_op) -> !transform.any_op
+ transform.apply_conversion_patterns to %func {
+ transform.apply_conversion_patterns.func.func_to_llvm
+ } with type_converter {
+ transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
+ {use_bare_ptr_call_conv = true, use_opaque_pointers = true}
+ } {
+ legal_dialects = ["llvm"],
+ partial_conversion
+ } : !transform.any_op
+ transform.yield
+ }
}
diff --git a/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir b/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir
index 819611a59dde5df..8254e77c8628bdf 100644
--- a/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir
+++ b/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir
@@ -2,7 +2,7 @@
// RUN: mlir-opt -pass-pipeline="builtin.module(func.func(convert-math-to-llvm,convert-arith-to-llvm{index-bitwidth=32}),convert-func-to-llvm{index-bitwidth=32 use-opaque-pointers=1},reconcile-unrealized-casts)" %s | FileCheck --check-prefix=CHECK32 %s
-// RUN: mlir-opt -test-transform-dialect-interpreter %s | FileCheck --check-prefix=CHECK32 %s
+// RUN: mlir-opt -transform-interpreter %s | FileCheck --check-prefix=CHECK32 %s
// Same below, but using the `ConvertToLLVMPatternInterface` entry point
// and the generic `convert-to-llvm` pass.
@@ -537,20 +537,22 @@ func.func @switchi8(%arg0 : i8) -> i32 {
// CHECK-NEXT: llvm.return %[[E1]] : i32
// CHECK-NEXT: }
-transform.sequence failures(propagate) {
-^bb1(%toplevel_module: !transform.any_op):
- %func = transform.structured.match ops{["func.func"]} in %toplevel_module
- : (!transform.any_op) -> !transform.any_op
- transform.apply_conversion_patterns to %func {
- transform.apply_conversion_patterns.dialect_to_llvm "math"
- transform.apply_conversion_patterns.dialect_to_llvm "arith"
- transform.apply_conversion_patterns.dialect_to_llvm "cf"
- transform.apply_conversion_patterns.func.func_to_llvm
- } with type_converter {
- transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
- {index_bitwidth = 32, use_opaque_pointers = true}
- } {
- legal_dialects = ["llvm"],
- partial_conversion
- } : !transform.any_op
+module attributes {transform.with_named_sequence} {
+ transform.named_sequence @__transform_main(%toplevel_module: !transform.any_op {transform.readonly}) {
+ %func = transform.structured.match ops{["func.func"]} in %toplevel_module
+ : (!transform.any_op) -> !transform.any_op
+ transform.apply_conversion_patterns to %func {
+ transform.apply_conversion_patterns.dialect_to_llvm "math"
+ transform.apply_conversion_patterns.dialect_to_llvm "arith"
+ transform.apply_conversion_patterns.dialect_to_llvm "cf"
+ transform.apply_conversion_patterns.func.func_to_llvm
+ } with type_converter {
+ transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
+ {index_bitwidth = 32, use_opaque_pointers = true}
+ } {
+ legal_dialects = ["llvm"],
+ partial_conversion
+ } : !transform.any_op
+ transform.yield
+ }
}
diff --git a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm-32b.mlir b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm-32b.mlir
index 62f61629ea9d037..9bdce31261064e5 100644
--- a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm-32b.mlir
+++ b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm-32b.mlir
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -convert-gpu-to-nvvm='index-bitwidth=32 use-opaque-pointers=1' -split-input-file | FileCheck %s
-// RUN: mlir-opt %s -test-transform-dialect-interpreter | FileCheck %s
+// RUN: mlir-opt %s -transform-interpreter | FileCheck %s
gpu.module @test_module_0 {
// CHECK-LABEL: func @gpu_index_ops()
@@ -48,30 +48,32 @@ gpu.module @test_module_1 {
}
}
-transform.sequence failures(propagate) {
-^bb1(%toplevel_module: !transform.any_op):
- %gpu_module = transform.structured.match ops{["gpu.module"]} in %toplevel_module
- : (!transform.any_op) -> !transform.any_op
- transform.apply_conversion_patterns to %gpu_module {
- transform.apply_conversion_patterns.dialect_to_llvm "arith"
- transform.apply_conversion_patterns.dialect_to_llvm "cf"
- transform.apply_conversion_patterns.vector.vector_to_llvm
- transform.apply_conversion_patterns.func.func_to_llvm
- transform.apply_conversion_patterns.dialect_to_llvm "memref"
- transform.apply_conversion_patterns.gpu.gpu_to_nvvm
- transform.apply_conversion_patterns.gpu.gpu_wmma_to_nvvm
- transform.apply_conversion_patterns.gpu.gpu_subgroup_reduce_to_nvvm {has_redux = true}
- transform.apply_conversion_patterns.nvgpu.nvgpu_to_nvvm
- } with type_converter {
- transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
- {index_bitwidth = 32, use_opaque_pointers = true}
- } {
- legal_dialects = ["llvm", "memref", "nvvm"],
- legal_ops = ["func.func", "gpu.module", "gpu.module_end", "gpu.yield"],
- illegal_dialects = ["gpu"],
- illegal_ops = ["llvm.cos", "llvm.exp", "llvm.exp2", "llvm.fabs", "llvm.fceil",
- "llvm.ffloor", "llvm.log", "llvm.log10", "llvm.log2", "llvm.pow",
- "llvm.sin", "llvm.sqrt"],
- partial_conversion
- } : !transform.any_op
+module attributes {transform.with_named_sequence} {
+ transform.named_sequence @__transform_main(%toplevel_module: !transform.any_op {transform.readonly}) {
+ %gpu_module = transform.structured.match ops{["gpu.module"]} in %toplevel_module
+ : (!transform.any_op) -> !transform.any_op
+ transform.apply_conversion_patterns to %gpu_module {
+ transform.apply_conversion_patterns.dialect_to_llvm "arith"
+ transform.apply_conversion_patterns.dialect_to_llvm "cf"
+ transform.apply_conversion_patterns.vector.vector_to_llvm
+ transform.apply_conversion_patterns.func.func_to_llvm
+ transform.apply_conversion_patterns.dialect_to_llvm "memref"
+ transform.apply_conversion_patterns.gpu.gpu_to_nvvm
+ transform.apply_conversion_patterns.gpu.gpu_wmma_to_nvvm
+ transform.apply_conversion_patterns.gpu.gpu_subgroup_reduce_to_nvvm {has_redux = true}
+ transform.apply_conversion_patterns.nvgpu.nvgpu_to_nvvm
+ } with type_converter {
+ transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
+ {index_bitwidth = 32, use_opaque_pointers = true}
+ } {
+ legal_dialects = ["llvm", "memref", "nvvm"],
+ legal_ops = ["func.func", "gpu.module", "gpu.module_end", "gpu.yield"],
+ illegal_dialects = ["gpu"],
+ illegal_ops = ["llvm.cos", "llvm.exp", "llvm.exp2", "llvm.fabs", "llvm.fceil",
+ "llvm.ffloor", "llvm.log", "llvm.log10", "llvm.log2", "llvm.pow",
+ "llvm.sin", "llvm.sqrt"],
+ partial_conversion
+ } : !transform.any_op
+ transform.yield
+ }
}
diff --git a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
index a8c02e32ef92b6b..92d85a473d2318f 100644
--- a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
+++ b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
@@ -1,5 +1,5 @@
// RUN: mlir-opt %s -convert-gpu-to-nvvm='has-redux=1 use-opaque-pointers=1' -split-input-file | FileCheck %s
-// RUN: mlir-opt %s -test-transform-dialect-interpreter | FileCheck %s
+// RUN: mlir-opt %s -transform-interpreter | FileCheck %s
gpu.module @test_module_0 {
// CHECK-LABEL: func @gpu_index_ops()
@@ -627,38 +627,40 @@ gpu.module @test_module_31 {
}
}
-transform.sequence failures(propagate) {
-^bb1(%toplevel_module: !transform.any_op):
- %gpu_module = transform.structured.match ops{["gpu.module"]} in %toplevel_module
- : (!transform.any_op) -> !transform.any_op
-
- transform.apply_patterns to %gpu_module {
- transform.apply_patterns.gpu.gpu_rewrite_patterns
- } : !transform.any_op
-
- transform.apply_conversion_patterns to %gpu_module {
- transform.apply_conversion_patterns.dialect_to_llvm "arith"
- transform.apply_conversion_patterns.dialect_to_llvm "cf"
- transform.apply_conversion_patterns.vector.vector_to_llvm
- transform.apply_conversion_patterns.func.func_to_llvm
- transform.apply_conversion_patterns.dialect_to_llvm "memref"
- transform.apply_conversion_patterns.gpu.gpu_to_nvvm
- transform.apply_conversion_patterns.gpu.gpu_wmma_to_nvvm
- transform.apply_conversion_patterns.gpu.gpu_subgroup_reduce_to_nvvm
- transform.apply_conversion_patterns.nvgpu.nvgpu_to_nvvm
- } with type_converter {
- transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
- {index_bitwidth = 64,
- use_bare_ptr = true,
- use_bare_ptr_memref_call_conv = true,
- use_opaque_pointers = true}
- } {
- legal_dialects = ["llvm", "memref", "nvvm", "test"],
- legal_ops = ["func.func", "gpu.module", "gpu.module_end", "gpu.yield"],
- illegal_dialects = ["gpu"],
- illegal_ops = ["llvm.cos", "llvm.exp", "llvm.exp2", "llvm.fabs", "llvm.fceil",
- "llvm.ffloor", "llvm.log", "llvm.log10", "llvm.log2","llvm.pow",
- "llvm.sin", "llvm.sqrt"],
- partial_conversion
- } : !transform.any_op
+module attributes {transform.with_named_sequence} {
+ transform.named_sequence @__transform_main(%toplevel_module: !transform.any_op {transform.readonly}) {
+ %gpu_module = transform.structured.match ops{["gpu.module"]} in %toplevel_module
+ : (!transform.any_op) -> !transform.any_op
+
+ transform.apply_patterns to %gpu_module {
+ transform.apply_patterns.gpu.gpu_rewrite_patterns
+ } : !transform.any_op
+
+ transform.apply_conversion_patterns to %gpu_module {
+ transform.apply_conversion_patterns.dialect_to_llvm "arith"
+ transform.apply_conversion_patterns.dialect_to_llvm "cf"
+ transform.apply_conversion_patterns.vector.vector_to_llvm
+ transform.apply_conversion_patterns.func.func_to_llvm
+ transform.apply_conversion_patterns.dialect_to_llvm "memref"
+ transform.apply_conversion_patterns.gpu.gpu_to_nvvm
+ transform.apply_conversion_patterns.gpu.gpu_wmma_to_nvvm
+ transform.apply_conversion_patterns.gpu.gpu_subgroup_reduce_to_nvvm
+ transform.apply_conversion_patterns.nvgpu.nvgpu_to_nvvm
+ } with type_converter {
+ transform.apply_conversion_patterns.memref.memref_to_llvm_type_converter
+ {index_bitwidth = 64,
+ use_bare_ptr = true,
+ use_bare_ptr_memref_call_conv = true,
+ use_opaque_pointers = true}
+ } {
+ legal_dialects = ["llvm", "memref", "nvvm", "test"],
+ legal_ops = ["func.func", "gpu.module", "gpu.module_end", "gpu.yield"],
+ illegal_dialects = ["gpu"],
+ illegal_ops = ["llvm.cos", "llvm.exp", "llvm.exp2", "llvm.fabs", "llvm.fceil",
+ "llvm.ffloor", "llvm.log", "llvm.log10", "llvm.log2","llvm.pow",
+ "llvm.sin", "llvm.sqrt"],
+ partial_conversion
+ } : !transform.any_op
+ transform.yield
+ }
}
diff --git a/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir b/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
index c7d28e7443695fc..123a661193c4901 100644
--- a/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
+++ b/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
@@ -1,5 +1,5 @@
// RUN: mlir-opt %s -convert-nvgpu-to-nvvm='use-opaque-pointers=1' | FileCheck %s
-// RUN: mlir-opt %s -test-transform-dialect-interpreter | FileCheck %s
+// RUN: mlir-opt %s -transform-interpreter | FileCheck %s
//...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/70040
More information about the Mlir-commits
mailing list