From patchwork Fri Aug 2 20:11:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 1141372 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-506135-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="geL6j93r"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 460dbr2HMMz9s00 for ; Sat, 3 Aug 2019 06:11:49 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; q=dns; s=default; b=CBY Vp5UgW/JMnkWfZeI1WD/JAsYgBPjl7dnQakME/gVHNo13HrKegf+HhHe2zJjfSB/ j3JvFowzMVzgRpWWoGrSPqSj9iKPIHN0Q+sLqMhVj6RSkRDI8VQcqbLvaUDGAGQH OPrmH2L0Onbrpop5df8TPcpcYlt4A/4WljsvL4wQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=default; bh=o9U37Y8Qd auLyBtob8nSex8+oSI=; b=geL6j93r+1B4e/o7k9F4eVme3Iu86zofiTD46WHEx lNiQA+9OLojRqIzHCvzt2tXqhXhdCjyk46RNqAivXqP6AkRfYzlfI+3TceD+JbbA 6MtFcm9UgqikZ/XJwAhFnGJPUvxGJiALZ/WQelcVpMztykdjaBmB3tdi8SgSLDSz vo= Received: (qmail 129755 invoked by alias); 2 Aug 2019 20:11:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 129745 invoked by uid 89); 2 Aug 2019 20:11:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Makefileam, Makefile.am, UD:Makefile.am, makefile.am X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Aug 2019 20:11:36 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1htdtm-00017q-O7 from Julian_Brown@mentor.com ; Fri, 02 Aug 2019 13:11:34 -0700 Received: from build5-trusty-cs.sje.mentorg.com (147.34.91.1) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 2 Aug 2019 21:11:30 +0100 From: Julian Brown To: CC: Andrew Stubbs , Jakub Jelinek Subject: [PATCH 0/8] [og9] AMD GCN offloading support Date: Fri, 2 Aug 2019 13:11:18 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes 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