Diagnostic 15304: non-vectorizable loop instance

ID 732951
Updated 9/25/2015
Version Latest
Public

author-image

By

Product Version: Intel® Fortran Compiler 15.0 and a later version 

Cause:

The vectorization report generated using Intel® Fortran Compiler's optimization and vectorization report options includes non-vectorized loop instance:

Windows* OS:  /O2  /Qopt-report:2  /Qopt-report-phase:vec    

Linux OS or OS X: -qopt-report-phase=vec

Example:

An example below will generate the following  remark in optimization report:

subroutine add(k, a)  
  integer :: k  
  real :: a(20)
  
   DO i = 1, 20 
    a(i) = a(i+k) * 2.0 
     end do  
end subroutine add

$ ifort -c -qopt-report-file=stderr -qopt-report-phase=vec f15304.f90 

Begin optimization report for: ADD

    Report from: Vector optimizations [vec].

LOOP BEGIN at f15304.f90(6,5)
<Multiversioned v3>
   remark #15304: loop was not vectorized: non-vectorizable loop instance from multiversioning
LOOP END

Resolution: 

The compiler generates 3 loop versions, for k=0, k>0 and k<0. The version for k<0 cannot be safely vectorized because each later iteration may depend on the result of earlier iterations. You can override the compiler by inserting the !DIR$ IVDEP directive.The IVDEP directive tells the compiler it can safely ignore potential dependencies, so it does not need to generate special code for the case of K<0.

subroutine add(k, a)  
  integer :: k  
  real :: a(20)
!DIR$ IVDEP   
   DO i = 1, 20 
    a(i) = a(i+k) * 2.0 
     end do  
end subroutine add

$ ifort -c -qopt-report-file=stderr -qopt-report-phase=vec f15304.f90 

Begin optimization report for: ADD
    Report from: Vector optimizations [vec]

LOOP BEGIN at f15304.f90(6,5)

    remark #15300: LOOP WAS VECTORIZED

LOOP END

See also:

Requirements for Vectorizable Loops

Vectorization Essentials

Vectorization and Optimization Reports

Back to the list of vectorization diagnostics for Intel® Fortran