brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 9377cf6 Raw
25 lines · plain
1// RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,256 test-fastest-varying=1,0 vectorize-reductions=true" -verify-diagnostics2 3// TODO: Vectorization of reduction loops along the reduction dimension is not4//       supported for higher-rank vectors yet, so we are just checking that an5//       error message is produced.6 7// expected-error@+1 {{Vectorizing reductions is supported only for 1-D vectors}}8func.func @vecdim_reduction_2d(%in: memref<256x512x1024xf32>, %out: memref<256xf32>) {9 %cst = arith.constant 0.000000e+00 : f3210 affine.for %i = 0 to 256 {11   %sum_j = affine.for %j = 0 to 512 iter_args(%red_iter_j = %cst) -> (f32) {12     %sum_k = affine.for %k = 0 to 1024 iter_args(%red_iter_k = %cst) -> (f32) {13       %ld = affine.load %in[%i, %j, %k] : memref<256x512x1024xf32>14       %add = arith.addf %red_iter_k, %ld : f3215       affine.yield %add : f3216     }17     %add = arith.addf %red_iter_j, %sum_k : f3218     affine.yield %add : f3219   }20   affine.store %sum_j, %out[%i] : memref<256xf32>21 }22 return23}24 25