1 // RUN: mlir-opt %s -convert-vector-to-llvm -split-input-file | FileCheck '-D$IDX_TYPE=i32' %s
2 // RUN: mlir-opt %s --convert-vector-to-llvm='force-32bit-vector-indices=0' | FileCheck '-D$IDX_TYPE=i64' %s
4 func.func @transfer_read_write_1d(%A : memref<?xf32>, %base: index) -> vector<17xf32> {
5 %f7 = arith.constant 7.0: f32
6 %f = vector.transfer_read %A[%base], %f7
7 {permutation_map = affine_map<(d0) -> (d0)>} :
8 memref<?xf32>, vector<17xf32>
9 vector.transfer_write %f, %A[%base]
10 {permutation_map = affine_map<(d0) -> (d0)>} :
11 vector<17xf32>, memref<?xf32>
12 return %f: vector<17xf32>
14 // CHECK-LABEL: func @transfer_read_write_1d
15 // CHECK-SAME: %[[MEM:.*]]: memref<?xf32>,
16 // CHECK-SAME: %[[BASE:.*]]: index) -> vector<17xf32>
17 // CHECK: %[[C7:.*]] = arith.constant 7.0
19 // 1. Let dim be the memref dimension, compute the in-bound index (dim - offset)
20 // CHECK: %[[C0:.*]] = arith.constant 0 : index
21 // CHECK: %[[DIM:.*]] = memref.dim %[[MEM]], %[[C0]] : memref<?xf32>
22 // CHECK: %[[BOUND:.*]] = arith.subi %[[DIM]], %[[BASE]] : index
24 // 2. Create a vector with linear indices [ 0 .. vector_length - 1 ].
25 // CHECK: %[[linearIndex:.*]] = arith.constant dense
26 // CHECK-SAME: <[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : vector<17x[[$IDX_TYPE]]>
28 // 3. Create bound vector to compute in-bound mask:
29 // [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ]
30 // CHECK: %[[btrunc:.*]] = arith.index_cast %[[BOUND]] :
31 // CMP32-SAME: index to i32
32 // CMP64-SAME: index to i64
33 // CHECK: %[[boundVecInsert:.*]] = llvm.insertelement %[[btrunc]]
34 // CHECK: %[[boundVect:.*]] = llvm.shufflevector %[[boundVecInsert]]
35 // CHECK: %[[mask:.*]] = arith.cmpi slt, %[[linearIndex]], %[[boundVect]] : vector<17x[[$IDX_TYPE]]>
36 // CMP64-SAME: : vector<17xi64>
38 // 4. Create pass-through vector.
39 // CHECK: %[[PASS_THROUGH:.*]] = arith.constant dense<7.{{.*}}> : vector<17xf32>
41 // 5. Bitcast to vector form.
42 // CHECK: %[[gep:.*]] = llvm.getelementptr %{{.*}} :
43 // CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr, f32
45 // 6. Rewrite as a masked read.
46 // CHECK: %[[loaded:.*]] = llvm.intr.masked.load %[[gep]], %[[mask]],
47 // CHECK-SAME: %[[PASS_THROUGH]] {alignment = 4 : i32} :
48 // CHECK-SAME: -> vector<17xf32>
50 // 1. Let dim be the memref dimension, compute the in-bound index (dim - offset)
51 // CHECK: %[[C0_b:.*]] = arith.constant 0 : index
52 // CHECK: %[[DIM_b:.*]] = memref.dim %[[MEM]], %[[C0_b]] : memref<?xf32>
53 // CHECK: %[[BOUND_b:.*]] = arith.subi %[[DIM_b]], %[[BASE]] : index
55 // 2. Create a vector with linear indices [ 0 .. vector_length - 1 ].
56 // CHECK: %[[linearIndex_b:.*]] = arith.constant dense
57 // CHECK-SAME: <[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : vector<17x[[$IDX_TYPE]]>
59 // 3. Create bound vector to compute in-bound mask:
60 // [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ]
61 // CHECK: %[[btrunc_b:.*]] = arith.index_cast %[[BOUND_b]]
62 // CMP32-SAME: index to i32
63 // CHECK: %[[boundVecInsert_b:.*]] = llvm.insertelement %[[btrunc_b]]
64 // CHECK: %[[boundVect_b:.*]] = llvm.shufflevector %[[boundVecInsert_b]]
65 // CHECK: %[[mask_b:.*]] = arith.cmpi slt, %[[linearIndex_b]],
66 // CHECK-SAME: %[[boundVect_b]] : vector<17x[[$IDX_TYPE]]>
68 // 4. Bitcast to vector form.
69 // CHECK: %[[gep_b:.*]] = llvm.getelementptr {{.*}} :
70 // CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr, f32
72 // 5. Rewrite as a masked write.
73 // CHECK: llvm.intr.masked.store %[[loaded]], %[[gep_b]], %[[mask_b]]
74 // CHECK-SAME: {alignment = 4 : i32} :
75 // CHECK-SAME: vector<17xf32>, vector<17xi1> into !llvm.ptr
77 func.func @transfer_read_write_1d_scalable(%A : memref<?xf32>, %base: index) -> vector<[17]xf32> {
78 %f7 = arith.constant 7.0: f32
79 %f = vector.transfer_read %A[%base], %f7
80 {permutation_map = affine_map<(d0) -> (d0)>} :
81 memref<?xf32>, vector<[17]xf32>
82 vector.transfer_write %f, %A[%base]
83 {permutation_map = affine_map<(d0) -> (d0)>} :
84 vector<[17]xf32>, memref<?xf32>
85 return %f: vector<[17]xf32>
87 // CHECK-LABEL: func @transfer_read_write_1d_scalable
88 // CHECK-SAME: %[[MEM:.*]]: memref<?xf32>,
89 // CHECK-SAME: %[[BASE:.*]]: index) -> vector<[17]xf32>
90 // CHECK: %[[C7:.*]] = arith.constant 7.0
92 // 1. Let dim be the memref dimension, compute the in-bound index (dim - offset)
93 // CHECK: %[[C0:.*]] = arith.constant 0 : index
94 // CHECK: %[[DIM:.*]] = memref.dim %[[MEM]], %[[C0]] : memref<?xf32>
95 // CHECK: %[[BOUND:.*]] = arith.subi %[[DIM]], %[[BASE]] : index
97 // 2. Create a vector with linear indices [ 0 .. vector_length - 1 ].
98 // CHECK: %[[linearIndex:.*]] = llvm.intr.stepvector : vector<[17]x[[$IDX_TYPE]]>
100 // 3. Create bound vector to compute in-bound mask:
101 // [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ]
102 // CHECK: %[[btrunc:.*]] = arith.index_cast %[[BOUND]] : index to [[$IDX_TYPE]]
103 // CHECK: %[[boundVecInsert:.*]] = llvm.insertelement %[[btrunc]]
104 // CHECK: %[[boundVect:.*]] = llvm.shufflevector %[[boundVecInsert]]
105 // CHECK: %[[mask:.*]] = arith.cmpi slt, %[[linearIndex]], %[[boundVect]]
106 // CHECK-SAME: : vector<[17]x[[$IDX_TYPE]]>
108 // 4. Create pass-through vector.
109 // CHECK: %[[PASS_THROUGH:.*]] = arith.constant dense<7.{{.*}}> : vector<[17]xf32>
111 // 5. Bitcast to vector form.
112 // CHECK: %[[gep:.*]] = llvm.getelementptr %{{.*}} :
113 // CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr, f32
115 // 6. Rewrite as a masked read.
116 // CHECK: %[[loaded:.*]] = llvm.intr.masked.load %[[gep]], %[[mask]],
117 // CHECK-SAME: %[[PASS_THROUGH]] {alignment = 4 : i32} :
118 // CHECK-SAME: -> vector<[17]xf32>
120 // 1. Let dim be the memref dimension, compute the in-bound index (dim - offset)
121 // CHECK: %[[C0_b:.*]] = arith.constant 0 : index
122 // CHECK: %[[DIM_b:.*]] = memref.dim %[[MEM]], %[[C0_b]] : memref<?xf32>
123 // CHECK: %[[BOUND_b:.*]] = arith.subi %[[DIM_b]], %[[BASE]] : index
125 // 2. Create a vector with linear indices [ 0 .. vector_length - 1 ].
126 // CHECK: %[[linearIndex_b:.*]] = llvm.intr.stepvector : vector<[17]x[[$IDX_TYPE]]>
128 // 3. Create bound vector to compute in-bound mask:
129 // [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ]
130 // CHECK: %[[btrunc_b:.*]] = arith.index_cast %[[BOUND_b]] : index to [[$IDX_TYPE]]
131 // CHECK: %[[boundVecInsert_b:.*]] = llvm.insertelement %[[btrunc_b]]
132 // CHECK: %[[boundVect_b:.*]] = llvm.shufflevector %[[boundVecInsert_b]]
133 // CHECK: %[[mask_b:.*]] = arith.cmpi slt, %[[linearIndex_b]],
134 // CHECK-SAME: %[[boundVect_b]] : vector<[17]x[[$IDX_TYPE]]>
136 // 4. Bitcast to vector form.
137 // CHECK: %[[gep_b:.*]] = llvm.getelementptr {{.*}} :
138 // CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr, f32
140 // 5. Rewrite as a masked write.
141 // CHECK: llvm.intr.masked.store %[[loaded]], %[[gep_b]], %[[mask_b]]
142 // CHECK-SAME: {alignment = 4 : i32} :
143 // CHECK-SAME: vector<[17]xf32>, vector<[17]xi1> into !llvm.ptr
147 func.func @transfer_read_write_index_1d(%A : memref<?xindex>, %base: index) -> vector<17xindex> {
148 %f7 = arith.constant 7: index
149 %f = vector.transfer_read %A[%base], %f7
150 {permutation_map = affine_map<(d0) -> (d0)>} :
151 memref<?xindex>, vector<17xindex>
152 vector.transfer_write %f, %A[%base]
153 {permutation_map = affine_map<(d0) -> (d0)>} :
154 vector<17xindex>, memref<?xindex>
155 return %f: vector<17xindex>
157 // CHECK-LABEL: func @transfer_read_write_index_1d
158 // CHECK-SAME: %[[BASE:[a-zA-Z0-9]*]]: index) -> vector<17xindex>
159 // CHECK: %[[SPLAT:.*]] = arith.constant dense<7> : vector<17xindex>
160 // CHECK: %{{.*}} = builtin.unrealized_conversion_cast %[[SPLAT]] : vector<17xindex> to vector<17xi64>
162 // CHECK: %[[loaded:.*]] = llvm.intr.masked.load %{{.*}}, %{{.*}}, %{{.*}} {alignment = 8 : i32} :
163 // CHECK-SAME: (!llvm.ptr, vector<17xi1>, vector<17xi64>) -> vector<17xi64>
165 // CHECK: llvm.intr.masked.store %[[loaded]], %{{.*}}, %{{.*}} {alignment = 8 : i32} :
166 // CHECK-SAME: vector<17xi64>, vector<17xi1> into !llvm.ptr
168 func.func @transfer_read_write_index_1d_scalable(%A : memref<?xindex>, %base: index) -> vector<[17]xindex> {
169 %f7 = arith.constant 7: index
170 %f = vector.transfer_read %A[%base], %f7
171 {permutation_map = affine_map<(d0) -> (d0)>} :
172 memref<?xindex>, vector<[17]xindex>
173 vector.transfer_write %f, %A[%base]
174 {permutation_map = affine_map<(d0) -> (d0)>} :
175 vector<[17]xindex>, memref<?xindex>
176 return %f: vector<[17]xindex>
178 // CHECK-LABEL: func @transfer_read_write_index_1d
179 // CHECK-SAME: %[[BASE:[a-zA-Z0-9]*]]: index) -> vector<[17]xindex>
180 // CHECK: %[[SPLAT:.*]] = arith.constant dense<7> : vector<[17]xindex>
181 // CHECK: %{{.*}} = builtin.unrealized_conversion_cast %[[SPLAT]] : vector<[17]xindex> to vector<[17]xi64>
183 // CHECK: %[[loaded:.*]] = llvm.intr.masked.load %{{.*}}, %{{.*}}, %{{.*}} {alignment = 8 : i32} :
184 // CHECK-SAME: (!llvm.ptr, vector<[17]xi1>, vector<[17]xi64>) -> vector<[17]xi64>
186 // CHECK: llvm.intr.masked.store %[[loaded]], %{{.*}}, %{{.*}} {alignment = 8 : i32} :
187 // CHECK-SAME: vector<[17]xi64>, vector<[17]xi1> into !llvm.ptr
191 func.func @transfer_read_2d_to_1d(%A : memref<?x?xf32>, %base0: index, %base1: index) -> vector<17xf32> {
192 %f7 = arith.constant 7.0: f32
193 %f = vector.transfer_read %A[%base0, %base1], %f7
194 {permutation_map = affine_map<(d0, d1) -> (d1)>} :
195 memref<?x?xf32>, vector<17xf32>
196 return %f: vector<17xf32>
198 // CHECK-LABEL: func @transfer_read_2d_to_1d
199 // CHECK-SAME: %[[BASE_0:[a-zA-Z0-9]*]]: index, %[[BASE_1:[a-zA-Z0-9]*]]: index) -> vector<17xf32>
200 // CHECK: %[[c1:.*]] = arith.constant 1 : index
201 // CHECK: %[[DIM:.*]] = memref.dim %{{.*}}, %[[c1]] : memref<?x?xf32>
203 // Compute the in-bound index (dim - offset)
204 // CHECK: %[[BOUND:.*]] = arith.subi %[[DIM]], %[[BASE_1]] : index
206 // Create a vector with linear indices [ 0 .. vector_length - 1 ].
207 // CHECK: %[[linearIndex:.*]] = arith.constant dense
208 // CHECK-SAME: <[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> :
209 // CHECK-SAME: vector<17x[[$IDX_TYPE]]>
211 // Create bound vector to compute in-bound mask:
212 // [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ]
213 // CHECK: %[[btrunc:.*]] = arith.index_cast %[[BOUND]] : index to [[$IDX_TYPE]]
214 // CHECK: %[[boundVecInsert:.*]] = llvm.insertelement %[[btrunc]]
215 // CHECK: %[[boundVect:.*]] = llvm.shufflevector %[[boundVecInsert]]
216 // CHECK: %[[mask:.*]] = arith.cmpi slt, %[[linearIndex]], %[[boundVect]]
218 func.func @transfer_read_2d_to_1d_scalable(%A : memref<?x?xf32>, %base0: index, %base1: index) -> vector<[17]xf32> {
219 %f7 = arith.constant 7.0: f32
220 %f = vector.transfer_read %A[%base0, %base1], %f7
221 {permutation_map = affine_map<(d0, d1) -> (d1)>} :
222 memref<?x?xf32>, vector<[17]xf32>
223 return %f: vector<[17]xf32>
225 // CHECK-LABEL: func @transfer_read_2d_to_1d
226 // CHECK-SAME: %[[BASE_0:[a-zA-Z0-9]*]]: index, %[[BASE_1:[a-zA-Z0-9]*]]: index) -> vector<[17]xf32>
227 // CHECK: %[[c1:.*]] = arith.constant 1 : index
228 // CHECK: %[[DIM:.*]] = memref.dim %{{.*}}, %[[c1]] : memref<?x?xf32>
230 // Compute the in-bound index (dim - offset)
231 // CHECK: %[[BOUND:.*]] = arith.subi %[[DIM]], %[[BASE_1]] : index
233 // Create a vector with linear indices [ 0 .. vector_length - 1 ].
234 // CHECK: %[[linearIndex:.*]] = llvm.intr.stepvector : vector<[17]x[[$IDX_TYPE]]>
236 // Create bound vector to compute in-bound mask:
237 // [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ]
238 // CHECK: %[[btrunc:.*]] = arith.index_cast %[[BOUND]] : index to [[$IDX_TYPE]]
239 // CHECK: %[[boundVecInsert:.*]] = llvm.insertelement %[[btrunc]]
240 // CHECK: %[[boundVect:.*]] = llvm.shufflevector %[[boundVecInsert]]
241 // CHECK: %[[mask:.*]] = arith.cmpi slt, %[[linearIndex]], %[[boundVect]]
245 func.func @transfer_read_write_1d_non_zero_addrspace(%A : memref<?xf32, 3>, %base: index) -> vector<17xf32> {
246 %f7 = arith.constant 7.0: f32
247 %f = vector.transfer_read %A[%base], %f7
248 {permutation_map = affine_map<(d0) -> (d0)>} :
249 memref<?xf32, 3>, vector<17xf32>
250 vector.transfer_write %f, %A[%base]
251 {permutation_map = affine_map<(d0) -> (d0)>} :
252 vector<17xf32>, memref<?xf32, 3>
253 return %f: vector<17xf32>
255 // CHECK-LABEL: func @transfer_read_write_1d_non_zero_addrspace
256 // CHECK-SAME: %[[BASE:[a-zA-Z0-9]*]]: index) -> vector<17xf32>
258 // 1. Check address space for GEP is correct.
259 // CHECK: %[[gep:.*]] = llvm.getelementptr {{.*}} :
260 // CHECK-SAME: (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f32
262 // 2. Check address space of the memref is correct.
263 // CHECK: %[[c0:.*]] = arith.constant 0 : index
264 // CHECK: %[[DIM:.*]] = memref.dim %{{.*}}, %[[c0]] : memref<?xf32, 3>
266 // 3. Check address space for GEP is correct.
267 // CHECK: %[[gep_b:.*]] = llvm.getelementptr {{.*}} :
268 // CHECK-SAME: (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f32
270 func.func @transfer_read_write_1d_non_zero_addrspace_scalable(%A : memref<?xf32, 3>, %base: index) -> vector<[17]xf32> {
271 %f7 = arith.constant 7.0: f32
272 %f = vector.transfer_read %A[%base], %f7
273 {permutation_map = affine_map<(d0) -> (d0)>} :
274 memref<?xf32, 3>, vector<[17]xf32>
275 vector.transfer_write %f, %A[%base]
276 {permutation_map = affine_map<(d0) -> (d0)>} :
277 vector<[17]xf32>, memref<?xf32, 3>
278 return %f: vector<[17]xf32>
280 // CHECK-LABEL: func @transfer_read_write_1d_non_zero_addrspace_scalable
281 // CHECK-SAME: %[[BASE:[a-zA-Z0-9]*]]: index) -> vector<[17]xf32>
283 // 1. Check address space for GEP is correct.
284 // CHECK: %[[gep:.*]] = llvm.getelementptr {{.*}} :
285 // CHECK-SAME: (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f32
287 // 2. Check address space of the memref is correct.
288 // CHECK: %[[c0:.*]] = arith.constant 0 : index
289 // CHECK: %[[DIM:.*]] = memref.dim %{{.*}}, %[[c0]] : memref<?xf32, 3>
291 // 3. Check address space for GEP is correct.
292 // CHECK: %[[gep_b:.*]] = llvm.getelementptr {{.*}} :
293 // CHECK-SAME: (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f32
297 func.func @transfer_read_1d_inbounds(%A : memref<?xf32>, %base: index) -> vector<17xf32> {
298 %f7 = arith.constant 7.0: f32
299 %f = vector.transfer_read %A[%base], %f7 {in_bounds = [true]} :
300 memref<?xf32>, vector<17xf32>
301 return %f: vector<17xf32>
303 // CHECK-LABEL: func @transfer_read_1d_inbounds
304 // CHECK-SAME: %[[BASE:[a-zA-Z0-9]*]]: index) -> vector<17xf32>
306 // 1. Bitcast to vector form.
307 // CHECK: %[[gep:.*]] = llvm.getelementptr {{.*}} :
308 // CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr, f32
310 // 2. Rewrite as a load.
311 // CHECK: %[[loaded:.*]] = llvm.load %[[gep]] {alignment = 4 : i64} : !llvm.ptr -> vector<17xf32>
313 func.func @transfer_read_1d_inbounds_scalable(%A : memref<?xf32>, %base: index) -> vector<[17]xf32> {
314 %f7 = arith.constant 7.0: f32
315 %f = vector.transfer_read %A[%base], %f7 {in_bounds = [true]} :
316 memref<?xf32>, vector<[17]xf32>
317 return %f: vector<[17]xf32>
319 // CHECK-LABEL: func @transfer_read_1d_inbounds_scalable
320 // CHECK-SAME: %[[BASE:[a-zA-Z0-9]*]]: index) -> vector<[17]xf32>
322 // 1. Bitcast to vector form.
323 // CHECK: %[[gep:.*]] = llvm.getelementptr {{.*}} :
324 // CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr, f32
326 // 2. Rewrite as a load.
327 // CHECK: %[[loaded:.*]] = llvm.load %[[gep]] {alignment = 4 : i64} : !llvm.ptr -> vector<[17]xf32>
331 // CHECK-LABEL: func @transfer_read_write_1d_mask
332 // CHECK: %[[mask1:.*]] = arith.constant dense<[false, false, true, false, true]>
333 // CHECK: %[[cmpi:.*]] = arith.cmpi slt
334 // CHECK: %[[mask2:.*]] = arith.andi %[[cmpi]], %[[mask1]]
335 // CHECK: %[[r:.*]] = llvm.intr.masked.load %{{.*}}, %[[mask2]]
336 // CHECK: %[[cmpi_1:.*]] = arith.cmpi slt
337 // CHECK: %[[mask3:.*]] = arith.andi %[[cmpi_1]], %[[mask1]]
338 // CHECK: llvm.intr.masked.store %[[r]], %{{.*}}, %[[mask3]]
339 // CHECK: return %[[r]]
340 func.func @transfer_read_write_1d_mask(%A : memref<?xf32>, %base : index) -> vector<5xf32> {
341 %m = arith.constant dense<[0, 0, 1, 0, 1]> : vector<5xi1>
342 %f7 = arith.constant 7.0: f32
343 %f = vector.transfer_read %A[%base], %f7, %m : memref<?xf32>, vector<5xf32>
344 vector.transfer_write %f, %A[%base], %m : vector<5xf32>, memref<?xf32>
345 return %f: vector<5xf32>
348 // CHECK-LABEL: func @transfer_read_write_1d_mask_scalable
349 // CHECK-SAME: %[[mask:[a-zA-Z0-9]*]]: vector<[5]xi1>
350 // CHECK: %[[cmpi:.*]] = arith.cmpi slt
351 // CHECK: %[[mask1:.*]] = arith.andi %[[cmpi]], %[[mask]]
352 // CHECK: %[[r:.*]] = llvm.intr.masked.load %{{.*}}, %[[mask1]]
353 // CHECK: %[[cmpi_1:.*]] = arith.cmpi slt
354 // CHECK: %[[mask2:.*]] = arith.andi %[[cmpi_1]], %[[mask]]
355 // CHECK: llvm.intr.masked.store %[[r]], %{{.*}}, %[[mask2]]
356 // CHECK: return %[[r]]
357 func.func @transfer_read_write_1d_mask_scalable(%A : memref<?xf32>, %base : index, %m : vector<[5]xi1>) -> vector<[5]xf32> {
358 %f7 = arith.constant 7.0: f32
359 %f = vector.transfer_read %A[%base], %f7, %m : memref<?xf32>, vector<[5]xf32>
360 vector.transfer_write %f, %A[%base], %m : vector<[5]xf32>, memref<?xf32>
361 return %f: vector<[5]xf32>
366 // Can't lower xfer_read/xfer_write on tensors, but this shouldn't crash
368 // CHECK-LABEL: func @transfer_read_write_tensor
369 // CHECK: vector.transfer_read
370 // CHECK: vector.transfer_write
371 func.func @transfer_read_write_tensor(%A: tensor<?xf32>, %base : index) -> vector<4xf32> {
372 %f7 = arith.constant 7.0: f32
373 %c0 = arith.constant 0: index
374 %f = vector.transfer_read %A[%base], %f7 : tensor<?xf32>, vector<4xf32>
375 %w = vector.transfer_write %f, %A[%c0] : vector<4xf32>, tensor<?xf32>
376 "test.some_use"(%w) : (tensor<?xf32>) -> ()
377 return %f : vector<4xf32>