llvm-project/mlir/test/Dialect/Linalg/transform-ops.mlir
Oleksandr "Alex" Zinenko 96ff0255f2
[mlir] cleanup of structured.tile* transform ops (#67320)
Rename and restructure tiling-related transform ops from the structured
extension to be more homogeneous. In particular, all ops now follow a
consistent naming scheme:

 - `transform.structured.tile_using_for`;
 - `transform.structured.tile_using_forall`;
 - `transform.structured.tile_reduction_using_for`;
 - `transform.structured.tile_reduction_using_forall`.

This drops the "_op" naming artifact from `tile_to_forall_op` that
shouldn't have been included in the first place, consistently specifies
the name of the control flow op to be produced for loops (instead of
`tile_reduction_using_scf` since `scf.forall` also belongs to `scf`),
and opts for the `using` connector to avoid ambiguity.

The loops produced by tiling are now systematically placed as *trailing*
results of the transform op. While this required changing 3 out of 4 ops
(except for `tile_using_for`), this is the only choice that makes sense
when producing multiple `scf.for` ops that can be associated with a
variadic number of handles. This choice is also most consistent with
*other* transform ops from the structured extension, in particular with
fusion ops, that produce the structured op as the leading result and the
loop as the trailing result.
2023-09-26 09:14:29 +02:00

50 lines
2.3 KiB
MLIR

// RUN: mlir-opt %s | mlir-opt | FileCheck %s
transform.sequence failures(propagate) {
^bb1(%arg0: !transform.any_op):
// CHECK %{{.*}}, %{{.*}}:2 = transform.structured.tile
%0, %1:2 = transform.structured.tile_using_for %arg0 [2, 0, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)
}
transform.sequence failures(propagate) {
^bb1(%arg0: !transform.any_op):
%0:2 = transform.structured.split %arg0 after 42 { dimension = 0 } : !transform.any_op
transform.structured.split %0#0 after %0#1 { dimension = 1 } : !transform.any_op, !transform.any_op
}
//===----------------------------------------------------------------------===//
// Check that operations are registered correctly through the extension
// mechanism. Their syntax is generated and requires no additional testing since
// we test the generator.
//===----------------------------------------------------------------------===//
transform.sequence failures(propagate) {
^bb1(%arg0: !transform.any_op):
// CHECK: transform.structured.pad
%0, %1, %2 = transform.structured.pad %arg0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)
}
transform.sequence failures(propagate) {
^bb1(%arg0: !transform.any_op):
// CHECK: transform.structured.interchange
%0 = transform.structured.interchange %arg0 : (!transform.any_op) -> !transform.any_op
}
transform.sequence failures(propagate) {
^bb1(%arg0: !transform.any_op):
// CHECK: transform.structured.scalarize
%0 = transform.structured.scalarize %arg0 : (!transform.any_op) -> !transform.any_op
}
// Check that the second argument of `fuse_into_containing_op` is not consumed
// (if it had been, we would have seen a diagnostic about multiple consumers).
transform.sequence failures(propagate) {
^bb1(%arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_op):
%loop = transform.structured.match ops{["scf.forall"]} in %arg0
: (!transform.any_op) -> !transform.any_op
%0:2 = transform.structured.fuse_into_containing_op %arg1 into %loop
: (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
%1:2 = transform.structured.fuse_into_containing_op %arg2 into %loop
: (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op)
}