Diagnostic 15018: loop was not vectorized: not inner loop

Published:11/17/2008   Last Updated:11/17/2008

Cause:

Always the inner loop is targeted for vectorization and outer loop is targeted for parallelization. Below is an example for this scenario. 

Example:

#include<iostream>
#define N 25
int main(){
int a[N][N], b[N], i;
for(int j = 0; j < N; j++)
{
        for(int i = 0; i < N; i++)
                a[j][i] = 0;
        b[j] = 1;
}
int sum = __sec_reduce_add(a[:][:]) + __sec_reduce_add(b[:]);
return 0;
}


$ icpc example7.cc -vec-report2
example7.cc(7): (col. 2) remark: loop was not vectorized: loop was transformed to memset or memcpy
example7.cc(5): (col. 1) remark: loop was not vectorized: not inner loop

Recommendation:

Add the following pragma ("#pragma omp simd collapse(2)") before the outer for loop and compiler with -openmp compiler option. The collapse(2) explicitly states the compiler to collapse the 2 loops into 1 for vectorization. Doing the above will produce the following vectorization report:
remark: OpenMP SIMD LOOP WAS VECTORIZED

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804