Andrew Stubbs wrote:
Compared to the previous v4 (1/5) posting of this patch:
- The enumeration of the ompx allocators have been moved (again) to 200
   (as 100 is already in use by another toolchain vendor and this seems
   like a possible source of confusion).
- The "ompx" has also been changed to "ompx_gnu" to highlight that these
   are specifically GNU extensions.
- The failure mode of the testcases had been modified, including adding
   an abort in CHECK_SIZE and skipping the test on unsupported platforms.
- The OMP_ALLOCATE environment variable now supports the new allocator.
- The Fortran frontend allows use of the new allocator in "allocator"
   clauses.

---

This creates a new predefined allocator as a shortcut for using pinned
memory with OpenMP.  This is not in the OpenMP standard so it uses the "ompx"
namespace and an independent enum baseline of 200 (selected to not clash with
other known implementations).

The allocator is equivalent to using a custom allocator with the pinned
trait and the null fallback trait.  One motivation for having this feature is
for use by the (planned) -foffload-memory=pinned feature.

The patch LGTM.

Thanks!

Tobias
gcc/fortran/ChangeLog:

        * openmp.cc (is_predefined_allocator): Update valid ranges to
          incorporate ompx_gnu_pinned_mem_alloc.

libgomp/ChangeLog:

        * allocator.c (ompx_gnu_min_predefined_alloc): New.
        (ompx_gnu_max_predefined_alloc): New.
        (predefined_alloc_mapping): Rename to ...
        (predefined_omp_alloc_mapping): ... this.
        (predefined_ompx_gnu_alloc_mapping): New.
        (_Static_assert): Adjust for the new name, and add a new assert for the
        new table.
        (predefined_allocator_p): New.
        (predefined_alloc_mapping): New.
        (omp_aligned_alloc): Support ompx_gnu_pinned_mem_alloc.
        Use predefined_allocator_p and predefined_alloc_mapping.
        (omp_free): Likewise.
        (omp_alligned_calloc): Likewise.
        (omp_realloc): Likewise.
        * env.c (parse_allocator): Add ompx_gnu_pinned_mem_alloc.
        * libgomp.texi: Document ompx_gnu_pinned_mem_alloc.
        * omp.h.in (omp_allocator_handle_t): Add ompx_gnu_pinned_mem_alloc.
        * omp_lib.f90.in: Add ompx_gnu_pinned_mem_alloc.
        * omp_lib.h.in: Add ompx_gnu_pinned_mem_alloc.
        * testsuite/libgomp.c/alloc-pinned-5.c: New test.
        * testsuite/libgomp.c/alloc-pinned-6.c: New test.
        * testsuite/libgomp.fortran/alloc-pinned-1.f90: New test.

gcc/testsuite/ChangeLog:

        * gfortran.dg/gomp/allocate-pinned-1.f90: New test.

Co-Authored-By: Thomas Schwinge<tho...@codesourcery.com>
---
  gcc/fortran/openmp.cc                         |  11 +-
  .../gfortran.dg/gomp/allocate-pinned-1.f90    |  16 +++
  libgomp/allocator.c                           | 115 +++++++++++++-----
  libgomp/env.c                                 |   1 +
  libgomp/libgomp.texi                          |   7 +-
  libgomp/omp.h.in                              |   1 +
  libgomp/omp_lib.f90.in                        |   2 +
  libgomp/omp_lib.h.in                          |   2 +
  libgomp/testsuite/libgomp.c/alloc-pinned-5.c  | 100 +++++++++++++++
  libgomp/testsuite/libgomp.c/alloc-pinned-6.c  | 102 ++++++++++++++++
  .../libgomp.fortran/alloc-pinned-1.f90        |  16 +++
  11 files changed, 336 insertions(+), 37 deletions(-)
  create mode 100644 gcc/testsuite/gfortran.dg/gomp/allocate-pinned-1.f90
  create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-5.c
  create mode 100644 libgomp/testsuite/libgomp.c/alloc-pinned-6.c
  create mode 100644 libgomp/testsuite/libgomp.fortran/alloc-pinned-1.f90

Reply via email to