Files
clang-p2996/openmp/docs/remarks/OMP190.rst
Johannes Doerfert 3c8a4c6f47 [OpenMP] Eliminate redundant barriers in the same block
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
2022-02-01 01:07:50 -06:00

24 lines
830 B
ReStructuredText

.. _omp190:
Redundant barrier eliminated. (device only)
====================================================================
This optimization remark indicates that analysis determined an aligned
barrier in the device code to be redundant. This can occur when state
updates that have been synchronized by the barrier were eliminated too.
See also "Co-Designing an OpenMP GPU Runtime and Optimizations for Near-Zero
Overhead Execution", IPDPS'22.
Example
-------
This optimization will trigger for most target regions if state initialization
was removed as a consequence of "state forwarding". 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).
Diagnostic Scope
----------------
OpenMP optimization remark.