@@ -1522,3 +1522,71 @@ transform.sequence failures(propagate) {
1522
1522
%1 = get_closest_isolated_parent %0 : (!pdl.operation ) -> !pdl.operation
1523
1523
%2 = transform.structured.vectorize %1
1524
1524
}
1525
+
1526
+ // -----
1527
+
1528
+ func.func @vectorize_map (%arg0: memref <64 xf32 >,
1529
+ %arg1: memref <64 xf32 >, %arg2: memref <64 xf32 >) {
1530
+ linalg.map ins (%arg0 , %arg1 : memref <64 xf32 >, memref <64 xf32 >)
1531
+ outs (%arg2 : memref <64 xf32 >)
1532
+ (%in: f32 , %in_0: f32 ) {
1533
+ %0 = arith.addf %in , %in_0 : f32
1534
+ linalg.yield %0 : f32
1535
+ }
1536
+ return
1537
+ }
1538
+ // CHECK-LABEL: func @vectorize_map
1539
+ // CHECK: %[[LHS:.*]] = vector.transfer_read
1540
+ // CHECK-NEXT: %[[RHS:.*]] = vector.transfer_read
1541
+ // CHECK-NEXT: arith.addf %[[LHS]], %[[RHS]] : vector<64xf32>
1542
+
1543
+ transform.sequence failures (propagate ) {
1544
+ ^bb1 (%arg1: !pdl.operation ):
1545
+ %0 = transform.structured.match ops {[" linalg.map" ]} in %arg1
1546
+ %1 = get_closest_isolated_parent %0 : (!pdl.operation ) -> !pdl.operation
1547
+ %2 = transform.structured.vectorize %1
1548
+ }
1549
+
1550
+ // -----
1551
+
1552
+ func.func @vectorize_transpose (%arg0: memref <16 x32 x64 xf32 >,
1553
+ %arg1: memref <32 x64 x16 xf32 >) {
1554
+ linalg.transpose ins (%arg0 : memref <16 x32 x64 xf32 >)
1555
+ outs (%arg1 : memref <32 x64 x16 xf32 >) permutation = [1 , 2 , 0 ]
1556
+ return
1557
+ }
1558
+ // CHECK-LABEL: func @vectorize_transpose
1559
+ // CHECK: %[[FIRST:.*]] = vector.transpose
1560
+ // CHECK-SAME: [2, 0, 1] : vector<32x64x16xf32> to vector<16x32x64xf32>
1561
+ // CHECK-NEXT: vector.transpose %[[FIRST]]
1562
+ // CHECK-SAME: [1, 2, 0] : vector<16x32x64xf32> to vector<32x64x16xf32>
1563
+
1564
+ transform.sequence failures (propagate ) {
1565
+ ^bb1 (%arg1: !pdl.operation ):
1566
+ %0 = transform.structured.match ops {[" linalg.transpose" ]} in %arg1
1567
+ %1 = get_closest_isolated_parent %0 : (!pdl.operation ) -> !pdl.operation
1568
+ %2 = transform.structured.vectorize %1
1569
+ }
1570
+
1571
+ // -----
1572
+
1573
+ func.func @vectorize_reduce (%arg0: memref <16 x32 x64 xf32 >,
1574
+ %arg1: memref <16 x64 xf32 >) {
1575
+ linalg.reduce ins (%arg0 : memref <16 x32 x64 xf32 >)
1576
+ outs (%arg1 : memref <16 x64 xf32 >) dimensions = [1 ]
1577
+ (%in: f32 , %init: f32 ) {
1578
+ %0 = arith.addf %in , %init : f32
1579
+ linalg.yield %0 : f32
1580
+ }
1581
+ return
1582
+ }
1583
+ // CHECK-LABEL: func @vectorize_reduce
1584
+ // CHECK: vector.multi_reduction <add>
1585
+ // CHECK-SAME: : vector<16x32x64xf32> to vector<16x64xf32>
1586
+
1587
+ transform.sequence failures (propagate ) {
1588
+ ^bb1 (%arg1: !pdl.operation ):
1589
+ %0 = transform.structured.match ops {[" linalg.reduce" ]} in %arg1
1590
+ %1 = get_closest_isolated_parent %0 : (!pdl.operation ) -> !pdl.operation
1591
+ %2 = transform.structured.vectorize %1
1592
+ }
0 commit comments