This patch series provides basic offloading support for OpenMP and OpenACC on openacc-gcc-9-branch, although OpenACC in particular is likely to be buggy until we post follow-up fixes from our internal branch.
Further commentary is provided alongside each patch. The series as a whole has been tested with offloading to NVPTX (no regressions) and also with offloading to AMD GCN (results reasonable, but not fully checked). I will apply shortly. Thanks, Julian Julian Brown (8): [og9] Add support for constructors and destructors on GCN [og9] Create GCN-specific gthreads [og9] Stub implementation of unwinding for AMD GCN [og9] Enable full GFortran library for AMD GCN [og9] AMD GCN offloading support [og9] Make OpenACC function-parameter explosion optional [og9] NVPTX GOMP_OFFLOAD_openacc_async_construct arg fix and gomp_print_* support [og9] Update parallel-dims.c and serial-dims.c warning line numbering. ChangeLog.openacc | 6 + config/ChangeLog.openacc | 7 + config/gthr.m4 | 1 + configure | 3 + configure.ac | 3 + gcc/ChangeLog.openacc | 63 + gcc/builtin-types.def | 4 - gcc/config.gcc | 5 +- gcc/config/gcn/gcn-run.c | 36 +- gcc/config/gcn/gcn.c | 24 +- gcc/config/gcn/mkoffload.c | 702 ++++ gcc/config/gcn/offload.h | 35 + gcc/config/i386/i386.c | 32 + gcc/doc/tm.texi | 5 + gcc/doc/tm.texi.in | 2 + gcc/fortran/types.def | 4 - gcc/omp-builtins.def | 4 +- gcc/omp-expand.c | 18 +- gcc/omp-low.c | 28 +- gcc/target.def | 7 + gcc/tree-ssa-structalias.c | 52 +- include/ChangeLog.openacc | 4 + include/gomp-constants.h | 5 +- libgcc/ChangeLog.openacc | 25 + libgcc/Makefile.in | 2 + libgcc/config/gcn/crt0.c | 56 + libgcc/config/gcn/gomp_print.c | 101 + libgcc/config/gcn/gthr-gcn.h | 163 + libgcc/config/gcn/reduction.c | 30 + libgcc/config/gcn/t-amdgcn | 14 +- libgcc/config/gcn/t-gcn-hsa | 52 + libgcc/config/gcn/unwind-gcn.c | 37 + libgcc/configure | 1 + libgfortran/ChangeLog.openacc | 9 + libgfortran/configure | 3 +- libgfortran/configure.ac | 3 +- libgomp/ChangeLog.openacc | 179 + libgomp/Makefile.am | 2 +- libgomp/Makefile.in | 63 +- libgomp/affinity-fmt.c | 10 +- libgomp/config.h.in | 3 + .../config/{nvptx => accel}/libgomp-plugin.c | 0 libgomp/config/{nvptx => accel}/lock.c | 0 libgomp/config/{nvptx => accel}/mutex.c | 0 libgomp/config/{nvptx => accel}/mutex.h | 0 libgomp/config/{nvptx => accel}/oacc-async.c | 0 libgomp/config/{nvptx => accel}/oacc-cuda.c | 0 libgomp/config/{nvptx => accel}/oacc-host.c | 0 libgomp/config/{nvptx => accel}/oacc-init.c | 0 libgomp/config/{nvptx => accel}/oacc-mem.c | 0 libgomp/config/{nvptx => accel}/oacc-plugin.c | 0 libgomp/config/{nvptx => accel}/omp-lock.h | 0 libgomp/config/{nvptx => accel}/openacc.f90 | 2 + libgomp/config/{nvptx => accel}/pool.h | 0 libgomp/config/{nvptx => accel}/proc.c | 1 + libgomp/config/{nvptx => accel}/ptrlock.c | 0 libgomp/config/{nvptx => accel}/ptrlock.h | 0 libgomp/config/{nvptx => accel}/sem.c | 0 libgomp/config/{nvptx => accel}/sem.h | 0 .../{nvptx => accel}/thread-stacksize.h | 0 libgomp/config/gcn/affinity-fmt.c | 51 + libgomp/config/gcn/bar.c | 230 ++ libgomp/config/gcn/bar.h | 168 + libgomp/config/gcn/doacross.h | 58 + libgomp/config/gcn/gomp_print.c | 2 + libgomp/config/gcn/icv-device.c | 72 + libgomp/config/gcn/simple-bar.h | 61 + libgomp/config/gcn/target.c | 49 + libgomp/config/gcn/task.c | 39 + libgomp/config/gcn/team.c | 202 + libgomp/config/gcn/time.c | 52 + libgomp/config/linux/gomp_print.c | 20 + libgomp/config/nvptx/gomp_print.c | 20 + libgomp/configure | 61 +- libgomp/configure.ac | 2 +- libgomp/configure.tgt | 6 +- libgomp/fortran.c | 4 +- libgomp/libgomp-plugin.h | 5 +- libgomp/libgomp.h | 20 +- libgomp/libgomp.map | 4 +- libgomp/libgomp_g.h | 2 - libgomp/oacc-async.c | 3 +- libgomp/oacc-host.c | 2 +- libgomp/oacc-init.c | 3 +- libgomp/oacc-int.h | 9 +- libgomp/oacc-parallel.c | 115 +- libgomp/omp.h.in | 12 + libgomp/omp_lib.f90.in | 26 + libgomp/openacc.f90 | 6 +- libgomp/openacc.h | 3 +- libgomp/openacc_lib.h | 2 + libgomp/plugin/Makefrag.am | 14 + libgomp/plugin/configfrag.ac | 35 + libgomp/plugin/plugin-gcn.c | 3482 +++++++++++++++++ libgomp/plugin/plugin-nvptx.c | 2 +- libgomp/target.c | 59 +- libgomp/team.c | 3 + libgomp/testsuite/Makefile.in | 5 + libgomp/testsuite/lib/libgomp.exp | 25 + libgomp/testsuite/libgomp.c/c.exp | 73 +- libgomp/testsuite/libgomp.c/for-1.h | 25 + libgomp/testsuite/libgomp.c/for-2.h | 313 ++ libgomp/testsuite/libgomp.c/for-3.c | 123 + libgomp/testsuite/libgomp.c/for-3.list | 24 + libgomp/testsuite/libgomp.c/for-5.c | 161 + libgomp/testsuite/libgomp.c/for-5.list | 35 + libgomp/testsuite/libgomp.c/for-6.c | 135 + libgomp/testsuite/libgomp.c/for-6.list | 24 + libgomp/testsuite/libgomp.c/target-print-1.c | 17 + .../libgomp.fortran/target-print-1.f90 | 15 + libgomp/testsuite/libgomp.oacc-c++/c++.exp | 4 + .../atomic_capture-2.c | 92 +- .../libgomp.oacc-c-c++-common/loop-auto-1.c | 3 + .../libgomp.oacc-c-c++-common/loop-gwv-1.c | 17 +- .../loop-red-gwv-1.c | 20 +- .../libgomp.oacc-c-c++-common/loop-red-v-1.c | 6 +- .../libgomp.oacc-c-c++-common/loop-red-v-2.c | 6 +- .../libgomp.oacc-c-c++-common/loop-red-w-1.c | 7 +- .../libgomp.oacc-c-c++-common/loop-red-w-2.c | 7 +- .../libgomp.oacc-c-c++-common/loop-red-wv-1.c | 10 +- .../libgomp.oacc-c-c++-common/loop-v-1.c | 7 +- .../libgomp.oacc-c-c++-common/loop-w-1.c | 9 +- .../libgomp.oacc-c-c++-common/loop-wv-1.c | 10 +- .../libgomp.oacc-c-c++-common/parallel-dims.c | 35 +- .../private-variables-2.c | 217 + .../libgomp.oacc-c-c++-common/routine-gwv-1.c | 15 +- .../libgomp.oacc-c-c++-common/routine-v-1.c | 7 +- .../libgomp.oacc-c-c++-common/routine-w-1.c | 7 +- .../libgomp.oacc-c-c++-common/routine-wv-1.c | 10 +- .../libgomp.oacc-c-c++-common/routine-wv-2.c | 9 +- .../libgomp.oacc-c-c++-common/serial-dims.c | 17 +- .../libgomp.oacc-c-c++-common/tile-1.c | 3 + libgomp/testsuite/libgomp.oacc-c/c.exp | 4 + .../libgomp.oacc-c/offload-targets-1.c | 3 + libgomp/testsuite/libgomp.oacc-c/print-1.c | 17 + .../libgomp.oacc-fortran/atomic_capture-1.f90 | 155 +- .../libgomp.oacc-fortran/collapse-1.f90 | 4 +- .../libgomp.oacc-fortran/collapse-2.f90 | 4 +- .../libgomp.oacc-fortran/error_stop-1.f | 2 +- .../libgomp.oacc-fortran/error_stop-2.f | 2 +- .../libgomp.oacc-fortran/error_stop-3.f | 2 +- .../libgomp.oacc-fortran/fortran.exp | 4 + .../libgomp.oacc-fortran/print-1.f90 | 15 + 143 files changed, 8067 insertions(+), 348 deletions(-) create mode 100644 config/ChangeLog.openacc create mode 100644 gcc/config/gcn/mkoffload.c create mode 100644 gcc/config/gcn/offload.h create mode 100644 libgcc/ChangeLog.openacc create mode 100644 libgcc/config/gcn/gomp_print.c create mode 100644 libgcc/config/gcn/gthr-gcn.h create mode 100644 libgcc/config/gcn/reduction.c create mode 100644 libgcc/config/gcn/t-gcn-hsa create mode 100644 libgcc/config/gcn/unwind-gcn.c create mode 100644 libgfortran/ChangeLog.openacc rename libgomp/config/{nvptx => accel}/libgomp-plugin.c (100%) rename libgomp/config/{nvptx => accel}/lock.c (100%) rename libgomp/config/{nvptx => accel}/mutex.c (100%) rename libgomp/config/{nvptx => accel}/mutex.h (100%) rename libgomp/config/{nvptx => accel}/oacc-async.c (100%) rename libgomp/config/{nvptx => accel}/oacc-cuda.c (100%) rename libgomp/config/{nvptx => accel}/oacc-host.c (100%) rename libgomp/config/{nvptx => accel}/oacc-init.c (100%) rename libgomp/config/{nvptx => accel}/oacc-mem.c (100%) rename libgomp/config/{nvptx => accel}/oacc-plugin.c (100%) rename libgomp/config/{nvptx => accel}/omp-lock.h (100%) rename libgomp/config/{nvptx => accel}/openacc.f90 (96%) rename libgomp/config/{nvptx => accel}/pool.h (100%) rename libgomp/config/{nvptx => accel}/proc.c (98%) rename libgomp/config/{nvptx => accel}/ptrlock.c (100%) rename libgomp/config/{nvptx => accel}/ptrlock.h (100%) rename libgomp/config/{nvptx => accel}/sem.c (100%) rename libgomp/config/{nvptx => accel}/sem.h (100%) rename libgomp/config/{nvptx => accel}/thread-stacksize.h (100%) create mode 100644 libgomp/config/gcn/affinity-fmt.c create mode 100644 libgomp/config/gcn/bar.c create mode 100644 libgomp/config/gcn/bar.h create mode 100644 libgomp/config/gcn/doacross.h create mode 100644 libgomp/config/gcn/gomp_print.c create mode 100644 libgomp/config/gcn/icv-device.c create mode 100644 libgomp/config/gcn/simple-bar.h create mode 100644 libgomp/config/gcn/target.c create mode 100644 libgomp/config/gcn/task.c create mode 100644 libgomp/config/gcn/team.c create mode 100644 libgomp/config/gcn/time.c create mode 100644 libgomp/config/linux/gomp_print.c create mode 100644 libgomp/config/nvptx/gomp_print.c create mode 100644 libgomp/plugin/plugin-gcn.c create mode 100644 libgomp/testsuite/libgomp.c/for-1.h create mode 100644 libgomp/testsuite/libgomp.c/for-2.h create mode 100644 libgomp/testsuite/libgomp.c/for-3.c create mode 100644 libgomp/testsuite/libgomp.c/for-3.list create mode 100644 libgomp/testsuite/libgomp.c/for-5.c create mode 100644 libgomp/testsuite/libgomp.c/for-5.list create mode 100644 libgomp/testsuite/libgomp.c/for-6.c create mode 100644 libgomp/testsuite/libgomp.c/for-6.list create mode 100644 libgomp/testsuite/libgomp.c/target-print-1.c create mode 100644 libgomp/testsuite/libgomp.fortran/target-print-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/private-variables-2.c create mode 100644 libgomp/testsuite/libgomp.oacc-c/print-1.c create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 -- 2.22.0