Tutorial

  • 04/11/2022
  • Public Content

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
and
Qopt-report-phase:vec
compiler options.
Together with
Qopt-report-phase:vec
,
Qopt-report:1
generates a report with the loops in your code that were vectorized while
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.
To use these options:
  1. In your project's property pages select
    Configuration Properties
    C/C++
    Diagnostics [Intel C++]
    .
  2. For
    Optimization Diagnostics Level
    , select
    Level 1 (/Qopt-report:1)
    .
  3. For
    Optimization Diagnostics Phase
    , select
    Vectorization (/Qopt-report-phase:vec)
    .
Because vectorization is turned off with the
O1
option, the compiler does not generate a vectorization report. To generate a vectorization report, build your project with the
O2
option:
To set the
O2
option:
  1. In your project's property pages select
    Configuration Properties
    C/C++
    Optimization
    .
  2. For
    Optimization
    , select
    Maximize Speed
    .
For the purpose of showing the report, we'll also replace the call to
matvec()
in
Driver.c
with the equivalent
C
code by defining the preprocessor macro
NOFUNCCALL
. To do this, add
NOFUNCCALL
with a semicolon to the list of user defined macros at
Project
Properties
C/C++
Preprocessor
Preprocessor Definitions
.
Rebuild your project and then run the executable (
Debug > Start Without Debugging
). 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
Compiler Optimization Report
window, as well as in the
*.optrpt
files in the object directory.
For example, the following messages appear in
driver.optrpt
:
LOOP BEGIN at Driver.c(140,2) Driver.c(145,2):remark #25460: No loop optimizations reported LOOP BEGIN at Driver.c(143,3) Driver.c(148,3):remark #25460: No loop optimizations reported LOOP BEGIN at Driver.c(145,4) Driver.c(150,4):remark #15300: LOOP WAS VECTORIZED LOOP END
Your line and column numbers may be different.
The
Qopt-report:2
option returns a list that also includes loops that were not vectorized, along with the reason why the compiler did not vectorize them. Add the
Qopt-report:2
option in the same way you added
Qopt-report:1
above, instead selecting
Level 2 (/Qopt-report:2)
.
Rebuild your project.
The vectorization report 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
.
The following messages appear in
Multiply.optrpt
:
LOOP BEGIN at Multiply.c(37,5) 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 Multiply.c(49,9):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 Multiply.c(49,9):remark #15304: loop was not vectorized: non-vectorizable loop instance from multiversioning LOOP END LOOP BEGIN at Multiply.c(49,9) Remainder, Multiversioned v2 LOOP END LOOP END
  • 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
    Compiler User and Reference Guide
    .

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.