Diagnostic 15304: non-vectorizable loop instance

By Devorah Hayman,

Published:10/02/2014   Last Updated:09/25/2015

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

 

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