https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127646

            Bug ID: 127646
           Summary: [OpenMP][6.0] Implement 'groupprivate' on the host
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

'groupprivate' implies that each team (contention group) has its own copy of
that variable.  (For such variables, an initializer is not permitted.)

Currently, groupprivate lacks:
- Support in C/C++ (only Fortran)
- Support in GCN   (only nvptx)
- Support on the host  (only device_type(nohost) - not 'host' not 'any')

For the last item (and also a bit the second item), see:
https://gcc.gnu.org/pipermail/gcc-patches/2026-September/732780.html

This email sketches out how a host implementation can look like
(and how the GCN version can be implemented).


The main purpose of this issue is only the last, namely:

* Add support for 'groupprivate' on the host [device_type({any|host})]

... to handle code like:

  int global;
  #pragma omp groupprivate(global)

  int f(bool first) {
    int local;
    #pragma omp groupprivate(local)
    if (first) local = 5;
    return ++local;
  }

where 'global' is accessing / 'f' called - either in "normal" code
or from within an 'omp teams' or 'omp target teams' region (running
on the host [or on a non-host device]).

Note that 'target' can also run concurrently ('nowait'), i.e. that
also needs to work.

Reply via email to