@@ -1158,6 +1158,7 @@ module attributes {transform.with_named_sequence} {
1158
1158
// -----
1159
1159
1160
1160
// CHECK-LABEL: func @test_vectorize_dynamic_shapes_unpack
1161
+ // CHECK-SAME: %[[ARG_0:.*]]: tensor<?x?xf32>,
1161
1162
func.func @test_vectorize_dynamic_shapes_unpack (%arg0: tensor <?x?xf32 >, %arg1: tensor <?x?x16 x2 xf32 >) -> tensor <?x?xf32 > {
1162
1163
// CHECK: %[[C0:.*]] = arith.constant 0
1163
1164
// CHECK: %[[DIM:.*]] = tensor.dim %arg0, %[[C0]] : tensor<?x?xf32>
@@ -1175,9 +1176,8 @@ func.func @test_vectorize_dynamic_shapes_unpack(%arg0: tensor<?x?xf32>, %arg1: t
1175
1176
// CHECK: %[[read0:.*]] = vector.mask %[[readMsk0]] {{.*}} vector.transfer_read %{{.*}} : tensor<?x?x16x2xf32>, vector<2x1x16x2xf32> } : vector<2x1x16x2xi1> -> vector<2x1x16x2xf32>
1176
1177
// CHECK: %[[trans0:.*]] = vector.transpose %[[read0]], [0, 3, 1, 2] : vector<2x1x16x2xf32> to vector<2x2x1x16xf32>
1177
1178
// CHECK: %[[sc0:.*]] = vector.shape_cast %[[trans0]] : vector<2x2x1x16xf32> to vector<4x16xf32>
1178
- // CHECK: %[[empt0:.*]] = tensor.empty
1179
1179
// CHECK: %[[writeMsk0:.*]] = vector.create_mask {{.*}} : vector<4x16xi1>
1180
- // CHECK: %[[write0:.*]] = vector.mask %[[writeMsk0:.*]] {{.*}} vector.transfer_write %[[sc0]], %[[empt0 ]]
1180
+ // CHECK: %[[write0:.*]] = vector.mask %[[writeMsk0:.*]] {{.*}} vector.transfer_write %[[sc0]], %[[ARG_0 ]]
1181
1181
// CHECK: return %[[write0]]
1182
1182
%ret = linalg.unpack %arg1 inner_dims_pos = [1 , 0 ] inner_tiles = [16 , 2 ] into %arg0 : tensor <?x?x16 x2 xf32 > -> tensor <?x?xf32 >
1183
1183
return %ret : tensor <?x?xf32 >
@@ -1193,6 +1193,8 @@ module attributes {transform.with_named_sequence} {
1193
1193
// -----
1194
1194
1195
1195
// CHECK-LABEL: func @test_vectorize_unpack
1196
+ // CHECK-SAME: %[[SRC:.*]]: tensor<8x8x32x16xf32>
1197
+ // CHECK-SAME: %[[DEST:.*]]: tensor<256x128xf32>
1196
1198
func.func @test_vectorize_unpack (%source: tensor <8 x8 x32 x16 xf32 >, %dest: tensor <256 x128 xf32 >) -> tensor <256 x128 xf32 > {
1197
1199
// CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32
1198
1200
// CHECK: %[[C0:.*]]= arith.constant 0 : index
@@ -1201,15 +1203,14 @@ func.func @test_vectorize_unpack(%source: tensor<8x8x32x16xf32>, %dest: tensor<2
1201
1203
// CHECK: %[[C32:.*]] = arith.constant 32 : index
1202
1204
// CHECK: %[[C16:.*]] = arith.constant 16 : index
1203
1205
// CHECK: %[[MSK0:.*]] = vector.create_mask %[[C8]], %[[C80]], %[[C32]], %[[C16]] : vector<16x8x32x16xi1>
1204
- // CHECK: %[[READ0:.*]] = vector.mask %[[MSK0]] {{.* }} : vector<16x8x32x16xi1> -> vector<16x8x32x16xf32>
1206
+ // CHECK: %[[READ0:.*]] = vector.mask %[[MSK0]] { vector.transfer_read %[[SRC]]{{.*} }} : vector<16x8x32x16xi1> -> vector<16x8x32x16xf32>
1205
1207
// CHECK: %[[TRANSP0:.*]] = vector.transpose %[[READ0]], [0, 2, 1, 3] : vector<16x8x32x16xf32> to vector<16x32x8x16xf32>
1206
1208
// CHECK: %[[SHAPC:.*]] = vector.shape_cast %[[TRANSP0]] : vector<16x32x8x16xf32> to vector<512x128xf32>
1207
- // CHECK: %[[EMPT:.*]] = tensor.empty() : tensor<256x128xf32>
1208
1209
// CHECK: %[[C01:.*]] = arith.constant 0 : index
1209
1210
// CHECK: %[[C256:.*]] = arith.constant 256 : index
1210
1211
// CHECK: %[[C128:.*]] = arith.constant 128 : index
1211
1212
// CHECK: %[[WRITEMSK:.*]] = vector.create_mask %[[C256]], %[[C128]] : vector<512x128xi1>
1212
- // CHECK: %[[WRIT:.*]] = vector.mask %[[WRITEMSK]] {{.* }} : vector<512x128xi1> -> tensor<256x128xf32>
1213
+ // CHECK: %[[WRIT:.*]] = vector.mask %[[WRITEMSK]] { vector.transfer_write %[[SHAPC]], %[[DEST]]{{.*} }} : vector<512x128xi1> -> tensor<256x128xf32>
1213
1214
// CHECK: return %[[WRIT]] : tensor<256x128xf32>
1214
1215
%0 = linalg.unpack %source inner_dims_pos = [0 , 1 ] inner_tiles = [32 , 16 ] into %dest : tensor <8 x8 x32 x16 xf32 > -> tensor <256 x128 xf32 >
1215
1216
return %0 : tensor <256 x128 xf32 >
@@ -1225,15 +1226,16 @@ func.func @test_vectorize_unpack(%source: tensor<8x8x32x16xf32>, %dest: tensor<2
1225
1226
// -----
1226
1227
1227
1228
// CHECK-LABEL: func @test_vectorize_unpack_no_masks
1229
+ // CHECK-SAME: %[[SRC:.*]]: tensor<8x8x32x16xf32>
1230
+ // CHECK-SAME: %[[DEST:.*]]: tensor<256x128xf32>
1228
1231
func.func @test_vectorize_unpack_no_masks (%source: tensor <8 x8 x32 x16 xf32 >, %dest: tensor <256 x128 xf32 >) -> tensor <256 x128 xf32 > {
1229
1232
// CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32
1230
1233
// CHECK: %[[C0:.*]] = arith.constant 0 : index
1231
- // CHECK: %[[READ:.*]] = vector.transfer_read {{.*}} : tensor<8x8x32x16xf32>, vector<8x8x32x16xf32>
1234
+ // CHECK: %[[READ:.*]] = vector.transfer_read %[[SRC]] {{.*}}} : tensor<8x8x32x16xf32>, vector<8x8x32x16xf32>
1232
1235
// CHECK: %[[TRANSP:.*]] = vector.transpose %[[READ]], [0, 2, 1, 3] : vector<8x8x32x16xf32> to vector<8x32x8x16xf32>
1233
1236
// CHECK: %[[SHAPC:.*]] = vector.shape_cast %[[TRANSP]] : vector<8x32x8x16xf32> to vector<256x128xf32>
1234
- // CHECK: %[[EMPT:.*]] = tensor.empty() : tensor<256x128xf32>
1235
1237
// CHECK: %[[C00:.*]] = arith.constant 0 : index
1236
- // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], {{.*}} : vector<256x128xf32>, tensor<256x128xf32>
1238
+ // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], %[[DEST]] {{.*}}} : vector<256x128xf32>, tensor<256x128xf32>
1237
1239
// CHECK: return %[[WRIT]] : tensor<256x128xf32>
1238
1240
%0 = linalg.unpack %source inner_dims_pos = [0 , 1 ] inner_tiles = [32 , 16 ] into %dest : tensor <8 x8 x32 x16 xf32 > -> tensor <256 x128 xf32 >
1239
1241
return %0 : tensor <256 x128 xf32 >
@@ -1248,16 +1250,17 @@ func.func @test_vectorize_unpack_no_masks(%source: tensor<8x8x32x16xf32>, %dest:
1248
1250
1249
1251
// -----
1250
1252
1251
- // CHECK-LABEL: test_vectorize_unpack_with_outer_perm
1253
+ // CHECK-LABEL: test_vectorize_unpack_with_outer_perm
1254
+ // CHECK-SAME: %[[SRC:.*]]: tensor<8x8x32x16xf32>
1255
+ // CHECK-SAME: %[[DEST:.*]]: tensor<256x128xf32>
1252
1256
func.func @test_vectorize_unpack_with_outer_perm (%source: tensor <8 x8 x32 x16 xf32 >, %dest: tensor <256 x128 xf32 >) -> tensor <256 x128 xf32 > {
1253
1257
// CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32
1254
1258
// CHECK: %[[C0:.*]] = arith.constant 0 : index
1255
- // CHECK: %[[READ:.*]] = vector.transfer_read {{.*}} : tensor<8x8x32x16xf32>, vector<8x8x32x16xf32>
1259
+ // CHECK: %[[READ:.*]] = vector.transfer_read %[[SRC]] {{.*}}} : tensor<8x8x32x16xf32>, vector<8x8x32x16xf32>
1256
1260
// CHECK: %[[TRANSP:.*]] = vector.transpose %[[READ]], [1, 2, 0, 3] : vector<8x8x32x16xf32> to vector<8x32x8x16xf32>
1257
1261
// CHECK: %[[SHAPC:.*]] = vector.shape_cast %[[TRANSP]] : vector<8x32x8x16xf32> to vector<256x128xf32>
1258
- // CHECK: %[[EMPT:.*]] = tensor.empty() : tensor<256x128xf32>
1259
1262
// CHECK: %[[C00:.*]] = arith.constant 0 : index
1260
- // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], {{.*}} : vector<256x128xf32>, tensor<256x128xf32>
1263
+ // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], %[[DEST]] {{.*}}} : vector<256x128xf32>, tensor<256x128xf32>
1261
1264
// CHECK: return %[[WRIT]] : tensor<256x128xf32>
1262
1265
%0 = linalg.unpack %source outer_dims_perm = [1 , 0 ] inner_dims_pos = [0 , 1 ] inner_tiles = [32 , 16 ] into %dest : tensor <8 x8 x32 x16 xf32 > -> tensor <256 x128 xf32 >
1263
1266
return %0 : tensor <256 x128 xf32 >
@@ -1327,15 +1330,17 @@ module attributes {transform.with_named_sequence} {
1327
1330
1328
1331
// -----
1329
1332
1333
+ // CHECK-LABEL: test_vectorize_unpack_no_vector_sizes
1334
+ // CHECK-SAME: %[[SRC:.*]]: tensor<8x8x32x16xf32>
1335
+ // CHECK-SAME: %[[DEST:.*]]: tensor<256x128xf32>
1330
1336
func.func @test_vectorize_unpack_no_vector_sizes (%source: tensor <8 x8 x32 x16 xf32 >, %dest: tensor <256 x128 xf32 >) -> tensor <256 x128 xf32 > {
1331
1337
// CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32
1332
1338
// CHECK: %[[C0:.*]] = arith.constant 0 : index
1333
- // CHECK: %[[READ:.*]] = vector.transfer_read {{.*}} : tensor<8x8x32x16xf32>, vector<8x8x32x16xf32>
1339
+ // CHECK: %[[READ:.*]] = vector.transfer_read %[[SRC]] {{.*}}} : tensor<8x8x32x16xf32>, vector<8x8x32x16xf32>
1334
1340
// CHECK: %[[TRANSP:.*]] = vector.transpose %[[READ]], [0, 2, 1, 3] : vector<8x8x32x16xf32> to vector<8x32x8x16xf32>
1335
1341
// CHECK: %[[SHAPC:.*]] = vector.shape_cast %[[TRANSP]] : vector<8x32x8x16xf32> to vector<256x128xf32>
1336
- // CHECK: %[[EMPT:.*]] = tensor.empty() : tensor<256x128xf32>
1337
1342
// CHECK: %[[C00:.*]] = arith.constant 0 : index
1338
- // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], {{.*}} : vector<256x128xf32>, tensor<256x128xf32>
1343
+ // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], %[[DEST]] {{.*}}} : vector<256x128xf32>, tensor<256x128xf32>
1339
1344
// CHECK: return %[[WRIT]] : tensor<256x128xf32>
1340
1345
%0 = linalg.unpack %source inner_dims_pos = [0 , 1 ] inner_tiles = [32 , 16 ] into %dest : tensor <8 x8 x32 x16 xf32 > -> tensor <256 x128 xf32 >
1341
1346
return %0 : tensor <256 x128 xf32 >
@@ -1350,15 +1355,17 @@ func.func @test_vectorize_unpack_no_vector_sizes(%source: tensor<8x8x32x16xf32>,
1350
1355
1351
1356
// -----
1352
1357
1358
+ // CHECK-LABEL: test_vectorize_unpack_no_vector_sizes_slice_output
1359
+ // CHECK-SAME: %[[SRC:.*]]: tensor<8x4x16x16xf32>
1360
+ // CHECK-SAME: %[[DEST:.*]]: tensor<64x127xf32>
1353
1361
func.func @test_vectorize_unpack_no_vector_sizes_slice_output (%source: tensor <8 x4 x16 x16 xf32 >, %dest: tensor <64 x127 xf32 >) -> tensor <64 x127 xf32 > {
1354
1362
// CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32
1355
1363
// CHECK: %[[C0:.*]] = arith.constant 0 : index
1356
- // CHECK: %[[READ:.*]] = vector.transfer_read {{.*}} : tensor<8x4x16x16xf32>, vector<8x4x16x16xf32>
1364
+ // CHECK: %[[READ:.*]] = vector.transfer_read %[[SRC]] {{.*} }} : tensor<8x4x16x16xf32>, vector<8x4x16x16xf32>
1357
1365
// CHECK: %[[TRANSP:.*]] = vector.transpose %[[READ]], [1, 2, 0, 3] : vector<8x4x16x16xf32> to vector<4x16x8x16xf32>
1358
1366
// CHECK: %[[SHAPC:.*]] = vector.shape_cast %[[TRANSP]] : vector<4x16x8x16xf32> to vector<64x128xf32>
1359
- // CHECK: %[[EMPT:.*]] = tensor.empty() : tensor<64x127xf32>
1360
1367
// CHECK: %[[C00:.*]] = arith.constant 0 : index
1361
- // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], %[[EMPT]]{{\[}}%[[C00]], %[[C00] ]]
1368
+ // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], %[[DEST ]]
1362
1369
// CHECK-SAME: {in_bounds = [true, false]} : vector<64x128xf32>, tensor<64x127xf32>
1363
1370
// CHECK: return %[[WRIT]] : tensor<64x127xf32>
1364
1371
%0 = linalg.unpack %source outer_dims_perm = [1 , 0 ] inner_dims_pos = [0 , 1 ] inner_tiles = [16 , 16 ] into %dest : tensor <8 x4 x16 x16 xf32 > -> tensor <64 x127 xf32 >
@@ -1374,18 +1381,20 @@ func.func @test_vectorize_unpack_no_vector_sizes_slice_output(%source: tensor<8x
1374
1381
1375
1382
// -----
1376
1383
1384
+ // CHECK-LABEL: test_vectorize_unpack_no_vector_sizes_permute
1385
+ // CHECK-SAME: %[[SRC:.*]]: tensor<4x7x4xf32>
1386
+ // CHECK-SAME: %[[DEST:.*]]: tensor<7x16xf32>
1377
1387
func.func @test_vectorize_unpack_no_vector_sizes_permute (%source: tensor <4 x7 x4 xf32 >, %dest: tensor <7 x16 xf32 >) -> tensor <7 x16 xf32 > {
1378
1388
%0 = linalg.unpack %source outer_dims_perm =[1 , 0 ] inner_dims_pos = [1 ] inner_tiles = [4 ] into %dest : tensor <4 x7 x4 xf32 > -> tensor <7 x16 xf32 >
1379
1389
return %0 : tensor <7 x16 xf32 >
1380
1390
}
1381
1391
// CHECK: %[[CST:.*]] = arith.constant 0.000000e+00 : f32
1382
1392
// CHECK: %[[C0:.*]] = arith.constant 0 : index
1383
- // CHECK: %[[READ:.*]] = vector.transfer_read {{.*}} : tensor<4x7x4xf32>, vector<4x7x4xf32>
1393
+ // CHECK: %[[READ:.*]] = vector.transfer_read %[[SRC]] {{.*} }} : tensor<4x7x4xf32>, vector<4x7x4xf32>
1384
1394
// CHECK: %[[TRANSP:.*]] = vector.transpose %[[READ]], [1, 0, 2] : vector<4x7x4xf32> to vector<7x4x4xf32>
1385
1395
// CHECK: %[[SHAPC:.*]] = vector.shape_cast %[[TRANSP]] : vector<7x4x4xf32> to vector<7x16xf32>
1386
- // CHECK: %[[EMPT:.*]] = tensor.empty() : tensor<7x16xf32>
1387
1396
// CHECK: %[[C00:.*]] = arith.constant 0 : index
1388
- // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], {{.*}} : vector<7x16xf32>, tensor<7x16xf32>
1397
+ // CHECK: %[[WRIT:.*]] = vector.transfer_write %[[SHAPC]], %[[DEST]] {{.*}}} : vector<7x16xf32>, tensor<7x16xf32>
1389
1398
// CHECK: return %[[WRIT]] : tensor<7x16xf32>
1390
1399
module attributes {transform.with_named_sequence } {
1391
1400
transform.named_sequence @__transform_main (%arg0: !transform.any_op {transform.readonly }) {
0 commit comments