This series adds new, dedicated libgomp entry points for compiler-generated
calls that previously reused general OpenMP API functions or shared entry
points for multiple purposes. The motivation is OMPT: when OMPT tracing is
enabled, callbacks need to distinguish the kinds of events being observed
(e.g. implicit vs explicit barriers, reduction critical sections vs user
atomics, masked-filter checks vs user thread-number queries). Reusing
general functions makes this impossible.

The four patches address the four cases identified in the GCC runtime:

  1/4 – GOMP_has_masked_thread_num: replaces omp_get_thread_num() == filter
        in the masked/master construct lowering.

  2/4 – GOMP_loop_static_worksharing / GOMP_distribute_static_worksharing:
        replaces the two separate omp_get_thread_num + omp_get_num_threads
        (or team equivalents) calls in the static-schedule loop expander
        with a single call returning both values packed in an unsigned long
        long.

  3/4 – GOMP_barrier gains a `kind' parameter so OMPT can report the correct
        barrier kind in its sync-region callbacks.

  4/4 – GOMP_reduction_start / GOMP_reduction_end: replaces GOMP_atomic_start
        / GOMP_atomic_end in the reduction critical-section path.

Paul-Antoine Arras (4):
  openmp: Add GOMP_has_masked_thread_num
  openmp: Add GOMP_loop_static_worksharing and
    GOMP_distribute_static_worksharing
  openmp: Add barrier kind to GOMP_barrier and GOMP_barrier_cancel
  openmp: Add GOMP_reduction_start and GOMP_reduction_end

 gcc/builtin-types.def                         |   1 +
 gcc/c-family/c-omp.cc                         |   4 +-
 gcc/cp/semantics.cc                           |   1 +
 gcc/fortran/trans-openmp.cc                   |   4 +-
 gcc/fortran/types.def                         |   1 +
 gcc/omp-builtins.def                          |  17 ++-
 gcc/omp-expand.cc                             |  86 ++++++++++-----
 gcc/omp-general.cc                            |   5 +-
 gcc/omp-general.h                             |   2 +-
 gcc/omp-low.cc                                |  48 ++++++---
 gcc/testsuite/c-c++-common/gomp/for-8.c       |  67 ++++++++++++
 .../c-c++-common/gomp/implicit-barrier-1.c    | 102 ++++++++++++++++++
 gcc/testsuite/c-c++-common/gomp/masked-1.c    |   6 ++
 .../c-c++-common/gomp/reduction-builtins-1.c  |  47 ++++++++
 gcc/testsuite/g++.dg/gomp/barrier-1.C         |   2 +-
 gcc/testsuite/g++.dg/gomp/master-3.C          |   2 +-
 gcc/testsuite/gcc.dg/gomp/barrier-1.c         |   2 +-
 gcc/testsuite/gcc.dg/gomp/master-3.c          |   2 +-
 .../lastprivate-allocatable-barrier-1.f90     |  33 ++++++
 gcc/testsuite/gfortran.dg/gomp/masked-1.f90   |   6 +-
 gcc/tree-ssa-alias.cc                         |   2 +
 include/gomp-constants.h                      |   6 ++
 libgomp/atomic.c                              |  12 +++
 libgomp/barrier.c                             |   4 +-
 libgomp/config/gcn/teams.c                    |  13 +++
 libgomp/config/nvptx/teams.c                  |  12 +++
 libgomp/libgomp.map                           |   9 ++
 libgomp/libgomp_g.h                           |   6 +-
 libgomp/parallel.c                            |  22 ++++
 libgomp/teams.c                               |  13 +++
 libgomp/testsuite/libgomp.c/barrier-1.c       |   8 +-
 31 files changed, 485 insertions(+), 60 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/gomp/for-8.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/implicit-barrier-1.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/reduction-builtins-1.c
 create mode 100644 
gcc/testsuite/gfortran.dg/gomp/lastprivate-allocatable-barrier-1.f90

-- 
2.53.0

Reply via email to