1// RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,256 test-fastest-varying=2,0" | FileCheck %s 2 3// Permutation maps used in vectorization. 4// CHECK: #[[map_proj_d0d1d2_d0d2:map[0-9]*]] = affine_map<(d0, d1, d2) -> (d0, d2)> 5 6func.func @vec2d(%A : memref<?x?x?xf32>) { 7 %c0 = arith.constant 0 : index 8 %c1 = arith.constant 1 : index 9 %c2 = arith.constant 2 : index 10 %M = memref.dim %A, %c0 : memref<?x?x?xf32> 11 %N = memref.dim %A, %c1 : memref<?x?x?xf32> 12 %P = memref.dim %A, %c2 : memref<?x?x?xf32> 13 // CHECK: affine.for %{{.*}} = 0 to %{{.*}} step 32 14 // CHECK: affine.for %{{.*}} = 0 to %{{.*}} { 15 // CHECK: affine.for %{{.*}} = 0 to %{{.*}} step 256 16 // CHECK: {{.*}} = vector.transfer_read %{{.*}}[%{{.*}}, %{{.*}}, %{{.*}}], %{{.*}} {permutation_map = #[[map_proj_d0d1d2_d0d2]]} : memref<?x?x?xf32>, vector<32x256xf32> 17 affine.for %i0 = 0 to %M { 18 affine.for %i1 = 0 to %N { 19 affine.for %i2 = 0 to %P { 20 %a2 = affine.load %A[%i0, %i1, %i2] : memref<?x?x?xf32> 21 } 22 } 23 } 24 // CHECK: for {{.*}} = 0 to %{{.*}} { 25 // CHECK: for {{.*}} = 0 to %{{.*}} { 26 // CHECK: for {{.*}} = 0 to %{{.*}} { 27 // For the case: --test-fastest-varying=2 --test-fastest-varying=0 no 28 // vectorization happens because of loop nesting order 29 affine.for %i3 = 0 to %M { 30 affine.for %i4 = 0 to %N { 31 affine.for %i5 = 0 to %P { 32 %a5 = affine.load %A[%i4, %i5, %i3] : memref<?x?x?xf32> 33 } 34 } 35 } 36 return 37} 38