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:

icc -std=c99 -O2 -D NOFUNCCALL -qopt-report=1 -qopt-report-phase=vec Multiply.c Driver.c -o MatVector

Note

We replace the call to the Matvec function with an inline equivalent with -D NOFUNCCALL.

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 145 noted in the vectorization report matvec.optrpt:

LOOP BEGIN at Driver.c(140,5)
   remark #25460: No loop optimizations reported

   LOOP BEGIN at Driver.c(143,9)
      remark #25460: No loop optimizations reported

      LOOP BEGIN at Driver.c(145,13)
         remark #15300: LOOP WAS VECTORIZED
      LOOP END

      LOOP BEGIN at Driver.c(145,13)
      <Remainder loop for vectorization>
      LOOP END
   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.

icc -std=c99 -O2 -D NOFUNCCALL -qopt-report-phase=vec,loop -qopt-report=2 Multiply.c Driver.c -o MatVector

The vectorization report Multiply.optrpt indicates that the loop at line 37 in Multiply.c did not vectorize because it is not the innermost loop of the loop nest. Two versions of the innermost loop at line 49 were generated, and one version was vectorized.

LOOP BEGIN at Multiply.c(37,5)
   remark #15542: loop was not vectorized: inner loop was already vectorized

   LOOP BEGIN at Multiply.c(49,9)
   <Peeled loop for vectorization, Multiversioned v1>
   LOOP END

   LOOP BEGIN at Multiply.c(49,9)
   <Multiversioned v1>
      remark #25228: Loop multiversioned for Data Dependence
      remark #15300: LOOP WAS VECTORIZED
   LOOP END

   LOOP BEGIN at Multiply.c(49,9)
   <Alternate Alignment Vectorized Loop, Multiversioned v1>
   LOOP END

   LOOP BEGIN at Multiply.c(49,9)
   <Remainder loop for vectorization, Multiversioned v1>
   LOOP END

   LOOP BEGIN at Multiply.c(49,9)
   <Multiversioned v2>
      remark #15304: loop was not vectorized: non-vectorizable loop instance from multiversioning
      remark #25439: unrolled with remainder by 2
   LOOP END

   LOOP BEGIN at Multiply.c(49,9)
   <Remainder, Multiversioned v2>
   LOOP END

Note