Compiler remarks

Linaro MAP can annotate your source code with compiler remarks extracted from compiler optimization reports.

Compiler remark annotations

A compiler optimization report is created for each compilation unit. Linaro MAP currently supports the following compilers with this feature:

  • Arm Compiler for Linux

  • Cray Compiling Environment 12 and later

  • GNU C/C++/Fortran Compiler 12 and later

  • Intel oneAPI HPC Toolkit

To generate the compiler report, introduce the following compiler-dependent compilation flag to your build scripts:

  • -fsave-optimization-record=yaml (Cray Compiling Environment 12 and later, and Arm Compiler for Linux)

  • -fsave-optimization-record (GNU C/C++/Fortran Compiler 11 and later)

  • -qopt-report[=min|med|max] (Intel oneAPI HPC Toolkit)

The compiler generates an optimization report for every compilation unit in your build system. The report filename extensions are compiler-dependent, for example:

  • example.opt.yaml (Cray Compiling Environment 12 and later, Arm Compiler for Linux, and Intel oneAPI HPC Toolkit)

  • program-example.c.opt-record.json.gz (GNU C/C++/Fortran Compiler 11 and later)

After profiling your program with Linaro MAP, ensure that compiler remarks are enabled by checking the Compiler remarks ‣ Enabled menu option. Linaro MAP automatically locates the compiler report associated with your source code and displays them as annotations.

Note

As an advanced feature, compiler remarks are disabled by default.

Setting build directories

Linaro MAP does not locate compiler remarks for non-trivial build systems. In this case, specify the build directory of your program using the Compiler remarks ‣ Build directories… menu option.

Note

Build directories are searched in the order they are specified.

Edit build directories

Alternatively, set your program’s build directories before profiling by using the --build-directories command line argument (see Command line arguments) or the Run dialog.

Source code annotations

Compiler remarks are displayed as annotations next to your source code. Their color indicates the type of remark present in the following priority order:

  • Red: failed or missed optimizations

  • Green: successful or passed optimizations

  • White: information or analysis notes

If you hover the mouse cursor over an annotation, a remark tooltip will be displayed listing the compiler remarks associated with the source code line. If you click on an annotation, the tooltip will become movable and hovering your mouse cursor over the tooltip will highlight the code segments to which the remarks refer. Click on the hyperlinks to jump to the specified source code locations.

Remark tooltip

Remarks filtering

Several compiler remarks can be associated with a single source code line. If a remark tooltip becomes too long, it will be truncated with a to indicate there is additional content. To view the hidden content, try filtering out compiler remarks that are not of concern by using the Compiler remarks menu options. Compiler remarks can be filtered by type, as well as the compiler optimization pass that generated them.

Note

Enable the compiler remarks feature to view the remark types and optimization passes associated with your source file.

Embedding remarks

Linaro MAP requires access to the compiler report in order to display compiler remarks. This may not be possible if, for example, the .map file has been moved to another system, or the build directory has been removed.

Compiler remarks can be embedded into the .map file so that they are present wherever the profile is viewed. Use the File ‣ Save Profile Data As menu option to create a .map file with embedded remarks.

Note

Embedding remarks will generate a .map file of a larger size.

Only compiler remarks for source code files that have been opened while viewing the .map file will be embedded. The current filtering options will be applied (see the Remarks filtering section) to which remarks are embedded. Consider adjusting the filters to generate a .map file of a manageable size.

Another option is for Linaro MAP to generate a .map file with embedded remarks after profiling your program. Use the --embed-compiler-remarks command line option, or check the Run dialog option to accomplish this. Ensure that build directories have been set (see the Setting build directories section) so that Linaro MAP finds the necessary compiler reports.

Note

Linaro MAP will require additional time during the analysis phase when embedding remarks with this method.

Additionally, the types of remarks that are embedded can be fine-tuned with the --exclude-compiler-remarks option (see Command line arguments), or in the Run dialog.

Note

A .map file containing embedded remarks will not load additional compiler optimization reports.