@@ -133,6 +133,8 @@ This will generate two files, `MyExtension.h.inc` and `MyExtension.cpp.inc`, tha
133
133
``` c++
134
134
// In MyExtension.cpp.
135
135
136
+ #include " MyExtension.h"
137
+
136
138
#define GET_OP_CLASSES
137
139
#include " MyExtension.cpp.inc"
138
140
@@ -283,7 +285,7 @@ void registerMyExtension(::mlir::DialectRegistry ®istry) {
283
285
}
284
286
```
285
287
286
- After registering the extension, it becomes possible to use our new operation in the Transform dialect interpreter. The upstream testing pass can be used as is.
288
+ After registering the extension, it becomes possible to use our new operation in the Transform dialect interpreter. The upstream testing pass can be used as is. It actually exists in `mlir/test/Examples/transform/Ch2/sequence.mlir`, which contains the `microkernel` implementation.
287
289
288
290
```mlir
289
291
module attributes {transform.with_named_sequence} {
@@ -300,7 +302,7 @@ module attributes {transform.with_named_sequence} {
300
302
301
303
// The actual tiling transformation takes tile sizes as attributes. It
302
304
// produces a handle to the loop generated during tiling.
303
- %loop , %tiled = transform.structured.tile_using_forall %max
305
+ %tiled , %loop = transform.structured.tile_using_forall %max
304
306
tile_sizes [8, 32]
305
307
: (!transform.any_op) -> (!transform.any_op, !transform.any_op)
306
308
@@ -311,32 +313,32 @@ module attributes {transform.with_named_sequence} {
311
313
// a single handle to all operations and give it to
312
314
// `fuse_into_containing_op` that would take care of the ordering in this
313
315
// case.
314
- %add_fused = transform.structured.fuse_into_containing_op %add into %loop
315
- : (!transform.any_op, !transform.any_op) -> !transform.any_op
316
- %matmul_fused = transform.structured.fuse_into_containing_op %arg1
317
- into %loop
316
+ %add_fused, %loop2 = transform.structured.fuse_into_containing_op %add into %loop
317
+ : (!transform.any_op, !transform.any_op) -> ( !transform.any_op, !transform.any_op)
318
+ %matmul_fused, %loop3 = transform.structured.fuse_into_containing_op %arg1
319
+ into %loop2
318
320
: (!transform.op<"linalg.matmul">, !transform.any_op)
319
- -> !transform.any_op
321
+ -> ( !transform.any_op, !transform.any_op)
320
322
321
323
// Tile again to get the desired size. Note that this time this tiles the
322
324
// "add" operation and fuses matmul into the loop, but doesn't affect the
323
325
// "max" operation. This illustrates the precise targeting with the
324
326
// transform dialect. Otherwise, it is difficult to differentiate "add" and
325
327
// "max", both of which having the same kind.
326
- %loop_2 , %tiled_2 = transform.structured.tile_using_forall %add_fused
328
+ %tiled_second , %loop_second = transform.structured.tile_using_forall %add_fused
327
329
tile_sizes [4, 4]
328
330
: (!transform.any_op) -> (!transform.any_op, !transform.any_op)
329
- %matmul_fused_2 = transform.structured.fuse_into_containing_op %matmul_fused
330
- into %loop_2
331
- : (!transform.any_op, !transform.any_op) -> !transform.any_op
331
+ %matmul_fused_2, %loop_second_2 = transform.structured.fuse_into_containing_op %matmul_fused
332
+ into %loop_second
333
+ : (!transform.any_op, !transform.any_op) -> ( !transform.any_op, !transform.any_op)
332
334
333
335
// Since outlining is currently only implemented for region-holding
334
336
// operations such as loops, use tiling to size 1 to materialize the outer
335
337
// loop that is going to be outlined.
336
- %outline_target , %_ = transform.structured.tile_using_forall %tiled_2 tile_sizes [1]
338
+ %_0 , %loop_third = transform.structured.tile_using_forall %tiled_second tile_sizes [1]
337
339
: (!transform.any_op) -> (!transform.any_op, !transform.any_op)
338
- transform.structured.fuse_into_containing_op %matmul_fused_2 into %outline_target
339
- : (!transform.any_op, !transform.any_op) -> !transform.any_op
340
+ %_1, %outline_target = transform.structured.fuse_into_containing_op %matmul_fused_2 into %loop_third
341
+ : (!transform.any_op, !transform.any_op) -> ( !transform.any_op, !transform.any_op)
340
342
%func, %call = transform.loop.outline %outline_target
341
343
{func_name = "outlined"}
342
344
: (!transform.any_op) -> (!transform.any_op, !transform.any_op)
0 commit comments