@@ -19,13 +19,13 @@ func.func @fc_relu(%lhs: tensor<512x512xf32>, %rhs: tensor<512x512xf32>,
1919 outs(%output: tensor<512x512xf32>) -> tensor<512x512xf32>
2020
2121 // Elementwise addition.
22- %biased = linalg.elemwise_binary { fun = #linalg.binary_fn <add> }
22+ %biased = linalg.elementwise kind= #linalg.elementwise_kind <add>
2323 ins(%matmul, %bias : tensor<512x512xf32>, tensor<512x512xf32>)
2424 outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
2525
2626 // Elementwise max with 0 (ReLU).
2727 %c0f = arith.constant 0.0 : f32
28- %relued = linalg.elemwise_binary { fun = #linalg.binary_fn <max_signed> }
28+ %relued = linalg.elementwise kind= #linalg.elementwise_kind <max_signed>
2929 ins(%biased, %c0f : tensor<512x512xf32>, f32)
3030 outs(%output : tensor<512x512xf32>) -> tensor<512x512xf32>
3131 func.return %relued : tensor<512x512xf32>
@@ -41,7 +41,7 @@ module attributes {transform.with_named_sequence} {
4141 transform.named_sequence @__transform_main(
4242 %arg0: !transform.any_op,
4343 %arg1: !transform.op<"linalg.matmul">,
44- %arg2: !transform.op<"linalg.elemwise_binary ">):
44+ %arg2: !transform.op<"linalg.elementwise ">):
4545 transform.yield
4646 }
4747}
@@ -72,11 +72,11 @@ To check or debug a transform sequence, it is possible to print various entities
7272transform.sequence failures(propagate) {
7373^bb0(%arg0: !transform.any_op,
7474 %arg1: !transform.op<"linalg.matmul">,
75- %arg2: !transform.op<"linalg.elemwise_binary ">):
75+ %arg2: !transform.op<"linalg.elementwise ">):
7676 transform.debug.emit_remark_at %arg1, "matmul"
7777 : !transform.op<"linalg.matmul">
7878 transform.debug.emit_remark_at %arg2, "elemwise_binaries"
79- : !transform.op<"linalg.elemwise_binary ">
79+ : !transform.op<"linalg.elementwise ">
8080 transform.yield
8181}
8282```
@@ -89,24 +89,24 @@ Since we don’t want to recompile the compiler every time we change a transform
8989``` sh
9090$ mlir-opt sequence.mlir --pass-pipeline="
9191 builtin.module(transform-interpreter{
92- debug-bind-trailing-args=linalg.matmul,linalg.elemwise_binary })"
92+ debug-bind-trailing-args=linalg.matmul,linalg.elementwise })"
9393```
9494
95- The ` sequence.mlir ` file contains _ both_ the payload IR function _ and_ the transform IR sequence nested in the same module. The transform interpreter pass will apply the ` @__transform_main ` named sequence to the anchor operation of the pass. In our case, we also asked the interpreter pass to associate the two extra arguments of the top-level sequence with all ` linalg.matmul ` and ` linalg.elemwise_binary ` payload operations through the respective pass options. Running this pass results in the expected remarks:
95+ The ` sequence.mlir ` file contains _ both_ the payload IR function _ and_ the transform IR sequence nested in the same module. The transform interpreter pass will apply the ` @__transform_main ` named sequence to the anchor operation of the pass. In our case, we also asked the interpreter pass to associate the two extra arguments of the top-level sequence with all ` linalg.matmul ` and ` linalg.elementwise ` payload operations through the respective pass options. Running this pass results in the expected remarks:
9696
9797``` sh
9898sequence.mlir:7:13: remark: matmul
9999 %matmul = linalg.matmul ins(%lhs, %rhs: tensor< 512x512xf32> , tensor< 512x512xf32> )
100100 ^
101101sequence.mlir:7:13: note: see current operation: %0 = linalg.matmul ins(%arg0, %arg1 : tensor< 512x512xf32> , tensor< 512x512xf32> ) outs(%arg3 : tensor< 512x512xf32> ) -> tensor< 512x512xf32>
102102sequence.mlir:10:13: remark: elemwise_binaries
103- %biased = linalg.elemwise_binary { fun = # linalg.binary_fn <add> }
103+ %biased = linalg.elementwise kind= # linalg.elementwise_kind <add>
104104 ^
105- sequence.mlir:10:13: note: see current operation: %1 = linalg.elemwise_binary {fun = # linalg.binary_fn <add>} ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
105+ sequence.mlir:10:13: note: see current operation: %1 = linalg.elementwise kind= # linalg.elementwise_kind <add>> ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
106106sequence.mlir:14:13: remark: elemwise_binaries
107- %relued = linalg.elemwise_binary { fun = # linalg.binary_fn <max_signed> }
107+ %relued = linalg.elementwise kind= # linalg.elementwise_kind <max_signed>
108108 ^
109- sequence.mlir:14:13: note: see current operation: %2 = linalg.elemwise_binary {fun = # linalg.binary_fn <max_signed>} ins(%1, %cst : tensor<512x512xf32>, f32) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
109+ sequence.mlir:14:13: note: see current operation: %2 = linalg.elementwise kind= # linalg.elementwise_kind <max_signed>> ins(%1, %cst : tensor<512x512xf32>, f32) outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
110110```
111111
112112Note that ` %arg2 ` is associated with both elementwise payload operations. Any handle is associated with a list of entities. Individual transformations may or may not care about the order of elements in that list.
@@ -121,7 +121,7 @@ module attributes {transform.with_named_sequence} {
121121 transform.named_sequence @__transform_main(
122122 %arg0: !transform.any_op,
123123 %arg1: !transform.op<"linalg.matmul">,
124- %arg2: ! transform.op< " linalg.elemwise_binary " > ) {
124+ %arg2: !transform.op<"linalg.elementwise ">) {
125125 // The actual tiling transformation takes tile sizes as attributes.
126126 %loop, %tiled = transform.structured.tile_using_forall %arg1
127127 tile_sizes [4, 32]
@@ -163,10 +163,10 @@ func.func @fc_relu(%arg0: tensor<512x512xf32>,
163163 : tensor<4x32xf32> into tensor<512x512xf32>
164164 }
165165 }
166- %1 = linalg.elemwise_binary {fun = # linalg.binary_fn <add>}
166+ %1 = linalg.elementwise kind= #linalg.elementwise_kind <add>>
167167 ins(%0, %arg2 : tensor<512x512xf32>, tensor<512x512xf32>)
168168 outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
169- %2 = linalg.elemwise_binary {fun = # linalg.binary_fn <max_signed>}
169+ %2 = linalg.elementwise kind= #linalg.elementwise_kind <max_signed>>
170170 ins(%1, %cst : tensor<512x512xf32>, f32)
171171 outs(%arg3 : tensor<512x512xf32>) -> tensor<512x512xf32>
172172 return %2 : tensor<512x512xf32>
@@ -185,7 +185,7 @@ module attributes {transform.with_named_sequence} {
185185 transform.named_sequence @__transform_main(
186186 %arg0: !transform.any_op,
187187 %arg1: !transform.op<"linalg.matmul">,
188- %arg2: ! transform.op< " linalg.elemwise_binary " > ) {
188+ %arg2: !transform.op<"linalg.elementwise ">) {
189189 // The actual tiling transformation takes tile sizes as attributes.
190190 %loop, %tiled = transform.structured.tile_using_forall %arg1 tile_sizes [4, 32]
191191 : (!transform.op<"linalg.matmul">) -> (!transform.any_op, !transform.any_op)
@@ -219,7 +219,7 @@ module attributes {transform.with_named_sequence} {
219219 transform.named_sequence @__transform_main
220220 %arg0: !transform.any_op,
221221 %arg1: !transform.op<"linalg.matmul">,
222- %arg2: ! transform.op< " linalg.elemwise_binary " > ) {
222+ %arg2: !transform.op<"linalg.elementwise ">) {
223223 // We can cast one type to another as long as operations are compatible
224224 // with both types. This creates "aliasing" handles.
225225 %casted = transform.cast %arg1 : !transform.op<"linalg.matmul">
@@ -248,7 +248,7 @@ sequence.mlir:28:3: error: op uses a handle invalidated by a previously executed
248248 transform.debug.emit_remark_at %matmul, " elemwise_binaries" : ! transform.op< " linalg.matmul" >
249249 ^
250250sequence.mlir:21:29: note: handle to invalidated ops
251- ^bb0(%root: ! transform.any_op, %matmul: ! transform.op< " linalg.matmul" > , %elemwise: ! transform.op< " linalg.elemwise_binary " > ):
251+ ^bb0(%root: ! transform.any_op, %matmul: ! transform.op< " linalg.matmul" > , %elemwise: ! transform.op< " linalg.elementwise " > ):
252252 ^
253253sequence.mlir:27:19: note: invalidated by this transform op that consumes its operand # 0 and invalidates all handles to payload IR entities associated with this operand and entities nested in them
254254 %loop, %tiled = transform.structured.tile_using_forall %mm tile_sizes [4, 32]
@@ -263,12 +263,12 @@ module attributes {transform.with_named_sequence} {
263263 transform.named_sequence @__transform_main(
264264 %arg0: !transform.any_op,
265265 %arg1: !transform.op<"linalg.matmul">,
266- %arg2: ! transform.op< " linalg.elemwise_binary " > ) {
266+ %arg2: !transform.op<"linalg.elementwise ">) {
267267 // Since the %arg2 handle is associated with both elementwise operations,
268268 // we need to split it into two handles so we can target only the second
269269 // elementwise operation.
270270 %add, %max = transform.split_handle %arg2
271- : (! transform.op< " linalg.elemwise_binary " > )
271+ : (!transform.op<"linalg.elementwise ">)
272272 -> (!transform.any_op, !transform.any_op)
273273
274274 // The actual tiling transformation takes tile sizes as attributes. It
@@ -308,12 +308,12 @@ module attributes {transform.with_named_sequence} {
308308 transform.named_sequence @__transform_main(
309309 %arg0: !transform.any_op,
310310 %arg1: !transform.op<"linalg.matmul">,
311- %arg2: ! transform.op< " linalg.elemwise_binary " > ) {
311+ %arg2: !transform.op<"linalg.elementwise ">) {
312312 // Since the %arg2 handle is associated with both elementwise operations,
313313 // we need to split it into two handles so we can target only the second
314314 // elementwise operation.
315315 %add, %max = transform.split_handle %arg2
316- : (! transform.op< " linalg.elemwise_binary " > )
316+ : (!transform.op<"linalg.elementwise ">)
317317 -> (!transform.any_op, !transform.any_op)
318318
319319 // The actual tiling transformation takes tile sizes as attributes. It
@@ -384,7 +384,7 @@ test/Examples/transform/Ch1/invalidation-2.mlir:106:18: note: invalidated by thi
384384 %func, %call = transform.loop.outline %outline_target {func_name = " outlined" }
385385 ^
386386test/Examples/transform/Ch1/invalidation-2.mlir:24:13: note: ancestor payload op
387- %biased = linalg.elemwise_binary { fun = #linalg.binary_fn <add> }
387+ %biased = linalg.elementwise kind= # linalg.elementwise_kind <add>
388388 ^
389389test/Examples/transform/Ch1/invalidation-2.mlir:24:13: note: nested payload op
390390 %matmul = linalg.matmul ins(%lhs, %rhs: tensor< 512x512xf32> , tensor< 512x512xf32> )
0 commit comments