xref: /llvm-project/openmp/docs/remarks/OptimizationRemarks.rst (revision c44fa3e8a9a44c2e9a575768a3c185354b9f6c17)
1OpenMP Optimization Remarks
2===========================
3
4The :doc:`OpenMP-Aware optimization pass </optimizations/OpenMPOpt>` is able to
5generate compiler remarks for performed and missed optimisations. To emit them,
6pass these options to the Clang invocation: ``-Rpass=openmp-opt
7-Rpass-analysis=openmp-opt -Rpass-missed=openmp-opt``.  For more information and
8features of the remark system, consult the clang documentation:
9
10+ `Clang options to emit optimization reports <https://clang.llvm.org/docs/UsersManual.html#options-to-emit-optimization-reports>`_
11+ `Clang diagnostic and remark flags <https://clang.llvm.org/docs/ClangCommandLineReference.html#diagnostic-flags>`_
12+ The `-foptimization-record-file flag
13  <https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-foptimization-record-file>`_
14  and the `-fsave-optimization-record flag
15  <https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-fsave-optimization-record>`_
16
17
18OpenMP Remarks
19--------------
20
21.. toctree::
22   :hidden:
23   :maxdepth: 1
24
25   OMP100
26   OMP101
27   OMP102
28   OMP110
29   OMP111
30   OMP112
31   OMP113
32   OMP120
33   OMP121
34   OMP130
35   OMP131
36   OMP132
37   OMP133
38   OMP140
39   OMP150
40   OMP160
41   OMP170
42   OMP180
43   OMP190
44
45.. list-table::
46   :widths: 15 15 70
47   :header-rows: 1
48
49   * - Diagnostics Number
50     - Diagnostics Kind
51     - Diagnostics Description
52   * - :ref:`OMP100 <omp100>`
53     - Analysis
54     - Potentially unknown OpenMP target region caller.
55   * - :ref:`OMP101 <omp101>`
56     - Analysis
57     - Parallel region is used in unknown / unexpected ways. Will not attempt to
58       rewrite the state machine.
59   * - :ref:`OMP102 <omp102>`
60     - Analysis
61     - Parallel region is not called from a unique kernel. Will not attempt to
62       rewrite the state machine.
63   * - :ref:`OMP110 <omp110>`
64     - Optimization
65     - Moving globalized variable to the stack.
66   * - :ref:`OMP111 <omp111>`
67     - Optimization
68     - Replaced globalized variable with X bytes of shared memory.
69   * - :ref:`OMP112 <omp112>`
70     - Missed
71     - Found thread data sharing on the GPU. Expect degraded performance due to
72       data globalization.
73   * - :ref:`OMP113 <omp113>`
74     - Missed
75     - Could not move globalized variable to the stack. Variable is potentially
76       captured in call. Mark parameter as `__attribute__((noescape))` to
77       override.
78   * - :ref:`OMP120 <omp120>`
79     - Optimization
80     - Transformed generic-mode kernel to SPMD-mode.
81   * - :ref:`OMP121 <omp121>`
82     - Analysis
83     - Value has potential side effects preventing SPMD-mode execution. Add
84       `[[omp::assume(\"ompx_spmd_amenable\")]]` to the called function
85       to override.
86   * - :ref:`OMP130 <omp130>`
87     - Optimization
88     - Removing unused state machine from generic-mode kernel.
89   * - :ref:`OMP131 <omp131>`
90     - Optimization
91     - Rewriting generic-mode kernel with a customized state machine.
92   * - :ref:`OMP132 <omp132>`
93     - Analysis
94     - Generic-mode kernel is executed with a customized state machine that
95       requires a fallback.
96   * - :ref:`OMP133 <omp133>`
97     - Analysis
98     - Call may contain unknown parallel regions. Use
99       `[[omp::assume("omp_no_parallelism")]]` to override.
100   * - :ref:`OMP140 <omp140>`
101     - Analysis
102     - Could not internalize function. Some optimizations may not be possible.
103   * - :ref:`OMP150 <omp150>`
104     - Optimization
105     - Parallel region merged with parallel region at <location>.
106   * - :ref:`OMP160 <omp160>`
107     - Optimization
108     - Removing parallel region with no side-effects.
109   * - :ref:`OMP170 <omp170>`
110     - Optimization
111     - OpenMP runtime call <call> deduplicated.
112   * - :ref:`OMP180 <omp180>`
113     - Optimization
114     - Replacing OpenMP runtime call <call> with <value>.
115   * - :ref:`OMP190 <omp190>`
116     - Optimization
117     - Redundant barrier eliminated. (device only)
118