From f52b6381be19696012f861914fc5e988c6f3ca88 Mon Sep 17 00:00:00 2001 From: Alex Zinenko Date: Mon, 15 May 2023 17:07:53 +0000 Subject: [PATCH] [mlir] update types in remaining Linalg TransformOps test All ops now support explicit type specification, update types to use `!transform.any_op` instead of `!pdl.operation` for consistency. Depends On D144515 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D150592 --- .../Dialect/Linalg/convert-conv2d-to-img2col.mlir | 44 +++---- mlir/test/Dialect/Linalg/hoisting.mlir | 54 ++++----- .../test/Dialect/Linalg/multisize-tiling-full.mlir | 48 ++++---- mlir/test/Dialect/Linalg/tile-conv.mlir | 6 +- mlir/test/Dialect/Linalg/tile-indexed.mlir | 12 +- mlir/test/Dialect/Linalg/tile-tensors.mlir | 18 +-- mlir/test/Dialect/Linalg/transform-lower-pack.mlir | 40 +++---- .../transform-op-bufferize-to-allocation.mlir | 34 +++--- mlir/test/Dialect/Linalg/transform-op-match.mlir | 34 +++--- .../Linalg/transform-op-multitile-sizes.mlir | 24 ++-- ...rm-op-rewrite-in-destination-passing-style.mlir | 48 ++++---- mlir/test/Dialect/Linalg/transform-op-split.mlir | 66 +++++------ mlir/test/Dialect/Linalg/transform-op-tile.mlir | 32 ++--- .../Dialect/Linalg/transform-pack-greedily.mlir | 32 ++--- .../Dialect/Linalg/transform-tile-and-fuse.mlir | 6 +- mlir/test/Dialect/Transform/test-interpreter.mlir | 130 ++++++++++----------- .../Transform/TestTransformDialectExtension.td | 10 +- 17 files changed, 319 insertions(+), 319 deletions(-) diff --git a/mlir/test/Dialect/Linalg/convert-conv2d-to-img2col.mlir b/mlir/test/Dialect/Linalg/convert-conv2d-to-img2col.mlir index 4888d4a..d87b4a3 100644 --- a/mlir/test/Dialect/Linalg/convert-conv2d-to-img2col.mlir +++ b/mlir/test/Dialect/Linalg/convert-conv2d-to-img2col.mlir @@ -16,10 +16,10 @@ func.func @conv_non_static(%arg0: tensor, %arg1: tensor<3x3x4x16xf3 } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error@below {{failed to apply}} - %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!pdl.operation) -> (!pdl.operation, !pdl.operation) + %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } // ----- @@ -88,11 +88,11 @@ func.func @conv_16433136(%arg0: tensor<1x16x16x4xf32>, %arg1: tensor<3x3x4x16xf3 } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %img2col_tensor_producer, %transformed = transform.structured.convert_conv2d_to_img2col %0 : (!pdl.operation) -> (!pdl.operation, !pdl.operation) - transform.print %img2col_tensor_producer {name = "tensor_producer"}: !pdl.operation - transform.print %transformed {name = "transformed"}: !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %img2col_tensor_producer, %transformed = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + transform.print %img2col_tensor_producer {name = "tensor_producer"}: !transform.any_op + transform.print %transformed {name = "transformed"}: !transform.any_op } // ----- @@ -167,9 +167,9 @@ func.func @depthwise_conv_hwc_114x16x3(%input: tensor<1x114x114x16xf32>, %filter } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.depthwise_conv_2d_nhwc_hwc"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.depthwise_conv_2d_nhwc_hwc"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } // ----- @@ -209,9 +209,9 @@ func.func @batch_nhwc_conv(%arg0: tensor<8x16x16x4xf32>, %arg1: tensor<3x3x4x16x } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } // ----- @@ -272,9 +272,9 @@ func.func @batch_nchw_conv(%arg0: tensor<8x4x16x16xf32>, %arg1: tensor<16x4x3x3x } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.conv_2d_nchw_fchw"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.conv_2d_nchw_fchw"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:2 = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } // ----- @@ -308,9 +308,9 @@ func.func @conv_integer_extend(%arg0: tensor<1x16x16x4xi8>, %arg1: tensor<3x3x4x } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %img2col_tensor_producer, %transformed = transform.structured.convert_conv2d_to_img2col %0 : (!pdl.operation) -> (!pdl.operation, !pdl.operation) - transform.print %img2col_tensor_producer {name = "tensor_producer"}: !pdl.operation - transform.print %transformed {name = "transformed"}: !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.conv_2d_nhwc_hwcf"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %img2col_tensor_producer, %transformed = transform.structured.convert_conv2d_to_img2col %0 : (!transform.any_op) -> (!transform.any_op, !transform.any_op) + transform.print %img2col_tensor_producer {name = "tensor_producer"}: !transform.any_op + transform.print %transformed {name = "transformed"}: !transform.any_op } diff --git a/mlir/test/Dialect/Linalg/hoisting.mlir b/mlir/test/Dialect/Linalg/hoisting.mlir index 546b1bb..dadde43 100644 --- a/mlir/test/Dialect/Linalg/hoisting.mlir +++ b/mlir/test/Dialect/Linalg/hoisting.mlir @@ -75,11 +75,11 @@ func.func @hoist_vector_transfer_pairs( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -164,11 +164,11 @@ func.func @hoist_vector_transfer_pairs_disjoint( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -209,11 +209,11 @@ func.func @hoist_vector_transfer_pairs_in_affine_loops(%memref0: memref<64x64xi3 } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -298,11 +298,11 @@ func.func @hoist_vector_transfer_pairs_tensor( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 - : (!pdl.operation) -> () + : (!transform.any_op) -> () } // ----- @@ -393,11 +393,11 @@ func.func @hoist_vector_transfer_pairs_disjoint_tensor( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 - : (!pdl.operation) -> () + : (!transform.any_op) -> () } // ----- @@ -510,11 +510,11 @@ func.func @hoist_vector_transfer_pairs_tensor_and_slices( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 - : (!pdl.operation) -> () + : (!transform.any_op) -> () } // ----- @@ -557,11 +557,11 @@ func.func @hoist_vector_transfer_write_pairs_disjoint_tensor( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 - : (!pdl.operation) -> () + : (!transform.any_op) -> () } // ----- @@ -670,11 +670,11 @@ func.func @hoist_vector_transfer_pairs_tensor_and_slices_static_large_tensor( } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_tensor_subsets %0 - : (!pdl.operation) -> () + : (!transform.any_op) -> () } // ----- @@ -716,9 +716,9 @@ func.func @hoist_vector_transfer_read() { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["func.func"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.hoist_redundant_vector_transfers %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } diff --git a/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir b/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir index a5ab963..742fa71 100644 --- a/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir +++ b/mlir/test/Dialect/Linalg/multisize-tiling-full.mlir @@ -3,18 +3,18 @@ // This implements a 2D multisize tiling with target sizes [3, 10]. transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!pdl.operation) -> !pdl.operation - %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!pdl.operation) -> !pdl.operation - %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !pdl.operation, !pdl.operation - %3:2 = transform.structured.tile %2#0 [%1#0] : (!pdl.operation, !pdl.operation) -> (!pdl.operation, !pdl.operation) - %4:2 = transform.structured.tile %2#1 [%1#1] : (!pdl.operation, !pdl.operation) -> (!pdl.operation, !pdl.operation) - %5 = merge_handles %3#0, %4#0 : !pdl.operation - %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation - %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !pdl.operation, !pdl.operation - transform.structured.tile %6#0 [0, %tt#0] : (!pdl.operation, !pdl.operation) -> (!pdl.operation, !pdl.operation) - transform.structured.tile %6#1 [0, %tt#1] : (!pdl.operation, !pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!transform.any_op) -> !transform.any_op + %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!transform.any_op) -> !transform.any_op + %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !transform.any_op, !transform.any_op + %3:2 = transform.structured.tile %2#0 [%1#0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %4:2 = transform.structured.tile %2#1 [%1#1] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + %5 = merge_handles %3#0, %4#0 : !transform.any_op + %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op + %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !transform.any_op, !transform.any_op + transform.structured.tile %6#0 [0, %tt#0] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) + transform.structured.tile %6#1 [0, %tt#1] : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 @@ -103,18 +103,18 @@ func.func @two_d(%arg0: tensor<10x34xf32>, // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!pdl.operation) -> !transform.param - %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!pdl.operation) -> !transform.param - %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !pdl.operation, !transform.param - %3:2 = transform.structured.tile %2#0 [%1#0] : (!pdl.operation, !transform.param) -> (!pdl.operation, !pdl.operation) - %4:2 = transform.structured.tile %2#1 [%1#1] : (!pdl.operation, !transform.param) -> (!pdl.operation, !pdl.operation) - %5 = merge_handles %3#0, %4#0 : !pdl.operation - %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !pdl.operation, !transform.param, !transform.param, !transform.param - %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !pdl.operation, !transform.param - transform.structured.tile %6#0 [0, %tt#0] : (!pdl.operation, !transform.param) -> (!pdl.operation, !pdl.operation) - transform.structured.tile %6#1 [0, %tt#1] : (!pdl.operation, !transform.param) -> (!pdl.operation, !pdl.operation) +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:3 = transform.structured.multitile_sizes %0 { dimension = 0, target_size = 3} : (!transform.any_op) -> !transform.param + %t:3 = transform.structured.multitile_sizes %0 { dimension = 1, target_size = 10} : (!transform.any_op) -> !transform.param + %2:2 = transform.structured.split %0 after %1#2 { dimension = 0 } : !transform.any_op, !transform.param + %3:2 = transform.structured.tile %2#0 [%1#0] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) + %4:2 = transform.structured.tile %2#1 [%1#1] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) + %5 = merge_handles %3#0, %4#0 : !transform.any_op + %tt:3 = replicate num(%5) %t#0, %t#1, %t#2 : !transform.any_op, !transform.param, !transform.param, !transform.param + %6:2 = transform.structured.split %5 after %tt#2 { dimension = 1 } : !transform.any_op, !transform.param + transform.structured.tile %6#0 [0, %tt#0] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) + transform.structured.tile %6#1 [0, %tt#1] : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op) } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 diff --git a/mlir/test/Dialect/Linalg/tile-conv.mlir b/mlir/test/Dialect/Linalg/tile-conv.mlir index f7b0b22..5ca9519 100644 --- a/mlir/test/Dialect/Linalg/tile-conv.mlir +++ b/mlir/test/Dialect/Linalg/tile-conv.mlir @@ -10,9 +10,9 @@ func.func @conv(%arg0 : memref, %arg1 : memref, %arg2 : memref } transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.conv_2d"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loop:2 = transform.structured.tile %0 [2, 3] : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation) + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.conv_2d"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loop:2 = transform.structured.tile %0 [2, 3] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } // CHECK: func @conv diff --git a/mlir/test/Dialect/Linalg/tile-indexed.mlir b/mlir/test/Dialect/Linalg/tile-indexed.mlir index 68fdc3b..f4a40c6 100644 --- a/mlir/test/Dialect/Linalg/tile-indexed.mlir +++ b/mlir/test/Dialect/Linalg/tile-indexed.mlir @@ -12,9 +12,9 @@ func.func @indexed_vector(%arg0: memref<50xindex>) { } transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loop = transform.structured.tile %0 [10] : (!pdl.operation) -> (!pdl.operation, !pdl.operation) + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loop = transform.structured.tile %0 [10] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } // TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0, d1) -> (d0 + d1)> @@ -42,9 +42,9 @@ func.func @indexed_matrix(%arg0: memref<50x50xindex>) { } transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loop:2 = transform.structured.tile %0 [10, 25] : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation) + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loop:2 = transform.structured.tile %0 [10, 25] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } // TILE-10n25-DAG: [[$MAP:#[a-zA-Z0-9_]*]] = affine_map<(d0, d1) -> (d0 + d1)> diff --git a/mlir/test/Dialect/Linalg/tile-tensors.mlir b/mlir/test/Dialect/Linalg/tile-tensors.mlir index c192a59..7fe9708 100644 --- a/mlir/test/Dialect/Linalg/tile-tensors.mlir +++ b/mlir/test/Dialect/Linalg/tile-tensors.mlir @@ -28,9 +28,9 @@ func.func @matmul_tensors( } transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } // ----- @@ -59,9 +59,9 @@ func.func @generic_op_tensors( } transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } // CHECK-LABEL: func @generic_op_tensors @@ -130,7 +130,7 @@ func.func @fold_extract_slice( } transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loops:3 = transform.structured.tile %0 [2, 3, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } diff --git a/mlir/test/Dialect/Linalg/transform-lower-pack.mlir b/mlir/test/Dialect/Linalg/transform-lower-pack.mlir index 9e33b27..f3346c1 100644 --- a/mlir/test/Dialect/Linalg/transform-lower-pack.mlir +++ b/mlir/test/Dialect/Linalg/transform-lower-pack.mlir @@ -19,9 +19,9 @@ func.func @pack(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<17x2x16x16x32x8xf } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -48,9 +48,9 @@ func.func @pack(%arg0: tensor<128x8xf32>, %arg1: tensor<8x8x16x1xf32>) -> tensor } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -80,9 +80,9 @@ func.func @pack_as_pad(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<1x1x1x1x13 } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -112,9 +112,9 @@ func.func @pack_not_a_pad(%arg0: tensor<129x47x16x16xf32>, %arg1: tensor<1x1x16x } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -139,9 +139,9 @@ func.func @unpack(%arg0: tensor<17x2x16x16x32x8xf32>, %arg1: tensor<129x47x16x16 } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %unpack = transform.structured.match ops{["tensor.unpack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.unpack"> + : (!transform.any_op) -> !transform.op<"tensor.unpack"> transform.structured.lower_unpack %unpack : (!transform.op<"tensor.unpack">) -> (!transform.op<"tensor.empty">, !transform.op<"linalg.transpose">, @@ -170,9 +170,9 @@ func.func @unpack_as_pad(%arg0: tensor<1x1x1x1x136x64x16x16xf32>, %arg1: tensor< } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %unpack = transform.structured.match ops{["tensor.unpack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.unpack"> + : (!transform.any_op) -> !transform.op<"tensor.unpack"> transform.structured.lower_unpack %unpack : (!transform.op<"tensor.unpack">) -> (!transform.op<"tensor.empty">, !transform.op<"linalg.transpose">, @@ -203,9 +203,9 @@ func.func @pack_with_outer_dims_perm(%src: tensor<100x200x128x256xi32>, } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -235,9 +235,9 @@ func.func @pack_with_pad_and_outer_dims_perm(%src: tensor<100x200x127x255xi32>, } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -287,9 +287,9 @@ func.func @dynamic_pack_pad_transpose_inner_and_outer_dims(%source: tensor !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } @@ -323,9 +323,9 @@ func.func @pack_as_pad_with_outer_dims_perm(%arg0: tensor<129x47x16x16xf32>, %ar } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %pack = transform.structured.match ops{["tensor.pack"]} in %module_op - : (!pdl.operation) -> !transform.op<"tensor.pack"> + : (!transform.any_op) -> !transform.op<"tensor.pack"> transform.structured.lower_pack %pack : (!transform.op<"tensor.pack">) -> (!transform.op<"tensor.pad">, !transform.op<"tensor.expand_shape">, !transform.op<"linalg.transpose">) } diff --git a/mlir/test/Dialect/Linalg/transform-op-bufferize-to-allocation.mlir b/mlir/test/Dialect/Linalg/transform-op-bufferize-to-allocation.mlir index b22be9f..6a108ba 100644 --- a/mlir/test/Dialect/Linalg/transform-op-bufferize-to-allocation.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-bufferize-to-allocation.mlir @@ -30,9 +30,9 @@ func.func @tensor_pad_constant(%t: tensor, %l2: index, %h1: index, } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.get_result %0[0] : (!pdl.operation) -> !transform.any_value +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.get_result %0[0] : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 } @@ -56,12 +56,12 @@ func.func @tensor_pad_constant(%t: tensor, %l2: index, %h1: index, } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.get_result %0[0] : (!pdl.operation) -> !transform.any_value +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.get_result %0[0] : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 // Make sure that One-Shot Bufferize can bufferize the rest. - %3 = transform.bufferization.one_shot_bufferize %arg1 : (!pdl.operation) -> !pdl.operation + %3 = transform.bufferization.one_shot_bufferize %arg1 : (!transform.any_op) -> !transform.any_op } // ----- @@ -82,9 +82,9 @@ func.func @materialization_of_bbarg(%t: tensor, %idx: index) -> inde } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["tensor.extract"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = test_produce_value_handle_to_argument_of_parent_block %0, 0 : (!pdl.operation) -> !transform.any_value +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["tensor.extract"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = test_produce_value_handle_to_argument_of_parent_block %0, 0 : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 {memory_space = 4} } @@ -103,12 +103,12 @@ func.func @materialization_of_bbarg(%t: tensor, %idx: index) -> inde } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["tensor.extract"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = test_produce_value_handle_to_argument_of_parent_block %0, 0 : (!pdl.operation) -> !transform.any_value +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["tensor.extract"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = test_produce_value_handle_to_argument_of_parent_block %0, 0 : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 {memory_space = 4} // Make sure that One-Shot Bufferize can bufferize the rest. - %3 = transform.bufferization.one_shot_bufferize %arg1 : (!pdl.operation) -> !pdl.operation + %3 = transform.bufferization.one_shot_bufferize %arg1 : (!transform.any_op) -> !transform.any_op } // ----- @@ -125,9 +125,9 @@ func.func @materialization_of_opresult(%idx: index) -> tensor { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["dummy.some_op"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.get_result %0[0] : (!pdl.operation) -> !transform.any_value +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["dummy.some_op"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.get_result %0[0] : (!transform.any_op) -> !transform.any_value %2 = transform.structured.bufferize_to_allocation %1 {memory_space = 4} } diff --git a/mlir/test/Dialect/Linalg/transform-op-match.mlir b/mlir/test/Dialect/Linalg/transform-op-match.mlir index cbc62a6..c6c177c 100644 --- a/mlir/test/Dialect/Linalg/transform-op-match.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-match.mlir @@ -10,14 +10,14 @@ func.func @bar() { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %match_name = transform.structured.match ops{["arith.constant"]} in %arg1 : (!pdl.operation) -> !pdl.operation - transform.test_print_remark_at_operand %match_name, "matched op name" : !pdl.operation - transform.test_consume_operand %match_name : !pdl.operation +^bb1(%arg1: !transform.any_op): + %match_name = transform.structured.match ops{["arith.constant"]} in %arg1 : (!transform.any_op) -> !transform.any_op + transform.test_print_remark_at_operand %match_name, "matched op name" : !transform.any_op + transform.test_consume_operand %match_name : !transform.any_op - %match_attr = transform.structured.match ops{["arith.constant"]} attributes{my_attr} in %arg1 : (!pdl.operation) -> !pdl.operation - transform.test_print_remark_at_operand %match_attr, "matched attr name" : !pdl.operation - transform.test_consume_operand %match_attr : !pdl.operation + %match_attr = transform.structured.match ops{["arith.constant"]} attributes{my_attr} in %arg1 : (!transform.any_op) -> !transform.any_op + transform.test_print_remark_at_operand %match_attr, "matched attr name" : !transform.any_op + transform.test_consume_operand %match_attr : !transform.any_op } // ----- @@ -30,11 +30,11 @@ func.func @by_type() { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %match_name = transform.structured.match - ops{["arith.constant"]} filter_result_type = f32 in %arg1 : (!pdl.operation) -> !pdl.operation - transform.test_print_remark_at_operand %match_name, "matched op name" : !pdl.operation - transform.test_consume_operand %match_name : !pdl.operation + ops{["arith.constant"]} filter_result_type = f32 in %arg1 : (!transform.any_op) -> !transform.any_op + transform.test_print_remark_at_operand %match_name, "matched op name" : !transform.any_op + transform.test_consume_operand %match_name : !transform.any_op } // ----- @@ -56,23 +56,23 @@ func.func @match_complex_attribute(%arg0: tensor<12x128x32xf32>) } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %match_attr = transform.structured.match ops{["linalg.generic"]} attributes{iterator_types = [ #linalg.iterator_type, #linalg.iterator_type, #linalg.iterator_type]} - in %arg1 : (!pdl.operation) -> !pdl.operation - transform.test_print_remark_at_operand %match_attr, "matched complex attr" : !pdl.operation - transform.test_consume_operand %match_attr : !pdl.operation + in %arg1 : (!transform.any_op) -> !transform.any_op + transform.test_print_remark_at_operand %match_attr, "matched complex attr" : !transform.any_op + transform.test_consume_operand %match_attr : !transform.any_op %no_match = transform.structured.match attributes{iterator_types = [ #linalg.iterator_type, #linalg.iterator_type, #linalg.iterator_type]} - in %arg1 : (!pdl.operation) -> !pdl.operation + in %arg1 : (!transform.any_op) -> !transform.any_op // expected-remark @below {{0}} - transform.test_print_number_of_associated_payload_ir_ops %no_match + transform.test_print_number_of_associated_payload_ir_ops %no_match : !transform.any_op } diff --git a/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir b/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir index d9fa8cb..49924ae 100644 --- a/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-multitile-sizes.mlir @@ -3,9 +3,9 @@ // CHECK-DAG: #[[$MAP13:.+]] = affine_map<() -> (13)> transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation - transform.structured.multitile_sizes %0 { target_size = 3, dimension = 0 } : (!pdl.operation) -> !pdl.operation + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op + transform.structured.multitile_sizes %0 { target_size = 3, dimension = 0 } : (!transform.any_op) -> !transform.any_op } // CHECK-LABEL: @multitile_sizes_static @@ -27,11 +27,11 @@ func.func @multitile_sizes_static( // ----- transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op %low_tile, %high_tile, %split_point = transform.structured.multitile_sizes %0 { target_size = 3, dimension = 0 } - : (!pdl.operation) -> !transform.param + : (!transform.any_op) -> !transform.param // expected-remark @below {{2 : i64}} transform.test_print_param %low_tile : !transform.param // expected-remark @below {{3 : i64}} @@ -54,9 +54,9 @@ func.func @multitile_sizes_static_gen( // ----- transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation - transform.structured.multitile_sizes %0 { target_size = 3, divisor = 2, dimension = 0 } : (!pdl.operation) -> !pdl.operation + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op + transform.structured.multitile_sizes %0 { target_size = 3, divisor = 2, dimension = 0 } : (!transform.any_op) -> !transform.any_op } // CHECK: #[[$MAP_A:.+]] = affine_map<()[s0] -> ([[A_IMPL:s0 floordiv 2]])> @@ -95,11 +95,11 @@ func.func @multitile_sizes_dynamic( // ----- transform.sequence failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation + ^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{cannot compute parametric tile sizes for dynamically shaped payload op}} transform.structured.multitile_sizes %0 { target_size = 3, divisor = 2, dimension = 0 } - : (!pdl.operation) -> !transform.param + : (!transform.any_op) -> !transform.param } func.func @multitile_sizes_dynamic_gen( diff --git a/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir b/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir index 9b89d83..723b9ce 100644 --- a/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-rewrite-in-destination-passing-style.mlir @@ -11,11 +11,11 @@ func.func @tensor_from_elements_0d(%arg0: index) -> tensor { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.from_elements"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -34,11 +34,11 @@ func.func @tensor_from_elements_1d(%arg0: index, %arg1: index) -> tensor<2xindex } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.from_elements"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -63,11 +63,11 @@ func.func @tensor_from_elements_2d(%arg0: index, %arg1: index) -> tensor<3x2xind } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.from_elements"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -95,11 +95,11 @@ func.func @tensor_generate(%s1: index, %s2: index) -> tensor { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.generate"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -136,11 +136,11 @@ func.func @tensor_pad(%t1: tensor, %l2: index, %h1: index, } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -170,11 +170,11 @@ func.func @tensor_pad_constant(%t1: tensor, %l2: index, %h1: index, } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -202,11 +202,11 @@ func.func @tensor_pad_invariant(%t1: tensor, %l2: index, %h1: index, } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } // ----- @@ -230,9 +230,9 @@ func.func @tensor_pad_nofold(%t1: tensor, %padding: index) } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): %0 = transform.structured.match ops{["tensor.pad"]} in %arg1 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op transform.structured.rewrite_in_destination_passing_style %0 - : (!pdl.operation) -> !pdl.operation + : (!transform.any_op) -> !transform.any_op } diff --git a/mlir/test/Dialect/Linalg/transform-op-split.mlir b/mlir/test/Dialect/Linalg/transform-op-split.mlir index 7860881..fe97c7e 100644 --- a/mlir/test/Dialect/Linalg/transform-op-split.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-split.mlir @@ -1,9 +1,9 @@ // RUN: mlir-opt %s --test-transform-dialect-interpreter --split-input-file -verify-diagnostics | FileCheck %s transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:2 = transform.structured.split %0 after 42 { dimension = 0 } : !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:2 = transform.structured.split %0 after 42 { dimension = 0 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 @@ -49,9 +49,9 @@ func.func @one_d_static(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tenso // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:2 = transform.structured.split %0 after 42 { dimension = 0 } : !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:2 = transform.structured.split %0 after 42 { dimension = 0 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 @@ -82,10 +82,10 @@ func.func @one_d_static_overflow(%arg0: tensor<10xf32>, %arg1: tensor<10xf32>) - // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!pdl.operation) -> !pdl.operation - transform.structured.split %0 after %1 { dimension = 0 } : !pdl.operation, !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!transform.any_op) -> !transform.any_op + transform.structured.split %0 after %1 { dimension = 0 } : !transform.any_op, !transform.any_op } func.func private @get_size() -> index @@ -130,10 +130,10 @@ func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100 // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1:2 = transform.structured.split %0 after 4 { dimension = 0 } : !pdl.operation - %2:2 = transform.structured.split %1#1 after 16 { dimension = 1 } : !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1:2 = transform.structured.split %0 after 4 { dimension = 0 } : !transform.any_op + %2:2 = transform.structured.split %1#1 after 16 { dimension = 1 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 @@ -187,19 +187,19 @@ func.func @two_d(%arg0: tensor<10x34xf32>, // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): +^bb1(%arg1: !transform.any_op): // expected-error @below {{expects either a dynamic or a static split point to be provided}} - %0:2 = "transform.structured.split"(%arg1) { dimension = 1, static_split_point = -9223372036854775808 } : (!pdl.operation) -> (!pdl.operation, !pdl.operation) + %0:2 = "transform.structured.split"(%arg1) { dimension = 1, static_split_point = -9223372036854775808 } : (!transform.any_op) -> (!transform.any_op, !transform.any_op) } // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{expected dynamic split point handle to point to a single-result index-typed op}} - transform.structured.split %0 after %1 { dimension = 0 } : !pdl.operation, !pdl.operation + transform.structured.split %0 after %1 { dimension = 0 } : !transform.any_op, !transform.any_op } func.func private @get_size() -> i64 @@ -221,11 +221,11 @@ func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100 // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{expected the dynamic split point handle to point to as many operations (0) as the target handle (1)}} - transform.structured.split %0 after %1 { dimension = 0 } : !pdl.operation, !pdl.operation + transform.structured.split %0 after %1 { dimension = 0 } : !transform.any_op, !transform.any_op } func.func private @get_size() -> i64 @@ -245,10 +245,10 @@ func.func @dynamic(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100 // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["func.return"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["func.return"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{only applies to structured ops}} - transform.structured.split %0 after 16 { dimension = 1 } : !pdl.operation + transform.structured.split %0 after 16 { dimension = 1 } : !transform.any_op } func.func @noop(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { @@ -259,10 +259,10 @@ func.func @noop(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf3 // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{dimension 1 does not exist in target op}} - transform.structured.split %0 after 16 { dimension = 1 } : !pdl.operation + transform.structured.split %0 after 16 { dimension = 1 } : !transform.any_op } func.func @one_d_static(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tensor<100xf32> { @@ -281,11 +281,11 @@ func.func @one_d_static(%arg0: tensor<100xf32>, %arg1: tensor<100xf32>) -> tenso // ----- transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.generic"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{splitting does not produce the second part for a subset of targets}} // expected-note @below {{expected splitting to produce the second part of all or none of the targets}} - %1:2 = transform.structured.split %0 after 142 { dimension = 0 } : !pdl.operation + %1:2 = transform.structured.split %0 after 142 { dimension = 0 } : !transform.any_op } func.func private @elem(%arg0: f32, %arg1: index, %arg2: index) -> f32 diff --git a/mlir/test/Dialect/Linalg/transform-op-tile.mlir b/mlir/test/Dialect/Linalg/transform-op-tile.mlir index 1ad9383..f005752 100644 --- a/mlir/test/Dialect/Linalg/transform-op-tile.mlir +++ b/mlir/test/Dialect/Linalg/transform-op-tile.mlir @@ -1,9 +1,9 @@ // RUN: mlir-opt --test-transform-dialect-interpreter --split-input-file --verify-diagnostics %s | FileCheck %s transform.sequence failures(propagate) { -^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1, %loops:3 = transform.structured.tile %0 [4, 4, 4] : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) +^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1, %loops:3 = transform.structured.tile %0 [4, 4, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } // CHECK-LABEL: func @tile_linalg_matmul( @@ -37,10 +37,10 @@ func.func @tile_linalg_matmul( // ----- transform.sequence failures(propagate) { -^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!pdl.operation) -> !pdl.operation - %2, %loops:3 = transform.structured.tile %0 [%1, %1, 4] : (!pdl.operation, !pdl.operation, !pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) +^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = transform.structured.match ops{["func.call"]} in %arg1 : (!transform.any_op) -> !transform.any_op + %2, %loops:3 = transform.structured.tile %0 [%1, %1, 4] : (!transform.any_op, !transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func private @get_dynamic_tile_size() -> index @@ -77,14 +77,14 @@ func.func @tile_linalg_matmul_dynamic( // ----- transform.sequence failures(propagate) { -^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-note @below {{for this parameter}} %1 = transform.test_produce_integer_param_with_type i64 : !transform.param // expected-error @below {{expected as many parameter values (0) as target ops (2)}} transform.structured.tile %0 [%1, %1, %1] - : (!pdl.operation, !transform.param, !transform.param, !transform.param) - -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) + : (!transform.any_op, !transform.param, !transform.param, !transform.param) + -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @tile_linalg_matmul( @@ -102,14 +102,14 @@ func.func @tile_linalg_matmul( // ----- transform.sequence failures(propagate) { -^bb0(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb0(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["linalg.matmul"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-note @below {{for this handle}} - %1 = transform.structured.match ops{["arith.constant"]} in %arg1 : (!pdl.operation) -> !pdl.operation + %1 = transform.structured.match ops{["arith.constant"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-error @below {{expected as many dynamic size-producing operations (0) as target ops (2)}} transform.structured.tile %0 [%1, %1, 1] - : (!pdl.operation, !pdl.operation, !pdl.operation) - -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation) + : (!transform.any_op, !transform.any_op, !transform.any_op) + -> (!transform.any_op, !transform.any_op, !transform.any_op, !transform.any_op) } func.func @tile_linalg_matmul( diff --git a/mlir/test/Dialect/Linalg/transform-pack-greedily.mlir b/mlir/test/Dialect/Linalg/transform-pack-greedily.mlir index bd567e5..374c1d2 100644 --- a/mlir/test/Dialect/Linalg/transform-pack-greedily.mlir +++ b/mlir/test/Dialect/Linalg/transform-pack-greedily.mlir @@ -21,9 +21,9 @@ func.func @matmul_mk_kn_mn(%A : !A_mk, %B : !B_kn, %C : !C_mn) -> !C_mn { } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): +^bb1(%module_op: !transform.any_op): %matmul = transform.structured.match ops{["linalg.matmul"]} in %module_op - : (!pdl.operation) -> !transform.op<"linalg.matmul"> + : (!transform.any_op) -> !transform.op<"linalg.matmul"> transform.structured.pack_greedily %matmul matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<"linalg.matmul">) -> !transform.op<"linalg.generic"> @@ -67,8 +67,8 @@ func.func @matmul_mk_nk_nm(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): - %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!pdl.operation) -> !transform.op<"linalg.generic"> +^bb1(%module_op: !transform.any_op): + %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!transform.any_op) -> !transform.op<"linalg.generic"> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<"linalg.generic">) -> !transform.op<"linalg.generic"> @@ -112,8 +112,8 @@ func.func @matmul_mk_nk_nm_transposed(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_ } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): - %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!pdl.operation) -> !transform.op<"linalg.generic"> +^bb1(%module_op: !transform.any_op): + %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!transform.any_op) -> !transform.op<"linalg.generic"> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<"linalg.generic">) -> !transform.op<"linalg.generic"> @@ -157,8 +157,8 @@ func.func @contraction_bmkm2_nkb_nbm(%A : !A_bmkm2, %B : !B_nkb, %C : !C_nbm) -> } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): - %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!pdl.operation) -> !transform.op<"linalg.generic"> +^bb1(%module_op: !transform.any_op): + %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!transform.any_op) -> !transform.op<"linalg.generic"> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<"linalg.generic">) -> !transform.op<"linalg.generic"> @@ -191,9 +191,9 @@ func.func @conv_2d_nchw_fchw(%arg0: tensor, %arg2: tensor !transform.op<"linalg.conv_2d_nchw_fchw"> + : (!transform.any_op) -> !transform.op<"linalg.conv_2d_nchw_fchw"> transform.structured.pack_greedily %conv matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<"linalg.conv_2d_nchw_fchw">) -> !transform.op<"linalg.generic"> @@ -220,8 +220,8 @@ func.func @reduce_and_map(%arg0: tensor<10x100xf32>, } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): - %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!pdl.operation) -> !transform.op<"linalg.generic"> +^bb1(%module_op: !transform.any_op): + %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!transform.any_op) -> !transform.op<"linalg.generic"> transform.structured.pack_greedily %generic matmul_packed_sizes = [8, 16, 32] matmul_inner_dims_order = [1, 2, 0] : (!transform.op<"linalg.generic">) -> !transform.op<"linalg.generic"> @@ -265,8 +265,8 @@ func.func @matmul_mk_nk_nm(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): - %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!pdl.operation) -> !transform.op<"linalg.generic"> +^bb1(%module_op: !transform.any_op): + %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!transform.any_op) -> !transform.op<"linalg.generic"> transform.structured.pack_greedily %generic // In this spec, the "k" dimension is not packed but rather padded to the // next multiple of 10 (i.e. 130). @@ -315,8 +315,8 @@ func.func @matmul_mk_nk_nm(%A : !A_mk, %B : !B_nk, %C : !C_nm) -> !C_nm { } transform.sequence failures(propagate) { -^bb1(%module_op: !pdl.operation): - %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!pdl.operation) -> !transform.op<"linalg.generic"> +^bb1(%module_op: !transform.any_op): + %generic = transform.structured.match ops{["linalg.generic"]} in %module_op : (!transform.any_op) -> !transform.op<"linalg.generic"> transform.structured.pack_greedily %generic // In this spec, the "n" dimension is neither packed not unpacked. // We don't end up with an innermost matmul after packing but only with an diff --git a/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir b/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir index 3ef94a0..e824a55 100644 --- a/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir +++ b/mlir/test/Dialect/Linalg/transform-tile-and-fuse.mlir @@ -103,8 +103,8 @@ module { ^bb1(%arg1: !transform.any_op): // Find the root and all producers. %root = transform.structured.match attributes{"__root__"} in %arg1 : (!transform.any_op) -> !transform.any_op - %producers = transform.structured.match attributes{"__producer__"} in %arg1 : (!transform.any_op) -> !pdl.operation - %reversed_producers = transform.test_reverse_payload_ops %producers + %producers = transform.structured.match attributes{"__producer__"} in %arg1 : (!transform.any_op) -> !transform.any_op + %reversed_producers = transform.test_reverse_payload_ops %producers : (!transform.any_op) -> !transform.any_op // Tile the root. %forall_op, %tiled_op = transform.structured.tile_to_forall_op %root num_threads [10, 20] @@ -112,6 +112,6 @@ module { // Fuse all producers. transform.structured.fuse_into_containing_op %reversed_producers into %forall_op - : (!pdl.operation, !transform.any_op) -> !transform.any_op + : (!transform.any_op, !transform.any_op) -> !transform.any_op } } diff --git a/mlir/test/Dialect/Transform/test-interpreter.mlir b/mlir/test/Dialect/Transform/test-interpreter.mlir index fb89d57..bb56bcd 100644 --- a/mlir/test/Dialect/Transform/test-interpreter.mlir +++ b/mlir/test/Dialect/Transform/test-interpreter.mlir @@ -637,7 +637,7 @@ module { func.func private @bar() transform.with_pdl_patterns { - ^bb0(%arg0: !pdl.operation): + ^bb0(%arg0: !transform.any_op): pdl.pattern @func : benefit(1) { %0 = pdl.operands %1 = pdl.types @@ -645,15 +645,15 @@ module { pdl.rewrite %2 with "transform.dialect" } - transform.sequence %arg0 : !pdl.operation failures(propagate) { - ^bb0(%arg1: !pdl.operation): - %0 = pdl_match @func in %arg1 : (!pdl.operation) -> !pdl.operation - %1 = replicate num(%0) %arg1 : !pdl.operation, !pdl.operation + transform.sequence %arg0 : !transform.any_op failures(propagate) { + ^bb0(%arg1: !transform.any_op): + %0 = pdl_match @func in %arg1 : (!transform.any_op) -> !transform.any_op + %1 = replicate num(%0) %arg1 : !transform.any_op, !transform.any_op // expected-remark @below {{2}} - test_print_number_of_associated_payload_ir_ops %1 - %2 = replicate num(%0) %1 : !pdl.operation, !pdl.operation + test_print_number_of_associated_payload_ir_ops %1 : !transform.any_op + %2 = replicate num(%0) %1 : !transform.any_op, !transform.any_op // expected-remark @below {{4}} - test_print_number_of_associated_payload_ir_ops %2 + test_print_number_of_associated_payload_ir_ops %2 : !transform.any_op } } } @@ -669,21 +669,21 @@ func.func @bar() { } transform.with_pdl_patterns { -^bb0(%arg0: !pdl.operation): +^bb0(%arg0: !transform.any_op): pdl.pattern @const : benefit(1) { %r = pdl.types %0 = pdl.operation "arith.constant" -> (%r : !pdl.range) pdl.rewrite %0 with "transform.dialect" } - transform.sequence %arg0 : !pdl.operation failures(propagate) { - ^bb1(%arg1: !pdl.operation): - %f = pdl_match @const in %arg1 : (!pdl.operation) -> !pdl.operation - transform.foreach %f : !pdl.operation { - ^bb2(%arg2: !pdl.operation): + transform.sequence %arg0 : !transform.any_op failures(propagate) { + ^bb1(%arg1: !transform.any_op): + %f = pdl_match @const in %arg1 : (!transform.any_op) -> !transform.any_op + transform.foreach %f : !transform.any_op { + ^bb2(%arg2: !transform.any_op): // expected-remark @below {{1}} - transform.test_print_number_of_associated_payload_ir_ops %arg2 - transform.test_print_remark_at_operand %arg2, "transform applied" : !pdl.operation + transform.test_print_number_of_associated_payload_ir_ops %arg2 : !transform.any_op + transform.test_print_remark_at_operand %arg2, "transform applied" : !transform.any_op } } } @@ -709,7 +709,7 @@ func.func @bar() { } transform.with_pdl_patterns { -^bb0(%arg0: !pdl.operation): +^bb0(%arg0: !transform.any_op): pdl.pattern @const : benefit(1) { %r = pdl.types %0 = pdl.operation "arith.constant" -> (%r : !pdl.range) @@ -722,18 +722,18 @@ transform.with_pdl_patterns { pdl.rewrite %0 with "transform.dialect" } - transform.sequence %arg0 : !pdl.operation failures(propagate) { - ^bb1(%arg1: !pdl.operation): - %f = pdl_match @execute_region in %arg1 : (!pdl.operation) -> !pdl.operation - %results = transform.foreach %f : !pdl.operation -> !pdl.operation { - ^bb2(%arg2: !pdl.operation): - %g = transform.pdl_match @const in %arg2 : (!pdl.operation) -> !pdl.operation - transform.yield %g : !pdl.operation + transform.sequence %arg0 : !transform.any_op failures(propagate) { + ^bb1(%arg1: !transform.any_op): + %f = pdl_match @execute_region in %arg1 : (!transform.any_op) -> !transform.any_op + %results = transform.foreach %f : !transform.any_op -> !transform.any_op { + ^bb2(%arg2: !transform.any_op): + %g = transform.pdl_match @const in %arg2 : (!transform.any_op) -> !transform.any_op + transform.yield %g : !transform.any_op } // expected-remark @below {{3}} - transform.test_print_number_of_associated_payload_ir_ops %results - transform.test_print_remark_at_operand %results, "transform applied" : !pdl.operation + transform.test_print_number_of_associated_payload_ir_ops %results : !transform.any_op + transform.test_print_remark_at_operand %results, "transform applied" : !transform.any_op } } @@ -825,14 +825,14 @@ func.func @split_handle(%a: index, %b: index, %c: index) { } transform.sequence failures(propagate) { -^bb1(%fun: !pdl.operation): - %muli = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation - %h:2 = split_handle %muli : (!pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%fun: !transform.any_op): + %muli = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op + %h:2 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op) // expected-remark @below {{1}} - transform.test_print_number_of_associated_payload_ir_ops %h#0 - %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation + transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op + %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op // expected-error @below {{expected to contain 3 payload ops but it contains 2 payload ops}} - %h_2:3 = split_handle %muli_2 : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation) + %h_2:3 = split_handle %muli_2 : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) } // ----- @@ -844,16 +844,16 @@ func.func @split_handle(%a: index, %b: index, %c: index) { } transform.sequence failures(suppress) { -^bb1(%fun: !pdl.operation): - %muli = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation - %h:2 = split_handle %muli : (!pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%fun: !transform.any_op): + %muli = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op + %h:2 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op) // expected-remark @below {{1}} - transform.test_print_number_of_associated_payload_ir_ops %h#0 - %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation + transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op + %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op // Silenceable failure and all handles are now empty. - %h_2:3 = split_handle %muli_2 : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation) + %h_2:3 = split_handle %muli_2 : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) // expected-remark @below {{0}} - transform.test_print_number_of_associated_payload_ir_ops %h_2#0 + transform.test_print_number_of_associated_payload_ir_ops %h_2#0 : !transform.any_op } // ----- @@ -865,16 +865,16 @@ func.func @split_handle(%a: index, %b: index, %c: index) { } transform.sequence failures(propagate) { -^bb1(%fun: !pdl.operation): - %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation +^bb1(%fun: !transform.any_op): + %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op // No error, last result handle is empty. - %h:3 = split_handle %muli_2 {fail_on_payload_too_small = false} : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation) + %h:3 = split_handle %muli_2 {fail_on_payload_too_small = false} : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) // expected-remark @below {{1}} - transform.test_print_number_of_associated_payload_ir_ops %h#0 + transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op // expected-remark @below {{1}} - transform.test_print_number_of_associated_payload_ir_ops %h#1 + transform.test_print_number_of_associated_payload_ir_ops %h#1 : !transform.any_op // expected-remark @below {{0}} - transform.test_print_number_of_associated_payload_ir_ops %h#2 + transform.test_print_number_of_associated_payload_ir_ops %h#2 : !transform.any_op } // ----- @@ -888,13 +888,13 @@ func.func @split_handle(%a: index, %b: index, %c: index) { } transform.sequence failures(propagate) { -^bb1(%fun: !pdl.operation): - %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation - %h:2 = split_handle %muli_2 {overflow_result = 0} : (!pdl.operation) -> (!pdl.operation, !pdl.operation) +^bb1(%fun: !transform.any_op): + %muli_2 = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op + %h:2 = split_handle %muli_2 {overflow_result = 0} : (!transform.any_op) -> (!transform.any_op, !transform.any_op) // expected-remark @below {{3}} - transform.test_print_number_of_associated_payload_ir_ops %h#0 + transform.test_print_number_of_associated_payload_ir_ops %h#0 : !transform.any_op // expected-remark @below {{1}} - transform.test_print_number_of_associated_payload_ir_ops %h#1 + transform.test_print_number_of_associated_payload_ir_ops %h#1 : !transform.any_op } // ----- @@ -903,17 +903,17 @@ transform.sequence failures(propagate) { "other_dialect.other_op"() : () -> () transform.with_pdl_patterns { -^bb0(%arg0: !pdl.operation): +^bb0(%arg0: !transform.any_op): pdl.pattern @some : benefit(1) { %0 = pdl.operation "test.some_op" pdl.rewrite %0 with "transform.dialect" } - sequence %arg0 : !pdl.operation failures(propagate) { - ^bb1(%arg1: !pdl.operation): - %0 = pdl_match @some in %arg1 : (!pdl.operation) -> !pdl.operation - %2 = transform.cast %0 : !pdl.operation to !transform.test_dialect_op - transform.cast %2 : !transform.test_dialect_op to !pdl.operation + sequence %arg0 : !transform.any_op failures(propagate) { + ^bb1(%arg1: !transform.any_op): + %0 = pdl_match @some in %arg1 : (!transform.any_op) -> !transform.any_op + %2 = transform.cast %0 : !transform.any_op to !transform.test_dialect_op + transform.cast %2 : !transform.test_dialect_op to !transform.any_op } } @@ -1013,14 +1013,14 @@ func.func @split_handle(%a: index, %b: index, %c: index) { return } -transform.sequence -> !pdl.operation failures(propagate) { -^bb1(%fun: !pdl.operation): - %muli = transform.structured.match ops{["arith.muli"]} in %fun : (!pdl.operation) -> !pdl.operation +transform.sequence -> !transform.any_op failures(propagate) { +^bb1(%fun: !transform.any_op): + %muli = transform.structured.match ops{["arith.muli"]} in %fun : (!transform.any_op) -> !transform.any_op // expected-error @below {{expected to contain 3 payload ops but it contains 2 payload ops}} - %h_2:3 = split_handle %muli : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation) + %h_2:3 = split_handle %muli : (!transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op) /// Test that yield does not crash in the presence of silenceable error in /// propagate mode. - yield %fun : !pdl.operation + yield %fun : !transform.any_op } // ----- @@ -1613,11 +1613,11 @@ func.func @test_tracked_rewrite() { } transform.sequence failures(propagate) { -^bb1(%arg1: !pdl.operation): - %0 = transform.structured.match ops{["test.replace_me"]} in %arg1 : (!pdl.operation) -> !pdl.operation +^bb1(%arg1: !transform.any_op): + %0 = transform.structured.match ops{["test.replace_me"]} in %arg1 : (!transform.any_op) -> !transform.any_op // expected-remark @below {{2 iterations}} - transform.test_tracked_rewrite %0 : (!pdl.operation) -> () + transform.test_tracked_rewrite %0 : (!transform.any_op) -> () // One replacement op (test.drop_mapping) is dropped from the mapping. // expected-remark @below {{2}} - test_print_number_of_associated_payload_ir_ops %0 + test_print_number_of_associated_payload_ir_ops %0 : !transform.any_op } diff --git a/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.td b/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.td index c77f6ea..3848ff6 100644 --- a/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.td +++ b/mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.td @@ -193,9 +193,9 @@ def TestReversePayloadOpsOp : Op]> { - let arguments = (ins PDL_Operation:$target); - let results = (outs PDL_Operation:$result); - let assemblyFormat = "$target attr-dict"; + let arguments = (ins TransformHandleTypeInterface:$target); + let results = (outs TransformHandleTypeInterface:$result); + let assemblyFormat = "$target attr-dict `:` functional-type(operands, results)"; let cppNamespace = "::mlir::test"; } @@ -315,8 +315,8 @@ def TestPrintNumberOfAssociatedPayloadIROps : Op, DeclareOpInterfaceMethods]> { - let arguments = (ins PDL_Operation:$handle); - let assemblyFormat = "$handle attr-dict"; + let arguments = (ins TransformHandleTypeInterface:$handle); + let assemblyFormat = "$handle attr-dict `:` type($handle)"; let cppNamespace = "::mlir::test"; } -- 2.7.4