From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9252 invoked by alias); 14 Dec 2018 14:11:36 -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 9235 invoked by uid 89); 14 Dec 2018 14:11:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=qid, D*tw, aq, synchronize 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, 14 Dec 2018 14:11:32 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gXoBe-0001UA-C8 from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Fri, 14 Dec 2018 06:11:30 -0800 Received: from hertz.schwinge.homeip.net (137.202.0.90) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 14 Dec 2018 14:11:26 +0000 From: Thomas Schwinge To: Chung-Lin Tang CC: Subject: Re: [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts In-Reply-To: References: <12319572-dd02-c946-f2b9-9d047be9c707@mentor.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Fri, 14 Dec 2018 14:11:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2018-12/txt/msg01055.txt.bz2 Hi Chung-Lin! On Fri, 7 Dec 2018 22:19:14 +0800, Chung-Lin Tang wrote: > On 2018/12/7 07:32 PM, Thomas Schwinge wrote: > > Does the following make sense? >=20 > I don't quite remember why I simply ensured asyncqueue creation here at t= he time, > maybe simply because it allowed simpler code at this level. Well, I think it's just overhead we can avoid. ;-) > 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 sile= ntly allowing it to pass. >=20 > WDYT? I argued and posted patches (or will post if not yet done) to make this defined, valid behavior, "[OpenACC] Correctly handle unseen async-arguments". Please speak up soon if you disagree. Thus, I still propose that you include the following. Please especially review the "libgomp/oacc-parallel.c:goacc_wait" change, and confirm no corresponding "libgomp/oacc-parallel.c:GOACC_wait" change to be done, because that code is structured differently. commit c96c6607b77bdbf562f35209718d8b8c5705c603 Author: Thomas Schwinge Date: Fri Dec 7 12:19:56 2018 +0100 into async re-work: don't create an asyncqueue just to then test/synchr= onize 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"); =20 - goacc_aq aq =3D lookup_goacc_asyncqueue (thr, true, async); - return thr->dev->openacc.async.test_func (aq); + goacc_aq aq =3D lookup_goacc_asyncqueue (thr, false, async); + if (!aq) + return 1; + else + return thr->dev->openacc.async.test_func (aq); } =20 int @@ -148,8 +151,9 @@ acc_wait (int async) =20 struct goacc_thread *thr =3D get_goacc_thread (); =20 - goacc_aq aq =3D lookup_goacc_asyncqueue (thr, true, async); - thr->dev->openacc.async.synchronize_func (aq); + goacc_aq aq =3D lookup_goacc_asyncqueue (thr, false, async); + if (aq) + thr->dev->openacc.async.synchronize_func (aq); } =20 /* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */ diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c index 2815a10f0386..9519abeccc2c 100644 --- libgomp/oacc-parallel.c +++ libgomp/oacc-parallel.c @@ -493,7 +493,9 @@ goacc_wait (int async, int num_waits, va_list *ap) { int qid =3D va_arg (*ap, int); =20=20=20=20=20=20=20 - goacc_aq aq =3D get_goacc_asyncqueue (qid); + goacc_aq aq =3D lookup_goacc_asyncqueue (thr, false, qid); + if (!aq) + continue; if (acc_dev->openacc.async.test_func (aq)) continue; if (async =3D=3D acc_async_sync) Gr=C3=BC=C3=9Fe Thomas