From patchwork Mon Aug 10 15:55:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 505713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 65B8F1401AF for ; Tue, 11 Aug 2015 01:56:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=IAaSxKlr; dkim-atps=neutral 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:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=R/oNxJMq30HeG0kN DW7Wyh6jAfuN5Te+qj+OAR1lUP4F28dgd/0ckDooJm/AyHipKXR5s4mMSTgO4BJK EL4G52h0pIvMR+fvvr5MEBSW6EYHEewC0BNWobDmodIMwAYlwMOTyRYCjpsiWlGz Zqz7/cJYsZ1sOoDV1WlGueeq72g= 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:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=REcOp8qoxYPcZmDlhA95rH Ct5Ss=; b=IAaSxKlrsFH70OkXlVJ9xvB+zdMYZcBgGq9yTGNrylJwBWK+z1D/kL U2FrDIZjMX/DyW2u4dqISpQ3rfxZVSq52Wgqe44OR7cbFtSlVm1PRfG05PfE3ezO CBgJVsKhjphJrGaQMNgR7hEQZUAkuBIIyRPqt9diXL5Ro9z8n7zfc= Received: (qmail 109208 invoked by alias); 10 Aug 2015 15:56:21 -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 109195 invoked by uid 89); 10 Aug 2015 15:56:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 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; Mon, 10 Aug 2015 15:56:17 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZOpQq-0001Vf-Fb from Thomas_Schwinge@mentor.com ; Mon, 10 Aug 2015 08:56:13 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Mon, 10 Aug 2015 16:56:11 +0100 From: Thomas Schwinge To: , Jakub Jelinek CC: Julian Brown , Bernd Schmidt , Tobias Burnus , Ilya Verbin Subject: Empty libgomp for nvptx (was: [WIP] OpenMP 4 NVPTX support) In-Reply-To: <20150722163844.GT1780@tucnak.redhat.com> References: <20150421155839.GZ1725@tucnak.redhat.com> <87twswyy9n.fsf@schwinge.name> <20150722163844.GT1780@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Mon, 10 Aug 2015 17:55:57 +0200 Message-ID: <87mvxzuohe.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Wed, 22 Jul 2015 18:38:44 +0200, Jakub Jelinek wrote: > On Wed, Jul 22, 2015 at 06:04:20PM +0200, Thomas Schwinge wrote: > > On Tue, 21 Apr 2015 17:58:39 +0200, Jakub Jelinek wrote: > > > Attached is a minimal patch to get at least a trivial OpenMP 4.0 testcase > > > offloading to NVPTX (the first patch). The second patch is WIP, just first > > > few needed changes to make libgomp to build for NVPTX (several weeks of work > > > at least). > > > > We're not in particular working on making nvptx offloading work for > > OpenMP, but also for OpenACC offloading a tiny bit of code is required to > > be shipped in an offloading device's runtime library -- code that > > conceptually belongs into libgomp. (On gomp-4_0-branch, it currently > > lives in libgcc because that was easier to do.) Actually, as I should > > find out, building a "dummy" (empty) libgomp for nvptx is not actually > > difficult. Additionally to your second patch (U2; quoted at the end of > > this email), we'll need the following: > > The U2 version was a very early one, I've posted a newer version later, > but supposedly we can go with my U2 (if you've tested it together with your > patch, please check it in yourself) and your patch, and then > incrementally start removing the zero sized stubs or replacing them with > something real. Yes, that's precisely the idea. Committed in r226760: commit fdcd05c84f79cec55fa61249febd4c1c21b772a7 Author: tschwinge Date: Mon Aug 10 15:53:33 2015 +0000 Empty libgomp for nvptx * configure.ac (noconfigdirs): Don't add "target-libgomp" for target nvptx*-*-*. * configure: Regenerate. libgomp/ * config/nvptx/affinity.c: New file. * config/nvptx/alloc.c: Likewise. * config/nvptx/bar.c: Likewise. * config/nvptx/barrier.c: Likewise. * config/nvptx/critical.c: Likewise. * config/nvptx/env.c: Likewise. * config/nvptx/error.c: Likewise. * config/nvptx/fortran.c: Likewise. * config/nvptx/iter.c: Likewise. * config/nvptx/iter_ull.c: Likewise. * config/nvptx/libgomp-plugin.c: Likewise. * config/nvptx/lock.c: Likewise. * config/nvptx/loop.c: Likewise. * config/nvptx/loop_ull.c: Likewise. * config/nvptx/mutex.c: Likewise. * config/nvptx/oacc-async.c: Likewise. * config/nvptx/oacc-cuda.c: Likewise. * config/nvptx/oacc-host.c: Likewise. * config/nvptx/oacc-init.c: Likewise. * config/nvptx/oacc-mem.c: Likewise. * config/nvptx/oacc-parallel.c: Likewise. * config/nvptx/oacc-plugin.c: Likewise. * config/nvptx/omp-lock.h: Likewise. * config/nvptx/ordered.c: Likewise. * config/nvptx/parallel.c: Likewise. * config/nvptx/proc.c: Likewise. * config/nvptx/ptrlock.c: Likewise. * config/nvptx/sections.c: Likewise. * config/nvptx/sem.c: Likewise. * config/nvptx/single.c: Likewise. * config/nvptx/splay-tree.c: Likewise. * config/nvptx/target.c: Likewise. * config/nvptx/task.c: Likewise. * config/nvptx/team.c: Likewise. * config/nvptx/time.c: Likewise. * config/nvptx/work.c: Likewise. * configure.ac: Don't probe pthreads support for host nvptx*-*-*. * configure: Regenerate. * configure.tgt (config_path): Set to "nvptx" for target nvptx*-*-*. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226760 138bc75d-0d04-0410-961f-82ee72b054a4 --- ChangeLog | 7 +++++++ configure | 6 +++--- configure.ac | 6 +++--- libgomp/ChangeLog | 44 +++++++++++++++++++++++++++++++++++++++ libgomp/config/nvptx/omp-lock.h | 12 +++++++++++ libgomp/configure | 3 +++ libgomp/configure.ac | 3 +++ libgomp/configure.tgt | 4 ++++ 8 files changed, 79 insertions(+), 6 deletions(-) Grüße, Thomas diff --git ChangeLog ChangeLog index bd0f35e..6d3a8a0 100644 --- ChangeLog +++ ChangeLog @@ -1,3 +1,10 @@ +2015-08-10 Thomas Schwinge + Jakub Jelinek + + * configure.ac (noconfigdirs): Don't add "target-libgomp" for target + nvptx*-*-*. + * configure: Regenerate. + 2015-08-06 Yaakov Selkowitz * Makefile.def (libiconv): Define bootstrap=true. diff --git configure configure index 6d7152e..79257fd 100755 --- configure +++ configure @@ -3168,9 +3168,8 @@ if test x$enable_static_libjava != xyes ; then fi -# Disable libgomp on non POSIX hosted systems. +# Enable libgomp by default on hosted POSIX systems, and a few others. if test x$enable_libgomp = x ; then - # Enable libgomp by default on hosted POSIX systems. case "${target}" in *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) ;; @@ -3180,6 +3179,8 @@ if test x$enable_libgomp = x ; then ;; *-*-darwin* | *-*-aix*) ;; + nvptx*-*-*) + ;; *) noconfigdirs="$noconfigdirs target-libgomp" ;; @@ -3917,7 +3918,6 @@ case "${target}" in noconfigdirs="$noconfigdirs gdb" ;; nvptx*-*-*) - # nvptx is just a compiler noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" ;; or1k*-*-*) diff --git configure.ac configure.ac index fbc49ce..452fc05 100644 --- configure.ac +++ configure.ac @@ -529,9 +529,8 @@ if test x$enable_static_libjava != xyes ; then fi AC_SUBST(EXTRA_CONFIGARGS_LIBJAVA) -# Disable libgomp on non POSIX hosted systems. +# Enable libgomp by default on hosted POSIX systems, and a few others. if test x$enable_libgomp = x ; then - # Enable libgomp by default on hosted POSIX systems. case "${target}" in *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) ;; @@ -541,6 +540,8 @@ if test x$enable_libgomp = x ; then ;; *-*-darwin* | *-*-aix*) ;; + nvptx*-*-*) + ;; *) noconfigdirs="$noconfigdirs target-libgomp" ;; @@ -1257,7 +1258,6 @@ case "${target}" in noconfigdirs="$noconfigdirs gdb" ;; nvptx*-*-*) - # nvptx is just a compiler noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" ;; or1k*-*-*) diff --git libgomp/ChangeLog libgomp/ChangeLog index 3b60290..084aabd 100644 --- libgomp/ChangeLog +++ libgomp/ChangeLog @@ -1,4 +1,48 @@ 2015-08-10 Thomas Schwinge + Jakub Jelinek + + * config/nvptx/affinity.c: New file. + * config/nvptx/alloc.c: Likewise. + * config/nvptx/bar.c: Likewise. + * config/nvptx/barrier.c: Likewise. + * config/nvptx/critical.c: Likewise. + * config/nvptx/env.c: Likewise. + * config/nvptx/error.c: Likewise. + * config/nvptx/fortran.c: Likewise. + * config/nvptx/iter.c: Likewise. + * config/nvptx/iter_ull.c: Likewise. + * config/nvptx/libgomp-plugin.c: Likewise. + * config/nvptx/lock.c: Likewise. + * config/nvptx/loop.c: Likewise. + * config/nvptx/loop_ull.c: Likewise. + * config/nvptx/mutex.c: Likewise. + * config/nvptx/oacc-async.c: Likewise. + * config/nvptx/oacc-cuda.c: Likewise. + * config/nvptx/oacc-host.c: Likewise. + * config/nvptx/oacc-init.c: Likewise. + * config/nvptx/oacc-mem.c: Likewise. + * config/nvptx/oacc-parallel.c: Likewise. + * config/nvptx/oacc-plugin.c: Likewise. + * config/nvptx/omp-lock.h: Likewise. + * config/nvptx/ordered.c: Likewise. + * config/nvptx/parallel.c: Likewise. + * config/nvptx/proc.c: Likewise. + * config/nvptx/ptrlock.c: Likewise. + * config/nvptx/sections.c: Likewise. + * config/nvptx/sem.c: Likewise. + * config/nvptx/single.c: Likewise. + * config/nvptx/splay-tree.c: Likewise. + * config/nvptx/target.c: Likewise. + * config/nvptx/task.c: Likewise. + * config/nvptx/team.c: Likewise. + * config/nvptx/time.c: Likewise. + * config/nvptx/work.c: Likewise. + * configure.ac: Don't probe pthreads support for host nvptx*-*-*. + * configure: Regenerate. + * configure.tgt (config_path): Set to "nvptx" for target + nvptx*-*-*. + +2015-08-10 Thomas Schwinge * testsuite/libgomp.oacc-c-c++-common/vector-type-1.c: New file. diff --git libgomp/config/nvptx/affinity.c libgomp/config/nvptx/affinity.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/alloc.c libgomp/config/nvptx/alloc.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/bar.c libgomp/config/nvptx/bar.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/barrier.c libgomp/config/nvptx/barrier.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/critical.c libgomp/config/nvptx/critical.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/env.c libgomp/config/nvptx/env.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/error.c libgomp/config/nvptx/error.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/fortran.c libgomp/config/nvptx/fortran.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/iter.c libgomp/config/nvptx/iter.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/iter_ull.c libgomp/config/nvptx/iter_ull.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/libgomp-plugin.c libgomp/config/nvptx/libgomp-plugin.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/lock.c libgomp/config/nvptx/lock.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/loop.c libgomp/config/nvptx/loop.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/loop_ull.c libgomp/config/nvptx/loop_ull.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/mutex.c libgomp/config/nvptx/mutex.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-async.c libgomp/config/nvptx/oacc-async.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-cuda.c libgomp/config/nvptx/oacc-cuda.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-host.c libgomp/config/nvptx/oacc-host.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-init.c libgomp/config/nvptx/oacc-init.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-mem.c libgomp/config/nvptx/oacc-mem.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-parallel.c libgomp/config/nvptx/oacc-parallel.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/oacc-plugin.c libgomp/config/nvptx/oacc-plugin.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/omp-lock.h libgomp/config/nvptx/omp-lock.h new file mode 100644 index 0000000..2ca7c5e --- /dev/null +++ libgomp/config/nvptx/omp-lock.h @@ -0,0 +1,12 @@ +/* This header is used during the build process to find the size and + alignment of the public OpenMP locks, so that we can export data + structures without polluting the namespace. + + When using the Linux futex primitive, non-recursive locks require + one int. Recursive locks require we identify the owning task + and so require in addition one int and a pointer. */ + +typedef int omp_lock_t; +typedef struct { int lock, count; void *owner; } omp_nest_lock_t; +typedef int omp_lock_25_t; +typedef struct { int owner, count; } omp_nest_lock_25_t; diff --git libgomp/config/nvptx/ordered.c libgomp/config/nvptx/ordered.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/parallel.c libgomp/config/nvptx/parallel.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/proc.c libgomp/config/nvptx/proc.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/ptrlock.c libgomp/config/nvptx/ptrlock.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/sections.c libgomp/config/nvptx/sections.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/sem.c libgomp/config/nvptx/sem.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/single.c libgomp/config/nvptx/single.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/splay-tree.c libgomp/config/nvptx/splay-tree.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/target.c libgomp/config/nvptx/target.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/task.c libgomp/config/nvptx/task.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/team.c libgomp/config/nvptx/team.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/time.c libgomp/config/nvptx/time.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/config/nvptx/work.c libgomp/config/nvptx/work.c new file mode 100644 index 0000000..e69de29 diff --git libgomp/configure libgomp/configure index f1a92ba..867ce40 100755 --- libgomp/configure +++ libgomp/configure @@ -15041,6 +15041,9 @@ case "$host" in *-*-rtems*) # RTEMS supports Pthreads, but the library is not available at GCC build time. ;; + nvptx*-*-*) + # NVPTX does not support Pthreads, has its own code replacement. + ;; *) # Check to see if -pthread or -lpthread is needed. Prefer the former. # In case the pthread.h system header is not found, this test will fail. diff --git libgomp/configure.ac libgomp/configure.ac index 9cf0218..b1696d0 100644 --- libgomp/configure.ac +++ libgomp/configure.ac @@ -179,6 +179,9 @@ case "$host" in *-*-rtems*) # RTEMS supports Pthreads, but the library is not available at GCC build time. ;; + nvptx*-*-*) + # NVPTX does not support Pthreads, has its own code replacement. + ;; *) # Check to see if -pthread or -lpthread is needed. Prefer the former. # In case the pthread.h system header is not found, this test will fail. diff --git libgomp/configure.tgt libgomp/configure.tgt index 2970f6f..8fad977 100644 --- libgomp/configure.tgt +++ libgomp/configure.tgt @@ -151,6 +151,10 @@ case "${target}" in XLDFLAGS="${XLDFLAGS} -lpthread" ;; + nvptx*-*-*) + config_path="nvptx" + ;; + *) ;;