| 1 |
// RUN: mlir-opt %s -affine-super-vectorizer-test=vectorize-affine-loop-nest -split-input-file 2>&1 | FileCheck %s |
| 2 |
|
| 3 |
func.func @unparallel_loop_reduction_unsupported(%in: memref<256x512xf32>, %out: memref<256xf32>) { |
| 4 |
// CHECK: Outermost loop cannot be parallel |
| 5 |
%cst = arith.constant 1.000000e+00 : f32 |
| 6 |
%final_red = affine.for %j = 0 to 512 iter_args(%red_iter = %cst) -> (f32) { |
| 7 |
%add = arith.addf %red_iter, %red_iter : f32 |
| 8 |
affine.yield %add : f32 |
| 9 |
} |
| 10 |
return |
| 11 |
} |
| 12 |
|
| 13 |
// ----- |
| 14 |
|
| 15 |
#map = affine_map<(d0)[s0] -> (d0 mod s0)> |
| 16 |
#map1 = affine_map<(d0)[s0] -> (d0 floordiv s0)> |
| 17 |
|
| 18 |
func.func @iv_mapped_to_multiple_indices_unsupported(%arg0: index) -> memref<2x2xf32> { |
| 19 |
%c2 = arith.constant 2 : index |
| 20 |
%cst = arith.constant 1.0 : f32 |
| 21 |
%alloc = memref.alloc() : memref<2x2xf32> |
| 22 |
|
| 23 |
affine.for %i = 0 to 4 { |
| 24 |
%row = affine.apply #map1(%i)[%c2] |
| 25 |
%col = affine.apply #map(%i)[%c2] |
| 26 |
affine.store %cst, %alloc[%row, %col] : memref<2x2xf32> |
| 27 |
} |
| 28 |
|
| 29 |
return %alloc : memref<2x2xf32> |
| 30 |
} |
| 31 |
|
| 32 |
// CHECK: #[[$ATTR_0:.+]] = affine_map<(d0)[s0] -> (d0 floordiv s0)> |
| 33 |
// CHECK: #[[$ATTR_1:.+]] = affine_map<(d0)[s0] -> (d0 mod s0)> |
| 34 |
|
| 35 |
// CHECK-LABEL: func.func @iv_mapped_to_multiple_indices_unsupported( |
| 36 |
// CHECK-SAME: %[[VAL_0:.*]]: index) -> memref<2x2xf32> { |
| 37 |
// CHECK: %[[VAL_1:.*]] = arith.constant 2 : index |
| 38 |
// CHECK: affine.for %[[VAL_4:.*]] = 0 to 4 { |
| 39 |
// CHECK: %[[VAL_5:.*]] = affine.apply #[[$ATTR_0]](%[[VAL_4]]){{\[}}%[[VAL_1]]] |
| 40 |
// CHECK: %[[VAL_6:.*]] = affine.apply #[[$ATTR_1]](%[[VAL_4]]){{\[}}%[[VAL_1]]] |
| 41 |
// CHECK: } |
| 42 |
// CHECK: } |