Product Version: Intel(R) Visual Fortran Compiler XE 15.0.0.070
Cause:
The vectorization report generated when using Visual Fortran Compiler's optimization options ( -O2 -assume:dummy_aliases -Qopt-report:2 ) states that loop was not vectorized due vector dependence, outer loop depends on inner loop.
Example:
An example below will generate the following remark in optimization report:
subroutine foo(a, n1, n) implicit none integer, intent(in) :: n, n1 real, intent(inout) :: a(n,n1) integer :: i, j do i=1,n do j=1,n a(j,i) = a(j-1,i)+1 end do end do end subroutine foo
Report from: Loop nest, Vector & Auto-parallelization optimizations [loop, vec, par]
LOOP BEGIN
remark #15541: outer loop was not auto-vectorized: consider using SIMD directive.
LOOP END
Resolution:
Using !DIR$ SIMD directive results in outer loop being vectorized, as shown:
subroutine foo(a, n1, n) implicit none integer, intent(in) :: n, n1 real, intent(inout) :: a(n,n1) integer :: i, j !DIR$ SIMD do i=1,n do j=1,n a(j,i) = a(j-1,i)+1 end do end do end subroutine foo
LOOP BEGIN
remark #15301: SIMD LOOP WAS VECTORIZED.
LOOP END
See also:
Requirements for Vectorizable Loops
Vectorization and Optimization Reports