Patch originally by Giorgis Georgakoudis (@ggeorgakoudis), typos and bugs introduced later by me. This patch allows us to remove redundant barriers if they are part of a "consecutive" pair of barriers in a basic block with no impacted memory effect (read or write) in-between them. Memory accesses to local (=thread private) or constant memory are allowed to appear. Technically we could also allow any other memory that is not used to share information between threads, e.g., the result of a malloc that is also not captured. However, it will be easier to do more reasoning once the code is put into an AA. That will also allow us to look through phis/selects reasonably. At that point we should also deal with calls, barriers in different blocks, and other complexities. Differential Revision: https://reviews.llvm.org/D118002
39 lines
1.3 KiB
ReStructuredText
39 lines
1.3 KiB
ReStructuredText
.. _omp180:
|
|
|
|
Replacing OpenMP runtime call <call> with <value>.
|
|
====================================================================
|
|
|
|
This optimization remark indicates that analysis determined an OpenMP runtime
|
|
calls can be replaced with a constant value. This can occur when an OpenMP
|
|
runtime call that queried some internal state was found to always return a
|
|
single value after analysis.
|
|
|
|
Example
|
|
-------
|
|
|
|
This optimization will trigger for most target regions to simplify the runtime
|
|
once certain constants are known. This will trigger for internal runtime
|
|
functions so it requires enabling verbose remarks with
|
|
`-openmp-opt-verbose-remarks` (prefixed with `-mllvm` for use with clang).
|
|
|
|
.. code-block:: c++
|
|
|
|
void foo() {
|
|
#pragma omp target parallel
|
|
{ }
|
|
}
|
|
|
|
.. code-block:: console
|
|
|
|
$ clang test.c -fopenmp -fopenmp-targets=nvptx64 -O1 -Rpass=openmp-opt \
|
|
-mllvm -openmp-opt-verbose-remarks
|
|
remark: Replacing runtime call __kmpc_is_spmd_exec_mode with 1. [OMP180] [-Rpass=openmp-opt]
|
|
remark: Replacing runtime call __kmpc_is_spmd_exec_mode with 1. [OMP180] [-Rpass=openmp-opt]
|
|
remark: Replacing runtime call __kmpc_parallel_level with 1. [OMP180] [-Rpass=openmp-opt]
|
|
remark: Replacing runtime call __kmpc_parallel_level with 1. [OMP180] [-Rpass=openmp-opt]
|
|
|
|
Diagnostic Scope
|
|
----------------
|
|
|
|
OpenMP optimization remark.
|