From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67841 invoked by alias); 7 Dec 2018 11:33:01 -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 67692 invoked by uid 89); 7 Dec 2018 11:33:00 -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,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=qid 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, 07 Dec 2018 11:32:57 +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 1gVENI-0001h2-HU from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Fri, 07 Dec 2018 03:32:52 -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, 7 Dec 2018 11:32:49 +0000 From: Thomas Schwinge To: Chung-Lin Tang CC: Subject: Re: [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts In-Reply-To: <12319572-dd02-c946-f2b9-9d047be9c707@mentor.com> 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, 07 Dec 2018 11:33: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/msg00444.txt.bz2 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 a= sync-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? 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"); =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 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 =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