mbox series

[00/13] OpenACC 2.6 manual deep copy support

Message ID cover.1576648001.git.julian@codesourcery.com
Headers show
Series OpenACC 2.6 manual deep copy support | expand

Message

Julian Brown Dec. 18, 2019, 6:02 a.m. UTC
Hi,

This patch series provides support for OpenACC 2.6's manual deep copy
(attach/detach) feature. Many of these patches have been submitted
previously, but this series has been rebased and the large deep-copy
part proper has been split into several pieces for ease of review.

Tested with offloading to NVPTX. Further commentary (together with
links to previous submissions) is provided alongside individual patches,
where relevant.

Thanks,

Julian

Julian Brown (13):
  Use aux struct in libgomp for infrequently-used/API-specific data
  OpenACC reference count overhaul
  OpenACC reference count consistency checking
  Use gomp_map_val for OpenACC host-to-device address translation
  Factor out duplicate code in gimplify_scan_omp_clauses
  OpenACC 2.6 deep copy: attach/detach API routines
  OpenACC 2.6 deep copy: libgomp parts
  OpenACC 2.6 deep copy: middle-end parts
  OpenACC 2.6 deep copy: C and C++ front-end parts
  OpenACC 2.6 deep copy: Fortran front-end parts
  OpenACC 2.6 deep copy: C and C++ execution tests
  OpenACC 2.6 deep copy: Fortran execution tests
  Fortran polymorphic class-type support for OpenACC

 gcc/c-family/c-common.h                       |   1 +
 gcc/c-family/c-omp.c                          |  33 ++
 gcc/c-family/c-pragma.h                       |   2 +
 gcc/c/c-parser.c                              |  53 +-
 gcc/c/c-typeck.c                              |  76 ++-
 gcc/cp/parser.c                               |  56 +-
 gcc/cp/semantics.c                            |  98 +++-
 gcc/fortran/gfortran.h                        |   2 +
 gcc/fortran/openmp.c                          | 166 ++++--
 gcc/fortran/trans-expr.c                      | 184 +++---
 gcc/fortran/trans-openmp.c                    | 342 ++++++++---
 gcc/fortran/trans.h                           |   8 +
 gcc/gimplify.c                                | 514 ++++++++++++-----
 gcc/omp-low.c                                 |   3 +
 .../goacc/deep-copy-arrayofstruct.c           |  84 +++
 gcc/testsuite/c-c++-common/goacc/mdc-1.c      |  55 ++
 gcc/testsuite/c-c++-common/goacc/mdc-2.c      |  62 ++
 gcc/testsuite/g++.dg/goacc/mdc.C              |  68 +++
 .../gfortran.dg/goacc/data-clauses.f95        |  38 +-
 .../gfortran.dg/goacc/derived-types-2.f90     |  14 +
 .../gfortran.dg/goacc/derived-types.f90       |  77 +++
 .../gfortran.dg/goacc/enter-exit-data.f95     |  24 +-
 gcc/tree-pretty-print.c                       |  18 +
 include/gomp-constants.h                      |  16 +-
 libgomp/libgomp.h                             |  50 +-
 libgomp/libgomp.map                           |  10 +
 libgomp/oacc-init.c                           |  10 +-
 libgomp/oacc-mem.c                            | 544 ++++++++++--------
 libgomp/oacc-parallel.c                       |  35 +-
 libgomp/openacc.h                             |   6 +
 libgomp/target.c                              | 440 ++++++++++++--
 .../libgomp.c-c++-common/unmap-infinity-2.c   |  19 +
 .../testsuite/libgomp.oacc-c++/deep-copy-12.C |  72 +++
 .../testsuite/libgomp.oacc-c++/deep-copy-13.C |  72 +++
 .../libgomp.oacc-c-c++-common/deep-copy-1.c   |  24 +
 .../libgomp.oacc-c-c++-common/deep-copy-10.c  |  53 ++
 .../libgomp.oacc-c-c++-common/deep-copy-11.c  |  72 +++
 .../libgomp.oacc-c-c++-common/deep-copy-14.c  |  63 ++
 .../libgomp.oacc-c-c++-common/deep-copy-2.c   |  29 +
 .../libgomp.oacc-c-c++-common/deep-copy-3.c   |  34 ++
 .../libgomp.oacc-c-c++-common/deep-copy-4.c   |  87 +++
 .../libgomp.oacc-c-c++-common/deep-copy-5.c   |  81 +++
 .../libgomp.oacc-c-c++-common/deep-copy-6.c   |  59 ++
 .../libgomp.oacc-c-c++-common/deep-copy-7.c   |  45 ++
 .../libgomp.oacc-c-c++-common/deep-copy-8.c   |  54 ++
 .../libgomp.oacc-c-c++-common/deep-copy-9.c   |  53 ++
 .../libgomp.oacc-c-c++-common/pr92843-1.c     |   1 +
 .../subset-subarray-mappings-1-r-p.c          |  16 -
 .../unmap-infinity-1.c                        |  17 +
 .../libgomp.oacc-fortran/class-ptr-param.f95  |  34 ++
 .../libgomp.oacc-fortran/classtypes-1.f95     |  48 ++
 .../libgomp.oacc-fortran/classtypes-2.f95     | 106 ++++
 .../libgomp.oacc-fortran/deep-copy-1.f90      |  35 ++
 .../libgomp.oacc-fortran/deep-copy-2.f90      |  33 ++
 .../libgomp.oacc-fortran/deep-copy-3.f90      |  34 ++
 .../libgomp.oacc-fortran/deep-copy-4.f90      |  49 ++
 .../libgomp.oacc-fortran/deep-copy-5.f90      |  57 ++
 .../libgomp.oacc-fortran/deep-copy-6.f90      |  61 ++
 .../libgomp.oacc-fortran/deep-copy-7.f90      |  89 +++
 .../libgomp.oacc-fortran/deep-copy-8.f90      |  41 ++
 .../libgomp.oacc-fortran/derived-type-1.f90   |  28 +
 .../libgomp.oacc-fortran/derivedtype-1.f95    |  30 +
 .../libgomp.oacc-fortran/derivedtype-2.f95    |  41 ++
 .../libgomp.oacc-fortran/multidim-slice.f95   |  50 ++
 .../libgomp.oacc-fortran/update-2.f90         | 284 +++++++++
 65 files changed, 4225 insertions(+), 735 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/goacc/deep-copy-arrayofstruct.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/mdc-1.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/mdc-2.c
 create mode 100644 gcc/testsuite/g++.dg/goacc/mdc.C
 create mode 100644 gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90
 create mode 100644 gcc/testsuite/gfortran.dg/goacc/derived-types.f90
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/unmap-infinity-2.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c++/deep-copy-12.C
 create mode 100644 libgomp/testsuite/libgomp.oacc-c++/deep-copy-13.C
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-11.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-14.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-2.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-3.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-4.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-5.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-6.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-9.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/unmap-infinity-1.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/class-ptr-param.f95
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/classtypes-1.f95
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/classtypes-2.f95
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-1.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-2.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-3.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-4.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-5.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-6.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-7.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/deep-copy-8.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/derived-type-1.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/derivedtype-1.f95
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/derivedtype-2.f95
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/multidim-slice.f95
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/update-2.f90

Comments

Thomas Schwinge Dec. 18, 2019, 5:44 p.m. UTC | #1
Hi!

On 2019-12-17T22:02:25-0800, Julian Brown <julian@codesourcery.com> wrote:
> This patch series provides support for OpenACC 2.6's manual deep copy
> (attach/detach) feature.

Thanks.


There is high pressure to get this functionality into GCC 10, but
remaining time is short, given upcoming winter holidays, and GCC
development stage 3 end.  The big "OpenACC reference count overhaul" is a
prerequisite for the actual "OpenACC 2.6 manual deep copy support".
Integrating into GCC trunk in incremental pieces these changes has taken
a considerable amount of time, due to having to research a lot of the
existing GCC implementation as well as intended semantics.  While we made
good progress, it's not complete yet.  I very much would like to continue
working this in an incremental fashion, however, due to shortage of time,
this is not possible.  Under protest I thus now rubber-stamp approve all
the patches posted here (to the extent I'm able to), without further
review now, and I'm planning to next year then do post-commit review, and
revisions as required.


> Many of these patches have been submitted
> previously, but this series has been rebased and the large deep-copy
> part proper has been split into several pieces for ease of review.

Again: at least as far as I'm concerned, "ease of review" doesn't mean to
artificially split a patch into several pieces per component or
directories/files touched (I don't need separate patches for
'libgomp.oacc-c-c++-common/', and then 'libgomp.oacc-fortran/'), but
instead per self-contained functional change, incrementally.


Grüße
 Thomas
Julian Brown Dec. 20, 2019, 1:21 a.m. UTC | #2
On Wed, 18 Dec 2019 18:44:04 +0100
Thomas Schwinge <thomas@codesourcery.com> wrote:

> Hi!
> 
> On 2019-12-17T22:02:25-0800, Julian Brown <julian@codesourcery.com>
> wrote:
> > This patch series provides support for OpenACC 2.6's manual deep
> > copy (attach/detach) feature.  
> 
> Thanks.
> 
> 
> There is high pressure to get this functionality into GCC 10, but
> remaining time is short, given upcoming winter holidays, and GCC
> development stage 3 end.  The big "OpenACC reference count overhaul"
> is a prerequisite for the actual "OpenACC 2.6 manual deep copy
> support". Integrating into GCC trunk in incremental pieces these
> changes has taken a considerable amount of time, due to having to
> research a lot of the existing GCC implementation as well as intended
> semantics.  While we made good progress, it's not complete yet.  I
> very much would like to continue working this in an incremental
> fashion, however, due to shortage of time, this is not possible.
> Under protest I thus now rubber-stamp approve all the patches posted
> here (to the extent I'm able to), without further review now, and I'm
> planning to next year then do post-commit review, and revisions as
> required.

Thanks. I'm committing the following patches:

  Use aux struct in libgomp for infrequently-used/API-specific data
  OpenACC reference count overhaul
  Use gomp_map_val for OpenACC host-to-device address translation
  Factor out duplicate code in gimplify_scan_omp_clauses
  OpenACC 2.6 deep copy: attach/detach API routines
  OpenACC 2.6 deep copy: libgomp parts
  OpenACC 2.6 deep copy: middle-end parts
  OpenACC 2.6 deep copy: C and C++ front-end parts
  OpenACC 2.6 deep copy: Fortran front-end parts
  OpenACC 2.6 deep copy: C and C++ execution tests
  OpenACC 2.6 deep copy: Fortran execution tests
  Fortran polymorphic class-type support for OpenACC

I've omitted the "OpenACC reference count consistency checking" patch
for now. A couple of patches needed readjusting for code that landed on
trunk since my last rebase/repost (in particular "Use gomp_map_val..."
and "OpenACC reference count overhaul"), so I've attempted to fix those
in the lowest-impact way possible to avoid regressions. Apologies for
any oversights!

Additionally I've made some improvements suggested by Tobias in the
Fortran front-end patch (thanks!).

(An earlier iteration of the deep copy patches were submitted
previously at the end of 2018, and were approved by Jakub -- pending
approval by Thomas. See
https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01292.html. I hope
Thomas's rubber stamp, plus that email, are sufficient to allow this
code into mainline.)

> > Many of these patches have been submitted
> > previously, but this series has been rebased and the large deep-copy
> > part proper has been split into several pieces for ease of review.  
> 
> Again: at least as far as I'm concerned, "ease of review" doesn't
> mean to artificially split a patch into several pieces per component
> or directories/files touched (I don't need separate patches for
> 'libgomp.oacc-c-c++-common/', and then 'libgomp.oacc-fortran/'), but
> instead per self-contained functional change, incrementally.

Understood, but some split-out parts fall under other individual
reviewers' areas of responsibility (e.g. the Fortran front-end stuff).
Plus the big patch was getting kind of unwieldy.

Cheers (and happy Christmas everyone!),

Julian