annotate mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
1 // RUN: mlir-opt %s --test-transform-dialect-interpreter --split-input-file | FileCheck %s
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
2
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // CHECK-DAG: #[[$map_p4:.*]] = affine_map<()[s0] -> (s0 + 4)>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // CHECK-DAG: #[[$map_p8:.*]] = affine_map<()[s0] -> (s0 + 8)>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // CHECK-LABEL: split_vector_transfer_read_2d(
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
8 // CHECK-SAME: %[[A:[a-zA-Z0-9_]*]]: memref
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
9 // CHECK-SAME: %[[i:[a-zA-Z0-9_]*]]: index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
10 // CHECK-SAME: %[[j:[a-zA-Z0-9_]*]]: index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
12 func.func @split_vector_transfer_read_2d(%A: memref<?x8xf32>, %i: index, %j: index) -> vector<4x8xf32> {
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
13 %c0 = arith.constant 0 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
14 %f0 = arith.constant 0.0 : f32
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
16 // CHECK-DAG: %[[c8:.*]] = arith.constant 8 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
17 // CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 // alloca for boundary full tile
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // CHECK: %[[alloc:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // %i + 4 <= dim(%A, 0)
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 // CHECK: %[[idx0:.*]] = affine.apply #[[$map_p4]]()[%[[i]]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 // CHECK: %[[d0:.*]] = memref.dim %[[A]], %[[c0]] : memref<?x8xf32>
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
23 // CHECK: %[[cmp0:.*]] = arith.cmpi sle, %[[idx0]], %[[d0]] : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 // %j + 8 <= dim(%A, 1)
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 // CHECK: %[[idx1:.*]] = affine.apply #[[$map_p8]]()[%[[j]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
26 // CHECK: %[[cmp1:.*]] = arith.cmpi sle, %[[idx1]], %[[c8]] : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 // are both conds true
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
28 // CHECK: %[[cond:.*]] = arith.andi %[[cmp0]], %[[cmp1]] : i1
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 // CHECK: %[[ifres:.*]]:3 = scf.if %[[cond]] -> (memref<?x8xf32>, index, index) {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 // inBounds, just yield %A
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 // CHECK: scf.yield %[[A]], %[[i]], %[[j]] : memref<?x8xf32>, index, index
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 // CHECK: } else {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 // slow path, fill tmp alloc and yield a memref_casted version of it
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 // CHECK: %[[slow:.*]] = vector.transfer_read %[[A]][%[[i]], %[[j]]], %cst :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 // CHECK-SAME: memref<?x8xf32>, vector<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 // CHECK: %[[cast_alloc:.*]] = vector.type_cast %[[alloc]] :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 // CHECK-SAME: memref<4x8xf32> to memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 // CHECK: store %[[slow]], %[[cast_alloc]][] : memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 // CHECK: %[[yielded:.*]] = memref.cast %[[alloc]] :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 // CHECK-SAME: memref<4x8xf32> to memref<?x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 // CHECK: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 // CHECK-SAME: memref<?x8xf32>, index, index
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 // CHECK: %[[res:.*]] = vector.transfer_read %[[ifres]]#0[%[[ifres]]#1, %[[ifres]]#2], %cst
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
45 // CHECK-SAME: {in_bounds = [true, true]} : memref<?x8xf32>, vector<4x8xf32>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 %1 = vector.transfer_read %A[%i, %j], %f0 : memref<?x8xf32>, vector<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 return %1: vector<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 // CHECK-LABEL: split_vector_transfer_read_strided_2d(
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
53 // CHECK-SAME: %[[A:[a-zA-Z0-9_]*]]: memref
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
54 // CHECK-SAME: %[[i:[a-zA-Z0-9_]*]]: index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
55 // CHECK-SAME: %[[j:[a-zA-Z0-9_]*]]: index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
57 func.func @split_vector_transfer_read_strided_2d(
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
58 %A: memref<7x8xf32, strided<[?, 1], offset: ?>>,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 %i: index, %j: index) -> vector<4x8xf32> {
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
60 %c0 = arith.constant 0 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
61 %f0 = arith.constant 0.0 : f32
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
63 // CHECK-DAG: %[[c7:.*]] = arith.constant 7 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
64 // CHECK-DAG: %[[c8:.*]] = arith.constant 8 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
65 // CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 // alloca for boundary full tile
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 // CHECK: %[[alloc:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 // %i + 4 <= dim(%A, 0)
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 // CHECK: %[[idx0:.*]] = affine.apply #[[$map_p4]]()[%[[i]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
70 // CHECK: %[[cmp0:.*]] = arith.cmpi sle, %[[idx0]], %[[c7]] : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 // %j + 8 <= dim(%A, 1)
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 // CHECK: %[[idx1:.*]] = affine.apply #[[$map_p8]]()[%[[j]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
73 // CHECK: %[[cmp1:.*]] = arith.cmpi sle, %[[idx1]], %[[c8]] : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 // are both conds true
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
75 // CHECK: %[[cond:.*]] = arith.andi %[[cmp0]], %[[cmp1]] : i1
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
76 // CHECK: %[[ifres:.*]]:3 = scf.if %[[cond]] -> (memref<?x8xf32, strided<[?, 1], offset: ?>>, index, index) {
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 // inBounds but not cast-compatible: yield a memref_casted form of %A
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 // CHECK: %[[casted:.*]] = memref.cast %arg0 :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
79 // CHECK-SAME: memref<7x8xf32, strided<[?, 1], offset: ?>> to memref<?x8xf32, strided<[?, 1], offset: ?>>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 // CHECK: scf.yield %[[casted]], %[[i]], %[[j]] :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
81 // CHECK-SAME: memref<?x8xf32, strided<[?, 1], offset: ?>>, index, index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 // CHECK: } else {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 // slow path, fill tmp alloc and yield a memref_casted version of it
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 // CHECK: %[[slow:.*]] = vector.transfer_read %[[A]][%[[i]], %[[j]]], %cst :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
85 // CHECK-SAME: memref<7x8xf32, strided<[?, 1], offset: ?>>, vector<4x8xf32>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 // CHECK: %[[cast_alloc:.*]] = vector.type_cast %[[alloc]] :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 // CHECK-SAME: memref<4x8xf32> to memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 // CHECK: store %[[slow]], %[[cast_alloc]][] :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 // CHECK-SAME: memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 // CHECK: %[[yielded:.*]] = memref.cast %[[alloc]] :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
91 // CHECK-SAME: memref<4x8xf32> to memref<?x8xf32, strided<[?, 1], offset: ?>>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 // CHECK: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
93 // CHECK-SAME: memref<?x8xf32, strided<[?, 1], offset: ?>>, index, index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 // CHECK: %[[res:.*]] = vector.transfer_read {{.*}} {in_bounds = [true, true]} :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
96 // CHECK-SAME: memref<?x8xf32, strided<[?, 1], offset: ?>>, vector<4x8xf32>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 %1 = vector.transfer_read %A[%i, %j], %f0 :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
98 memref<7x8xf32, strided<[?, 1], offset: ?>>, vector<4x8xf32>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 // CHECK: return %[[res]] : vector<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 return %1 : vector<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
104 func.func @split_vector_transfer_read_mem_space(%A: memref<?x8xf32, 3>, %i: index, %j: index) -> vector<4x8xf32> {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
105 %c0 = arith.constant 0 : index
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
106 %f0 = arith.constant 0.0 : f32
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
107
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
108 // CHECK: scf.if {{.*}} -> (memref<?x8xf32, strided<[8, 1]>>, index, index) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
109 // inBounds with a different memory space
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
110 // CHECK: %[[space_cast:.*]] = memref.memory_space_cast %{{.*}} :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
111 // CHECK-SAME: memref<?x8xf32, 3> to memref<?x8xf32>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
112 // CHECK: %[[cast:.*]] = memref.cast %[[space_cast]] :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
113 // CHECK-SAME: memref<?x8xf32> to memref<?x8xf32, strided<[8, 1]>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
114 // CHECK: scf.yield %[[cast]], {{.*}} : memref<?x8xf32, strided<[8, 1]>>, index, index
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
115 // CHECK: } else {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
116 // slow path, fill tmp alloc and yield a memref_casted version of it
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
117 // CHECK: %[[slow:.*]] = vector.transfer_read %[[A]][%[[i]], %[[j]]], %cst :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
118 // CHECK-SAME: memref<?x8xf32, 3>, vector<4x8xf32>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
119 // CHECK: %[[cast_alloc:.*]] = vector.type_cast %[[alloc]] :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
120 // CHECK-SAME: memref<4x8xf32> to memref<vector<4x8xf32>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
121 // CHECK: store %[[slow]], %[[cast_alloc]][] : memref<vector<4x8xf32>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
122 // CHECK: %[[yielded:.*]] = memref.cast %[[alloc]] :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
123 // CHECK-SAME: memref<4x8xf32> to memref<?x8xf32, strided<[8, 1]>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
124 // CHECK: scf.yield %[[yielded]], %[[c0]], %[[c0]] :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
125 // CHECK-SAME: memref<?x8xf32, strided<[8, 1]>>, index, index
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
126 // CHECK: }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
127 // CHECK: %[[res:.*]] = vector.transfer_read %[[ifres]]#0[%[[ifres]]#1, %[[ifres]]#2], %cst
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
128 // CHECK-SAME: {in_bounds = [true, true]} : memref<?x8xf32, strided<[8, 1]>>, vector<4x8xf32>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
129
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
130 %1 = vector.transfer_read %A[%i, %j], %f0 : memref<?x8xf32, 3>, vector<4x8xf32>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
131
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
132 return %1: vector<4x8xf32>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
133 }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
134
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
135 transform.sequence failures(propagate) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
136 ^bb1(%func_op: !transform.op<"func.func">):
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
137 transform.apply_patterns to %func_op {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
138 transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
139 } : !transform.op<"func.func">
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
140 }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
141
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 // -----
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
144 func.func @split_vector_transfer_write_2d(%V: vector<4x8xf32>, %A: memref<?x8xf32>, %i: index, %j: index) {
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 vector.transfer_write %V, %A[%i, %j] :
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 vector<4x8xf32>, memref<?x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 return
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 // CHECK-DAG: #[[MAP0:.*]] = affine_map<()[s0] -> (s0 + 4)>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 // CHECK-DAG: #[[MAP1:.*]] = affine_map<()[s0] -> (s0 + 8)>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 // CHECK: func @split_vector_transfer_write_2d(
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 // CHECK-SAME: %[[VEC:.*]]: vector<4x8xf32>,
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 // CHECK-SAME: %[[DEST:.*]]: memref<?x8xf32>,
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 // CHECK-SAME: %[[I:.*]]: index,
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 // CHECK-SAME: %[[J:.*]]: index) {
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
157 // CHECK-DAG: %[[C8:.*]] = arith.constant 8 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
158 // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
159 // CHECK-DAG: %[[CT:.*]] = arith.constant true
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 // CHECK: %[[TEMP:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 // CHECK: %[[VAL_8:.*]] = affine.apply #[[MAP0]]()[%[[I]]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 // CHECK: %[[DIM0:.*]] = memref.dim %[[DEST]], %[[C0]] : memref<?x8xf32>
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
163 // CHECK: %[[DIM0_IN:.*]] = arith.cmpi sle, %[[VAL_8]], %[[DIM0]] : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 // CHECK: %[[DIM1:.*]] = affine.apply #[[MAP1]]()[%[[J]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
165 // CHECK: %[[DIM1_IN:.*]] = arith.cmpi sle, %[[DIM1]], %[[C8]] : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
166 // CHECK: %[[IN_BOUNDS:.*]] = arith.andi %[[DIM0_IN]], %[[DIM1_IN]] : i1
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 // CHECK: %[[IN_BOUND_DEST:.*]]:3 = scf.if %[[IN_BOUNDS]] ->
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 // CHECK-SAME: (memref<?x8xf32>, index, index) {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 // CHECK: scf.yield %[[DEST]], %[[I]], %[[J]] : memref<?x8xf32>, index, index
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 // CHECK: } else {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 // CHECK: %[[VAL_15:.*]] = memref.cast %[[TEMP]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 // CHECK-SAME: : memref<4x8xf32> to memref<?x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 // CHECK: scf.yield %[[VAL_15]], %[[C0]], %[[C0]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 // CHECK-SAME: : memref<?x8xf32>, index, index
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 // CHECK: vector.transfer_write %[[VEC]],
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 // CHECK-SAME: %[[IN_BOUND_DEST:.*]]#0[%[[IN_BOUND_DEST]]#1, %[[IN_BOUND_DEST]]#2]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 // CHECK-SAME: {in_bounds = [true, true]} : vector<4x8xf32>, memref<?x8xf32>
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
179 // CHECK: %[[OUT_BOUNDS:.*]] = arith.xori %[[IN_BOUNDS]], %[[CT]] : i1
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 // CHECK: scf.if %[[OUT_BOUNDS]] {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 // CHECK: %[[CASTED:.*]] = vector.type_cast %[[TEMP]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 // CHECK-SAME: : memref<4x8xf32> to memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 // CHECK: %[[RESULT_COPY:.*]] = memref.load %[[CASTED]][]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 // CHECK-SAME: : memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 // CHECK: vector.transfer_write %[[RESULT_COPY]],
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 // CHECK-SAME: %[[DEST]][%[[I]], %[[J]]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 // CHECK-SAME: : vector<4x8xf32>, memref<?x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 // CHECK: return
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
192
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
193 transform.sequence failures(propagate) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
194 ^bb1(%func_op: !transform.op<"func.func">):
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
195 transform.apply_patterns to %func_op {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
196 transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
197 } : !transform.op<"func.func">
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
198 }
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 // -----
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
202 func.func @split_vector_transfer_write_strided_2d(
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
203 %V: vector<4x8xf32>, %A: memref<7x8xf32, strided<[?, 1], offset: ?>>,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 %i: index, %j: index) {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 vector.transfer_write %V, %A[%i, %j] :
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
206 vector<4x8xf32>, memref<7x8xf32, strided<[?, 1], offset: ?>>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 return
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 // CHECK-DAG: #[[MAP1:.*]] = affine_map<()[s0] -> (s0 + 4)>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 // CHECK-DAG: #[[MAP2:.*]] = affine_map<()[s0] -> (s0 + 8)>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 // CHECK: func @split_vector_transfer_write_strided_2d(
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 // CHECK-SAME: %[[VEC:.*]]: vector<4x8xf32>,
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
214 // CHECK-SAME: %[[DEST:.*]]: memref<7x8xf32, strided<[?, 1], offset: ?>>,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 // CHECK-SAME: %[[I:.*]]: index,
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 // CHECK-SAME: %[[J:.*]]: index) {
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
217 // CHECK-DAG: %[[C7:.*]] = arith.constant 7 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
218 // CHECK-DAG: %[[C8:.*]] = arith.constant 8 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
219 // CHECK-DAG: %[[C0:.*]] = arith.constant 0 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
220 // CHECK-DAG: %[[CT:.*]] = arith.constant true
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 // CHECK: %[[TEMP:.*]] = memref.alloca() {alignment = 32 : i64} : memref<4x8xf32>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 // CHECK: %[[DIM0:.*]] = affine.apply #[[MAP1]]()[%[[I]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
223 // CHECK: %[[DIM0_IN:.*]] = arith.cmpi sle, %[[DIM0]], %[[C7]] : index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 // CHECK: %[[DIM1:.*]] = affine.apply #[[MAP2]]()[%[[J]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
225 // CHECK: %[[DIM1_IN:.*]] = arith.cmpi sle, %[[DIM1]], %[[C8]] : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
226 // CHECK: %[[IN_BOUNDS:.*]] = arith.andi %[[DIM0_IN]], %[[DIM1_IN]] : i1
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 // CHECK: %[[IN_BOUND_DEST:.*]]:3 = scf.if %[[IN_BOUNDS]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
228 // CHECK-SAME: -> (memref<?x8xf32, strided<[?, 1], offset: ?>>, index, index) {
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 // CHECK: %[[VAL_15:.*]] = memref.cast %[[DEST]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
230 // CHECK-SAME: : memref<7x8xf32, strided<[?, 1], offset: ?>> to memref<?x8xf32, strided<[?, 1], offset: ?>>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 // CHECK: scf.yield %[[VAL_15]], %[[I]], %[[J]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
232 // CHECK-SAME: : memref<?x8xf32, strided<[?, 1], offset: ?>>, index, index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 // CHECK: } else {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 // CHECK: %[[VAL_16:.*]] = memref.cast %[[TEMP]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
235 // CHECK-SAME: : memref<4x8xf32> to memref<?x8xf32, strided<[?, 1], offset: ?>>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 // CHECK: scf.yield %[[VAL_16]], %[[C0]], %[[C0]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
237 // CHECK-SAME: : memref<?x8xf32, strided<[?, 1], offset: ?>>, index, index
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 // CHECK: vector.transfer_write %[[VEC]],
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 // CHECK-SAME: %[[IN_BOUND_DEST:.*]]#0
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 // CHECK-SAME: [%[[IN_BOUND_DEST]]#1, %[[IN_BOUND_DEST]]#2]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
242 // CHECK-SAME: {in_bounds = [true, true]} : vector<4x8xf32>, memref<?x8xf32, strided<[?, 1], offset: ?>>
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
243 // CHECK: %[[OUT_BOUNDS:.*]] = arith.xori %[[IN_BOUNDS]], %[[CT]] : i1
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 // CHECK: scf.if %[[OUT_BOUNDS]] {
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 // CHECK: %[[VAL_19:.*]] = vector.type_cast %[[TEMP]]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 // CHECK-SAME: : memref<4x8xf32> to memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 // CHECK: %[[VAL_20:.*]] = memref.load %[[VAL_19]][]
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 // CHECK-SAME: : memref<vector<4x8xf32>>
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 // CHECK: vector.transfer_write %[[VAL_20]], %[[DEST]][%[[I]], %[[J]]]
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
250 // CHECK-SAME: : vector<4x8xf32>, memref<7x8xf32, strided<[?, 1], offset: ?>>
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 // CHECK: return
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 // CHECK: }
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
255 transform.sequence failures(propagate) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
256 ^bb1(%func_op: !transform.op<"func.func">):
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
257 transform.apply_patterns to %func_op {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
258 transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
259 } : !transform.op<"func.func">
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
260 }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
261
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
262 // -----
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
263
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
264 func.func @split_vector_transfer_write_mem_space(%V: vector<4x8xf32>, %A: memref<?x8xf32, 3>, %i: index, %j: index) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
265 vector.transfer_write %V, %A[%i, %j] :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
266 vector<4x8xf32>, memref<?x8xf32, 3>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
267 return
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
268 }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
269
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
270 // CHECK: func @split_vector_transfer_write_mem_space(
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
271 // CHECK: scf.if {{.*}} -> (memref<?x8xf32, strided<[8, 1]>>, index, index) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
272 // CHECK: %[[space_cast:.*]] = memref.memory_space_cast %{{.*}} :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
273 // CHECK-SAME: memref<?x8xf32, 3> to memref<?x8xf32>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
274 // CHECK: %[[cast:.*]] = memref.cast %[[space_cast]] :
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
275 // CHECK-SAME: memref<?x8xf32> to memref<?x8xf32, strided<[8, 1]>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
276 // CHECK: scf.yield %[[cast]], {{.*}} : memref<?x8xf32, strided<[8, 1]>>, index, index
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
277 // CHECK: } else {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
278 // CHECK: %[[VAL_15:.*]] = memref.cast %[[TEMP]]
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
279 // CHECK-SAME: : memref<4x8xf32> to memref<?x8xf32, strided<[8, 1]>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
280 // CHECK: scf.yield %[[VAL_15]], %[[C0]], %[[C0]]
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
281 // CHECK-SAME: : memref<?x8xf32, strided<[8, 1]>>, index, index
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
282 // CHECK: }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
283 // CHECK: vector.transfer_write %[[VEC]],
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
284 // CHECK-SAME: %[[IN_BOUND_DEST:.*]]#0[%[[IN_BOUND_DEST]]#1, %[[IN_BOUND_DEST]]#2]
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
285 // CHECK-SAME: {in_bounds = [true, true]} : vector<4x8xf32>, memref<?x8xf32, strided<[8, 1]>>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
286
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
287
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
288 transform.sequence failures(propagate) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
289 ^bb1(%func_op: !transform.op<"func.func">):
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
290 transform.apply_patterns to %func_op {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
291 transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
292 } : !transform.op<"func.func">
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
293 }
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
294
236
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
295
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
296 // -----
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
297
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
298 func.func private @fake_side_effecting_fun(%0: vector<2x2xf32>) -> ()
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
299
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
300 // CHECK-LABEL: transfer_read_within_async_execute
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
301 func.func @transfer_read_within_async_execute(%A : memref<?x?xf32>) -> !async.token {
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
302 %c0 = arith.constant 0 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
303 %f0 = arith.constant 0.0 : f32
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
304 // CHECK-NOT: alloca
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
305 // CHECK: async.execute
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
306 // CHECK: alloca
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
307 %token = async.execute {
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
308 %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<?x?xf32>, vector<2x2xf32>
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
309 func.call @fake_side_effecting_fun(%0) : (vector<2x2xf32>) -> ()
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
310 async.yield
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
311 }
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
312 return %token : !async.token
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
313 }
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
314
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
315 // Ensure that `alloca`s are inserted outside of loops even though loops are
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
316 // consdered allocation scopes.
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
317 // CHECK-LABEL: transfer_read_within_scf_for
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
318 func.func @transfer_read_within_scf_for(%A : memref<?x?xf32>, %lb : index, %ub : index, %step : index) {
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
319 %c0 = arith.constant 0 : index
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
320 %f0 = arith.constant 0.0 : f32
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
321 // CHECK: memref.alloca
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
322 // CHECK: scf.for
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
323 // CHECK-NOT: memref.alloca
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
324 scf.for %i = %lb to %ub step %step {
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
325 %0 = vector.transfer_read %A[%c0, %c0], %f0 : memref<?x?xf32>, vector<2x2xf32>
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
326 func.call @fake_side_effecting_fun(%0) : (vector<2x2xf32>) -> ()
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
327 }
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
328 return
c4bab56944e8 LLVM 16
kono
parents: 223
diff changeset
329 }
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
330
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
331 transform.sequence failures(propagate) {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
332 ^bb1(%func_op: !transform.op<"func.func">):
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
333 transform.apply_patterns to %func_op {
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
334 transform.apply_patterns.vector.split_transfer_full_partial split_transfer_strategy = "vector-transfer"
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
335 } : !transform.op<"func.func">
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
336 }