@@ -11,7 +11,8 @@ module attributes {transform.with_named_sequence} {
11
11
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
12
12
%matmul = transform.structured.match ops {[" linalg.matmul" ]} in %arg1
13
13
: (!transform.any_op ) -> !transform.any_op
14
- transform.structured.convert_to_loops %matmul : !transform.any_op
14
+ %0 = transform.structured.convert_to_loops %matmul
15
+ : (!transform.any_op ) -> (!transform.any_op )
15
16
transform.yield
16
17
}
17
18
}
@@ -37,6 +38,57 @@ module attributes {transform.with_named_sequence} {
37
38
38
39
// -----
39
40
41
+ func.func @gemm (%arg0 : memref <?x?xf32 >, %arg1 : memref <?x?xf32 >,
42
+ %arg2 : memref <?x?xf32 >, %arg3 : memref <?xf32 >, %arg4 : memref <?xf32 >) {
43
+ linalg.matmul ins (%arg0 , %arg1 : memref <?x?xf32 >, memref <?x?xf32 >)
44
+ outs (%arg2 : memref <?x?xf32 >)
45
+ linalg.matvec ins (%arg0 , %arg3 : memref <?x?xf32 >, memref <?xf32 >)
46
+ outs (%arg4 : memref <?xf32 >)
47
+ return
48
+ }
49
+
50
+ module attributes {transform.with_named_sequence } {
51
+ transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
52
+ %linalg_ops = transform.structured.match interface {TilingInterface } in %arg1
53
+ : (!transform.any_op ) -> !transform.any_op
54
+ %0 = transform.structured.convert_to_loops %linalg_ops
55
+ : (!transform.any_op ) -> (!transform.any_op )
56
+ %1:5 = transform.split_handle %0
57
+ : (!transform.any_op ) -> (!transform.any_op , !transform.any_op , !transform.any_op , !transform.any_op , !transform.any_op )
58
+ transform.yield
59
+ }
60
+ }
61
+ // CHECK-LABEL: func @gemm
62
+ // CHECK-SAME: %[[ARG0:[a-zA-Z0-9]+]]: memref<?x?xf32>
63
+ // CHECK-SAME: %[[ARG1:[a-zA-Z0-9]+]]: memref<?x?xf32>
64
+ // CHECK-SAME: %[[ARG2:[a-zA-Z0-9]+]]: memref<?x?xf32>
65
+ // CHECK-SAME: %[[ARG3:[a-zA-Z0-9]+]]: memref<?xf32>
66
+ // CHECK-SAME: %[[ARG4:[a-zA-Z0-9]+]]: memref<?xf32>
67
+ // CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
68
+ // CHECK-DAG: %[[M:.+]] = memref.dim %[[ARG0]], %[[C0]]
69
+ // CHECK-DAG: %[[C1:.+]] = arith.constant 1 : index
70
+ // CHECK-DAG: %[[K:.+]] = memref.dim %[[ARG0]], %[[C1]]
71
+ // CHECK-DAG: %[[N:.+]] = memref.dim %[[ARG1]], %[[C1]]
72
+ // CHECK: scf.for %[[IV0:[a-zA-Z0-9]+]] = %[[C0]] to %[[M]] step %[[C1]]
73
+ // CHECK: scf.for %[[IV1:[a-zA-Z0-9]+]] = %[[C0]] to %[[N]] step %[[C1]]
74
+ // CHECK: scf.for %[[IV2:[a-zA-Z0-9]+]] = %[[C0]] to %[[K]] step %[[C1]]
75
+ // CHECK-DAG: %[[LHS:.+]] = memref.load %[[ARG0]][%[[IV0]], %[[IV2]]]
76
+ // CHECK-DAG: %[[RHS:.+]] = memref.load %[[ARG1]][%[[IV2]], %[[IV1]]]
77
+ // CHECK-DAG: %[[OUT:.+]] = memref.load %[[ARG2]][%[[IV0]], %[[IV1]]]
78
+ // CHECK: %[[MULF:.+]] = arith.mulf %[[LHS]], %[[RHS]]
79
+ // CHECK: %[[ADDF:.+]] = arith.addf %[[OUT]], %[[MULF]]
80
+ // CHECK: memref.store %[[ADDF]], %[[ARG2]][%[[IV0]], %[[IV1]]]
81
+ // CHECK: scf.for %[[IV3:[a-zA-Z0-9]+]] = %[[C0]] to %[[M]] step %[[C1]]
82
+ // CHECK: scf.for %[[IV4:[a-zA-Z0-9]+]] = %[[C0]] to %[[K]] step %[[C1]]
83
+ // CHECK-DAG: %[[LHS:.+]] = memref.load %[[ARG0]][%[[IV3]], %[[IV4]]]
84
+ // CHECK-DAG: %[[RHS:.+]] = memref.load %[[ARG3]][%[[IV4]]]
85
+ // CHECK-DAG: %[[OUT:.+]] = memref.load %[[ARG4]][%[[IV3]]]
86
+ // CHECK: %[[MULF:.+]] = arith.mulf %[[LHS]], %[[RHS]]
87
+ // CHECK: %[[ADDF:.+]] = arith.addf %[[OUT]], %[[MULF]]
88
+ // CHECK: memref.store %[[ADDF]], %[[ARG4]][%[[IV3]]]
89
+
90
+ // -----
91
+
40
92
func.func @indexed_generic (%arg0 : memref <200 x300 xi32 >, %arg1 : memref <300 xi16 >,
41
93
%arg2 : memref <200 xi8 >, %arg3 : memref <300 x200 xi64 >) {
42
94
linalg.generic {
@@ -66,7 +118,8 @@ module attributes {transform.with_named_sequence} {
66
118
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
67
119
%generic = transform.structured.match ops {[" linalg.generic" ]} in %arg1
68
120
: (!transform.any_op ) -> !transform.any_op
69
- transform.structured.convert_to_loops %generic : !transform.any_op
121
+ %0 = transform.structured.convert_to_loops %generic
122
+ : (!transform.any_op ) -> (!transform.any_op )
70
123
transform.yield
71
124
}
72
125
}
@@ -111,7 +164,8 @@ module attributes {transform.with_named_sequence} {
111
164
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
112
165
%conv = transform.structured.match ops {[" linalg.conv_2d_nhwc_hwcf" ]} in %arg1
113
166
: (!transform.any_op ) -> !transform.any_op
114
- transform.structured.convert_to_loops %conv : !transform.any_op
167
+ %0 = transform.structured.convert_to_loops %conv
168
+ : (!transform.any_op ) -> (!transform.any_op )
115
169
transform.yield
116
170
}
117
171
}
@@ -165,7 +219,8 @@ module attributes {transform.with_named_sequence} {
165
219
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
166
220
%pool = transform.structured.match ops {[" linalg.pooling_nhwc_max" ]} in %arg1
167
221
: (!transform.any_op ) -> !transform.any_op
168
- transform.structured.convert_to_loops %pool : !transform.any_op
222
+ %0 = transform.structured.convert_to_loops %pool
223
+ : (!transform.any_op ) -> (!transform.any_op )
169
224
transform.yield
170
225
}
171
226
}
@@ -216,7 +271,8 @@ module attributes {transform.with_named_sequence} {
216
271
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
217
272
%map = transform.structured.match ops {[" linalg.map" ]} in %arg1
218
273
: (!transform.any_op ) -> !transform.any_op
219
- transform.structured.convert_to_loops %map : !transform.any_op
274
+ %0 = transform.structured.convert_to_loops %map
275
+ : (!transform.any_op ) -> (!transform.any_op )
220
276
transform.yield
221
277
}
222
278
}
@@ -248,7 +304,8 @@ module attributes {transform.with_named_sequence} {
248
304
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
249
305
%transpose = transform.structured.match ops {[" linalg.transpose" ]} in %arg1
250
306
: (!transform.any_op ) -> !transform.any_op
251
- transform.structured.convert_to_loops %transpose : !transform.any_op
307
+ %0 = transform.structured.convert_to_loops %transpose
308
+ : (!transform.any_op ) -> (!transform.any_op )
252
309
transform.yield
253
310
}
254
311
}
@@ -285,7 +342,8 @@ module attributes {transform.with_named_sequence} {
285
342
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
286
343
%reduce = transform.structured.match ops {[" linalg.reduce" ]} in %arg1
287
344
: (!transform.any_op ) -> !transform.any_op
288
- transform.structured.convert_to_loops %reduce : !transform.any_op
345
+ %0 = transform.structured.convert_to_loops %reduce
346
+ : (!transform.any_op ) -> (!transform.any_op )
289
347
transform.yield
290
348
}
291
349
}
@@ -322,7 +380,8 @@ module attributes {transform.with_named_sequence} {
322
380
transform.named_sequence @__transform_main (%arg1 : !transform.any_op {transform.readonly }) {
323
381
%broadcast = transform.structured.match ops {[" linalg.broadcast" ]} in %arg1
324
382
: (!transform.any_op ) -> !transform.any_op
325
- transform.structured.convert_to_loops %broadcast : !transform.any_op
383
+ %0 = transform.structured.convert_to_loops %broadcast
384
+ : (!transform.any_op ) -> (!transform.any_op )
326
385
transform.yield
327
386
}
328
387
}
0 commit comments