[all-commits] [llvm/llvm-project] 83ddfa: [OpenMP][OpenACC] Implement `ompx_hold` map type m...

Joel E. Denny via All-commits all-commits at lists.llvm.org
Tue Aug 31 13:15:14 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83ddfa0d2247a9b6b512cfcedfa529b8bb573028
      https://github.com/llvm/llvm-project/commit/83ddfa0d2247a9b6b512cfcedfa529b8bb573028
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2021-08-31 (Tue, 31 Aug 2021)

  Changed paths:
    M clang/docs/ClangCommandLineReference.rst
    M clang/docs/OpenMPSupport.rst
    M clang/include/clang/AST/OpenMPClause.h
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Basic/OpenMPKinds.def
    M clang/include/clang/Basic/OpenMPKinds.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Basic/OpenMPKinds.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Parse/ParseOpenMP.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    A clang/test/OpenMP/driver-fopenmp-extensions.c
    M clang/test/OpenMP/target_ast_print.cpp
    M clang/test/OpenMP/target_data_ast_print.cpp
    A clang/test/OpenMP/target_data_map_codegen_hold.cpp
    M clang/test/OpenMP/target_enter_data_map_messages.c
    M clang/test/OpenMP/target_exit_data_map_messages.c
    A clang/test/OpenMP/target_map_codegen_hold.cpp
    M clang/test/OpenMP/target_map_messages.cpp
    M clang/test/OpenMP/target_parallel_for_map_messages.cpp
    M clang/test/OpenMP/target_parallel_for_simd_map_messages.cpp
    M clang/test/OpenMP/target_parallel_map_messages.cpp
    M clang/test/OpenMP/target_simd_map_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_map_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_map_messages.cpp
    M clang/test/OpenMP/target_teams_map_messages.cpp
    M openmp/docs/index.rst
    A openmp/docs/openacc/OpenMPExtensions.rst
    A openmp/docs/openacc/Overview.rst

  Log Message:
  -----------
  [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


  Commit: ec1ebcd30258329666dc89e6e745bb9de2e8fd13
      https://github.com/llvm/llvm-project/commit/ec1ebcd30258329666dc89e6e745bb9de2e8fd13
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2021-08-31 (Tue, 31 Aug 2021)

  Changed paths:
    M openmp/libomptarget/include/omptarget.h
    M openmp/libomptarget/src/api.cpp
    M openmp/libomptarget/src/device.cpp
    M openmp/libomptarget/src/device.h
    M openmp/libomptarget/src/omptarget.cpp
    M openmp/libomptarget/src/private.h
    A openmp/libomptarget/test/mapping/ompx_hold/omp_target_disassociate_ptr.c
    A openmp/libomptarget/test/mapping/ompx_hold/struct.c
    A openmp/libomptarget/test/mapping/ompx_hold/target-data.c
    A openmp/libomptarget/test/mapping/ompx_hold/target.c
    M openmp/libomptarget/test/offloading/info.c

  Log Message:
  -----------
  [OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in runtime (2/2)

This patch implements OpenMP runtime support for an original OpenMP
extension we have developed to support OpenACC: the `ompx_hold` map
type modifier.  The previous patch in this series, D106509, implements
Clang support and documents the new functionality in detail.

Reviewed By: grokos

Differential Revision: https://reviews.llvm.org/D106510


Compare: https://github.com/llvm/llvm-project/compare/dc37f5374cd3...ec1ebcd30258


More information about the All-commits mailing list