Tutorial: Using Auto Vectorization with Intel® Fortran Compiler

ID 758497
Date 4/11/2022
Public

Generating a Vectorization Report

A vectorization report shows what loops in your code were vectorized and explains why other loops were not vectorized. To generate a vectorization report, use the qopt-report-phase=vec compiler options together with qopt-report=1 or qopt-report=2.

Together with qopt-report-phase=vec, qopt-report=1 generates a report with the loops in your code that were vectorized while qopt-report-phase=vec with qopt-report=2 generates a report with both the loops in your code that were vectorized and the reason that other loops were not vectorized.

Because vectorization is turned off with the O1 option, the compiler does not generate a vectorization report. To generate a vectorization report, compile your project with the O2, qopt-report-phase=vec, qopt-report=1 options:

ifort -real-size 64 -O2 -qopt-report=1 -qopt-report-phase=vec matvec.f90 driver.f90 -o MatVector

Recompile the program and then execute MatVector. Record the new execution time. The reduction in time is mostly due to auto-vectorization of the inner loop at line 32 noted in the vectorization report matvec.optrpt:

Begin optimization report for: matvec_

    Report from: Vector optimizations [vec]


LOOP BEGIN at matvec.f90(26,3)
   remark #25460: No loop optimizations reported

   LOOP BEGIN at matvec.f90(26,3)
      remark #15300: LOOP WAS VECTORIZED
   LOOP END

   LOOP BEGIN at matvec.f90(26,3)
   <Remainder loop for vectorization>
  LOOP END
LOOP END

LOOP BEGIN at matvec.f90(27,3)
   remark #25460: No loop optimizations reported

   LOOP BEGIN at matvec.f90(32,6)
   <Peeled loop for vectorization>
   LOOP END

   LOOP BEGIN at matvec.f90(32,6)
      remark #15300: LOOP WAS VECTORIZED
   LOOP END

   LOOP BEGIN at matvec.f90(32,6)
   <Alternate Alignment Vectorized Loop>
   LOOP END

   LOOP BEGIN at matvec.f90(32,6)
   <Remainder loop for vectorization>
   LOOP END
LOOP END

NOTE:

Your line and column numbers may be different.

qopt-report=2 with qopt-report-phase=vec,loop returns a list that also includes loops that were not vectorized or multi-versioned, along with the reason that the compiler did not vectorize them or multi-version the loop.

Recompile your project with the qopt-report=2 and qopt-report-phase=vec,loop options.

ifort -real-size 64 -O2 -qopt-report-phase=vec -qopt-report=2 matvec.f90 driver.f90 -o MatVector

The vectorization report matvec.optrpt indicates that the loop at line 33 in matvec.f90 did not vectorize because it is not the innermost loop of the loop nest.

LOOP BEGIN at matvec.f90(27,3)
   remark #15542: loop was not vectorized: inner loop was already vectorized

   LOOP BEGIN at matvec.f90(32,6)
   <Peeled loop for vectorization>
  LOOP END

   LOOP BEGIN at matvec.f90(32,6)
      remark #15300: LOOP WAS VECTORIZED
   LOOP END

   LOOP BEGIN at matvec.f90(32,6)
   <Alternate Alignment Vectorized Loop>
   LOOP END

   LOOP BEGIN at matvec.f90(32,6)
   <Remainder loop for vectorization>
      remark #15335: remainder loop was not vectorized: vectorization possible but seems inefficient. Use vector always directive or -vec-threshold0 to override 
   LOOP END
LOOP END

NOTE:
  • Your line and column numbers may be different.

  • For more information on the qopt-report and qopt-report-phase compiler options, see the Compiler Options section in the Intel® Fortran Compiler Developer Guide and Reference.

Did you find the information on this page useful?

Characters remaining:

Feedback Message