2020-10-28 02:16:03 +08:00
|
|
|
.. title:: Welcome to the documentation of OpenMP in LLVM!
|
2020-09-17 05:15:56 +08:00
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
.. note::
|
|
|
|
This document is a work in progress and most of the expected content is not
|
|
|
|
yet available. While you can expect changes, we always welcome feedback and
|
|
|
|
additions. Please contact, e.g., through ``openmp-dev@lists.llvm.org``.
|
2020-09-17 05:15:56 +08:00
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
LLVM/OpenMP Documentation <self>
|
|
|
|
|
|
|
|
|
|
|
|
LLVM/OpenMP Design & Overview
|
2020-09-17 05:15:56 +08:00
|
|
|
=============================
|
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
OpenMP impacts various parts of the LLVM project, from the frontends (`Clang
|
|
|
|
<https://clang.llvm.org/docs/OpenMPSupport.html>`_ and Flang), through
|
|
|
|
middle-end :ref:`optimizations <llvm_openmp_optimizations>`, up to the
|
|
|
|
multitude of available :ref:`OpenMP runtimes <openmp_runtimes>`.
|
|
|
|
|
|
|
|
A high-level overview of OpenMP in LLVM can be found :doc:`here <design/Overview>`.
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
design/Overview
|
|
|
|
|
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)
This patch implements Clang support for an original OpenMP extension
we have developed to support OpenACC: the `ompx_hold` map type
modifier. The next patch in this series, D106510, implements OpenMP
runtime support.
Consider the following example:
```
#pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x
{
foo(); // might have map(delete: x)
#pragma omp target map(present, alloc: x) // x is guaranteed to be present
printf("%d\n", x);
}
```
The `ompx_hold` map type modifier above specifies that the `target
data` directive holds onto the mapping for `x` throughout the
associated region regardless of any `target exit data` directives
executed during the call to `foo`. Thus, the presence assertion for
`x` at the enclosed `target` construct cannot fail. (As usual, the
standard OpenMP reference count for `x` must also reach zero before
the data is unmapped.)
Justification for inclusion in Clang and LLVM's OpenMP runtime:
* The `ompx_hold` modifier supports OpenACC functionality (structured
reference count) that cannot be achieved in standard OpenMP, as of
5.1.
* The runtime implementation for `ompx_hold` (next patch) will thus be
used by Flang's OpenACC support.
* The Clang implementation for `ompx_hold` (this patch) as well as the
runtime implementation are required for the Clang OpenACC support
being developed as part of the ECP Clacc project, which translates
OpenACC to OpenMP at the directive AST level. These patches are the
first step in upstreaming OpenACC functionality from Clacc.
* The Clang implementation for `ompx_hold` is also used by the tests
in the runtime implementation. That syntactic support makes the
tests more readable than low-level runtime calls can. Moreover,
upstream Flang and Clang do not yet support OpenACC syntax
sufficiently for writing the tests.
* More generally, the Clang implementation enables a clean separation
of concerns between OpenACC and OpenMP development in LLVM. That
is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's
extended OpenMP implementation and test suite without directly
considering OpenACC's language and execution model, which can be
handled by LLVM's OpenACC developers.
* OpenMP users might find the `ompx_hold` modifier useful, as in the
above example.
See new documentation introduced by this patch in `openmp/docs` for
more detail on the functionality of this extension and its
relationship with OpenACC. For example, it explains how the runtime
must support two reference counts, as specified by OpenACC.
Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new
command-line option introduced by this patch, is specified.
Reviewed By: ABataev, jdoerfert, protze.joachim, grokos
Differential Revision: https://reviews.llvm.org/D106509
2021-09-01 03:17:07 +08:00
|
|
|
OpenACC Support
|
|
|
|
===============
|
|
|
|
|
|
|
|
:doc:`OpenACC support <openacc/Overview>` is under development for
|
|
|
|
both Flang and Clang. For this purpose, LLVM's OpenMP runtimes are
|
|
|
|
being extended to serve as OpenACC runtimes. In some cases, Clang
|
|
|
|
supports :doc:`OpenMP extensions <openacc/OpenMPExtensions>` to make
|
|
|
|
the additional functionality also available in OpenMP applications.
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
openacc/Overview
|
2020-10-28 02:16:03 +08:00
|
|
|
|
|
|
|
LLVM/OpenMP Optimizations
|
|
|
|
=========================
|
|
|
|
|
|
|
|
LLVM, since `version 11 <https://releases.llvm.org/download.html#11.0.0>`_ (12 Oct
|
|
|
|
2020), has an :doc:`OpenMP-Aware optimization pass <optimizations/OpenMPOpt>`
|
|
|
|
as well as the ability to :doc:`perform "scalar optimizations" across OpenMP region
|
|
|
|
boundaries <optimizations/OpenMPUnawareOptimizations>`.
|
|
|
|
|
|
|
|
In-depth discussion of the topic can be found :doc:`here <optimizations/Overview>`.
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
optimizations/Overview
|
|
|
|
|
|
|
|
LLVM/OpenMP Optimization Remarks
|
|
|
|
================================
|
2020-09-17 05:15:56 +08:00
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
LLVM has an elaborate ecosystem around `analysis and optimization remarks
|
|
|
|
<https://llvm.org/docs/Remarks.html>`_ issues during
|
|
|
|
compilation. The remarks can be enabled from the clang frontend `[1]`_ `[2]`_
|
|
|
|
in various formats `[3]`_ `[4]`_ to be used by tools, i.a., `opt-viewer` or
|
|
|
|
`llvm-opt-report` (dated).
|
|
|
|
|
|
|
|
The OpenMP optimizations in LLVM have been developed with remark support as a
|
|
|
|
priority. For a list of OpenMP specific remarks and more information on them,
|
|
|
|
please refer to :doc:`remarks/OptimizationRemarks`.
|
|
|
|
|
|
|
|
|
|
|
|
.. _`[1]`: https://clang.llvm.org/docs/UsersManual.html#options-to-emit-optimization-reports
|
|
|
|
.. _`[2]`: https://clang.llvm.org/docs/ClangCommandLineReference.html#diagnostic-flags
|
|
|
|
.. _`[3]`: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-foptimization-record-file
|
|
|
|
.. _`[4]`: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-fsave-optimization-record
|
|
|
|
|
|
|
|
+ `[1]`_ https://clang.llvm.org/docs/UsersManual.html#options-to-emit-optimization-reports
|
|
|
|
+ `[2]`_ https://clang.llvm.org/docs/ClangCommandLineReference.html#diagnostic-flags
|
|
|
|
+ `[3]`_ https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-foptimization-record-file
|
|
|
|
+ `[4]`_ https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-fsave-optimization-record
|
|
|
|
|
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
remarks/OptimizationRemarks
|
|
|
|
|
|
|
|
|
2020-11-26 01:49:30 +08:00
|
|
|
Support, Getting Involved, and Frequently Asked Questions (FAQ)
|
|
|
|
===============================================================
|
2020-10-28 02:16:03 +08:00
|
|
|
|
|
|
|
Dealing with OpenMP can be complicated. For help with the setup of an OpenMP
|
|
|
|
(offload) capable compiler toolchain, its usage, and common problems, consult
|
|
|
|
the :doc:`Support and FAQ <SupportAndFAQ>` page.
|
|
|
|
|
2020-11-26 01:49:30 +08:00
|
|
|
We also encourage everyone interested in OpenMP in LLVM to :doc:`get involved
|
|
|
|
<SupportAndFAQ>`.
|
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
SupportAndFAQ
|
2020-09-17 05:15:56 +08:00
|
|
|
|
|
|
|
Release Notes
|
|
|
|
=============
|
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
The current (in-progress) release notes can be found :doc:`here <ReleaseNotes>` while
|
|
|
|
release notes for releases, starting with LLVM 12, will be available on `the
|
|
|
|
Download Page <https://releases.llvm.org/download.html>`_.
|
|
|
|
|
2020-09-17 05:15:56 +08:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
2020-10-28 02:16:03 +08:00
|
|
|
:maxdepth: 1
|
2020-09-17 05:15:56 +08:00
|
|
|
|
2020-10-28 02:16:03 +08:00
|
|
|
In-Progress ReleaseNotes <ReleaseNotes>
|