llvm-project/clang/lib
Joel E. Denny 83ddfa0d22 [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-08-31 16:13:49 -04:00
..
APINotes [clang][APINotes] Fix -Wunused-function warning (NFC) 2021-04-01 09:52:43 +08:00
ARCMigrate [clang] Introduce SourceLocation::[U]IntTy typedefs. 2021-07-21 10:45:46 +01:00
AST Fix typo in two files in Clang, patch by FusionBolt 2021-08-31 12:33:37 +05:30
ASTMatchers Reapply "Support Attr in DynTypedNode and ASTMatchers." 2021-08-06 22:30:32 +02:00
Analysis [analyzer][NFC] Display the correct function name even in crash dumps 2021-07-12 09:06:46 +02:00
Basic [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2) 2021-08-31 16:13:49 -04:00
CodeGen [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2) 2021-08-31 16:13:49 -04:00
CrossTU PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23 2021-07-08 13:37:57 -07:00
DirectoryWatcher Revert "Re-Revert "DirectoryWatcher: add an implementation for Windows"" 2021-06-19 09:19:52 -07:00
Driver [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2) 2021-08-31 16:13:49 -04:00
Edit [Matrix] Implement C-style explicit type conversions for matrix types. 2021-04-10 11:48:41 +01:00
Format [clang-format] Add PackConstructorInitializers backward compat test 2021-08-29 13:47:11 -07:00
Frontend [clang] Remove redundant calls to c_str() (NFC) 2021-08-31 08:53:51 -07:00
FrontendTool [OptTable] Rename PrintHelp to printHelp 2021-06-24 14:47:03 -07:00
Headers [PowerPC][NFC] Rename P10 builtins vec_clrl, vec_clrr to vec_clr_first and vec_clr_last 2021-08-30 09:52:15 -05:00
Index [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
IndexSerialization
Interpreter Reland "[clang-repl] Implement partial translation units and error recovery." 2021-07-12 15:21:22 +00:00
Lex Effectively revert 33c3d8a916 / D33782 2021-08-25 14:41:26 -07:00
Parse [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2) 2021-08-31 16:13:49 -04:00
Rewrite [analyzer] Highlight arrows for currently selected event 2021-08-02 19:15:01 +03:00
Sema [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2) 2021-08-31 16:13:49 -04:00
Serialization [modules] Fix miscompilation when using two RecordDecl definitions with the same name. 2021-08-30 17:51:38 -07:00
StaticAnalyzer [SystemZ][z/OS] Create html report file with text flag 2021-08-31 11:52:04 -04:00
Testing
Tooling [clang][deps] Reset non-modular language and preprocessor options 2021-08-26 08:43:21 +02:00
CMakeLists.txt [clang-repl] Recommit "Land initial infrastructure for incremental parsing" 2021-05-13 06:30:29 +00:00