From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118581 invoked by alias); 17 Dec 2018 13:52:30 -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 118571 invoked by uid 89); 17 Dec 2018 13:52:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=functional, asyncargument, async-argument 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, 17 Dec 2018 13:52:27 +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 1gYtJp-0007ht-Px from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Mon, 17 Dec 2018 05:52:25 -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; Mon, 17 Dec 2018 13:52:22 +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: Mon, 17 Dec 2018 13:52: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/msg01215.txt.bz2 Hi Chung-Lin! On Fri, 14 Dec 2018 22:52:44 +0800, Chung-Lin Tang wrote: > On 2018/12/14 10:17 PM, Thomas Schwinge wrote: > > On Tue, 25 Sep 2018 21:10:47 +0800, Chung-Lin Tang wrote: > >> --- a/libgomp/oacc-async.c > >> +++ b/libgomp/oacc-async.c > >=20 > >> +attribute_hidden struct goacc_asyncqueue * > >> +lookup_goacc_asyncqueue (struct goacc_thread *thr, bool create, int a= sync) > >> +{ > >> + /* The special value acc_async_noval (-1) maps to the thread-specif= ic > >> + default async stream. */ > >> + if (async =3D=3D acc_async_noval) > >> + async =3D thr->default_async; > >> + > >> + if (async =3D=3D acc_async_sync) > >> + return NULL; > >> + > >> + if (async < 0) > >> + gomp_fatal ("bad async %d", async); > >=20 > > To make this "resolve" part more obvious, that is, the translation from > > the "async" argument to an "asyncqueue" array index: > >=20 > >> + if (!create > >> + && (async >=3D dev->openacc.async.nasyncqueue > >> + || !dev->openacc.async.asyncqueue[async])) > >> + return NULL; > >> +[...] > >=20 > > ..., I propose adding a "async2id" function for that, and then rename a= ll > > "asyncqueue[async]" to "asyncqueue[id]". >=20 > I don't think this is needed. This is the only place in the entire runtim= e that > does asyncqueue indexing, adding more conceptual layers of re-directed in= dexing > seems unneeded. It makes the code better understandable? Or, curious, why do you think that the translation from an OpenACC async-argument to an internal asyncqueue ID should not be a separate function? > I do think the more descriptive comments are nice though. > > And, this also restores the current trunk behavior, so that > > "acc_async_noval" gets its own, separate "asyncqueue". >=20 > Is there a reason we need to restore that behavior right now? Because otherwise that's a functional change ("regression") from the current GCC trunk behavior, which I wouldn't expect in a re-work. Gr=C3=BC=C3=9Fe Thomas