From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67548 invoked by alias); 7 Dec 2018 14:19:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 67536 invoked by uid 89); 7 Dec 2018 14:19:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-26.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*tw, Gr=c3=bc=c3, Gr, H*F:U*cltang?= X-HELO: seed.net.tw Received: from sn13.seed.net.tw (HELO seed.net.tw) (139.175.54.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Dec 2018 14:19:23 +0000 Received: from [112.104.106.238] (port=53637 helo=[192.168.50.98]) by seed.net.tw with esmtp (Seednet 4.69:2) id 1gVGyN-000MgD-CB; Fri, 07 Dec 2018 22:19:19 +0800 Subject: Re: [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts To: Thomas Schwinge , Chung-Lin Tang Cc: gcc-patches@gcc.gnu.org References: <12319572-dd02-c946-f2b9-9d047be9c707@mentor.com> From: Chung-Lin Tang Message-ID: Date: Fri, 07 Dec 2018 14:19:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00455.txt.bz2 On 2018/12/7 07:32 PM, Thomas Schwinge wrote: > Hi Chung-Lin! > > On Tue, 25 Sep 2018 21:10:47 +0800, Chung-Lin Tang wrote: >> These are the OpenACC specific changes, mostly the re-implementation of async-related acc_* runtime >> library API functions to use the new backend plugin interfaces, in a non-target specific way. > > (The patch was missing the "libgomp/oacc-int.h" changes, but I had no > problem replicating these from openacc-gcc-8-branch.) > > > Does the following make sense? I don't quite remember why I simply ensured asyncqueue creation here at the time, maybe simply because it allowed simpler code at this level. OTOH, the old logic is to GOMP_fatal upon such an unknown queue case, so maybe that's the right thing to do (inside lookup_goacc_asyncqueue()), instead of silently allowing it to pass. WDYT? Chung-Lin > commit f86b403dbe6ed17afa8d157ec4089ff169a63680 > Author: Thomas Schwinge > Date: Fri Dec 7 12:19:56 2018 +0100 > > Don't create an asyncqueue just to then test/synchronize with it > --- > libgomp/oacc-async.c | 12 ++++++++---- > libgomp/oacc-parallel.c | 4 +++- > 2 files changed, 11 insertions(+), 5 deletions(-) > > diff --git libgomp/oacc-async.c libgomp/oacc-async.c > index 553082fe3d4a..c9b134ac3380 100644 > --- libgomp/oacc-async.c > +++ libgomp/oacc-async.c > @@ -119,8 +119,11 @@ acc_async_test (int async) > if (!thr || !thr->dev) > gomp_fatal ("no device active"); > > - goacc_aq aq = lookup_goacc_asyncqueue (thr, true, async); > - return thr->dev->openacc.async.test_func (aq); > + goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async); > + if (!aq) > + return 1; > + else > + return thr->dev->openacc.async.test_func (aq); > } > > int > @@ -148,8 +151,9 @@ acc_wait (int async) > > struct goacc_thread *thr = get_goacc_thread (); > > - goacc_aq aq = lookup_goacc_asyncqueue (thr, true, async); > - thr->dev->openacc.async.synchronize_func (aq); > + goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async); > + if (aq) > + thr->dev->openacc.async.synchronize_func (aq); > } > > /* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */ > diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c > index 7b6a6e515018..0be48f98036f 100644 > --- libgomp/oacc-parallel.c > +++ libgomp/oacc-parallel.c > @@ -491,7 +491,9 @@ goacc_wait (int async, int num_waits, va_list *ap) > { > int qid = va_arg (*ap, int); > > - goacc_aq aq = get_goacc_asyncqueue (qid); > + goacc_aq aq = lookup_goacc_asyncqueue (thr, false, qid); > + if (!aq) > + continue; > if (acc_dev->openacc.async.test_func (aq)) > continue; > if (async == acc_async_sync) > > > Grüße > Thomas > >