public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <chunglin_tang@mentor.com>
To: Thomas Schwinge <thomas@codesourcery.com>,
	Chung-Lin Tang	<cltang@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts
Date: Tue, 18 Dec 2018 09:35:00 -0000	[thread overview]
Message-ID: <9c7ff0cd-b549-f012-55a3-8d67b07cd6e5@mentor.com> (raw)
In-Reply-To: <yxfph8fctg4s.fsf@hertz.schwinge.homeip.net>

On 2018/12/17 9:52 PM, Thomas Schwinge wrote:
> Hi Chung-Lin!
> 
> On Fri, 14 Dec 2018 22:52:44 +0800, Chung-Lin Tang <chunglin_tang@mentor.com> wrote:
>> On 2018/12/14 10:17 PM, Thomas Schwinge wrote:
>>> On Tue, 25 Sep 2018 21:10:47 +0800, Chung-Lin Tang <chunglin_tang@mentor.com> wrote:
>>>> --- a/libgomp/oacc-async.c
>>>> +++ b/libgomp/oacc-async.c
>>>
>>>> +attribute_hidden struct goacc_asyncqueue *
>>>> +lookup_goacc_asyncqueue (struct goacc_thread *thr, bool create, int async)
>>>> +{
>>>> +  /* The special value acc_async_noval (-1) maps to the thread-specific
>>>> +     default async stream.  */
>>>> +  if (async == acc_async_noval)
>>>> +    async = thr->default_async;
>>>> +
>>>> +  if (async == acc_async_sync)
>>>> +    return NULL;
>>>> +
>>>> +  if (async < 0)
>>>> +    gomp_fatal ("bad async %d", async);
>>>
>>> To make this "resolve" part more obvious, that is, the translation from
>>> the "async" argument to an "asyncqueue" array index:
>>>
>>>> +  if (!create
>>>> +      && (async >= dev->openacc.async.nasyncqueue
>>>> +	  || !dev->openacc.async.asyncqueue[async]))
>>>> +    return NULL;
>>>> +[...]
>>>
>>> ..., I propose adding a "async2id" function for that, and then rename all
>>> "asyncqueue[async]" to "asyncqueue[id]".
>>
>> I don't think this is needed. This is the only place in the entire runtime that
>> does asyncqueue indexing, adding more conceptual layers of re-directed indexing
>> 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?

Because the index is (1) not used elsewhere; nor supposed to really, lookup_goacc_asyncqueue()
is intended to be the centralized place for looking up async queues.
and (2) the special async number case handling here is really short, creating another
conceptual index-redirecting in the code feels like over-engineering.

>> 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".
>>
>> 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.

Okay, but do take note that the acc_get/set_default_async is part of the upstreaming too.
The behavior change is due to that new 2.5 functionality, not really because I arbitrarily changed things.

Thanks,
Chung-Lin

  reply	other threads:[~2018-12-18  9:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 13:11 Chung-Lin Tang
2018-12-07 11:33 ` Thomas Schwinge
2018-12-07 14:19   ` Chung-Lin Tang
2018-12-14 14:11     ` Thomas Schwinge
2018-12-14 14:17 ` Thomas Schwinge
2018-12-14 14:52   ` Chung-Lin Tang
2018-12-17 13:52     ` Thomas Schwinge
2018-12-18  9:35       ` Chung-Lin Tang [this message]
2018-12-14 14:32 ` Thomas Schwinge
2018-12-14 14:42   ` Chung-Lin Tang
2018-12-17 13:56     ` Thomas Schwinge
2018-12-14 14:54 ` Thomas Schwinge
2018-12-14 15:01   ` Chung-Lin Tang
2018-12-17 14:11     ` Thomas Schwinge
2018-12-14 14:56 ` Thomas Schwinge
2018-12-17 11:03   ` Chung-Lin Tang
2018-12-17 14:32     ` Thomas Schwinge
2018-12-18 10:03       ` Chung-Lin Tang
2018-12-18 11:44         ` Thomas Schwinge
2018-12-18 15:06 ` [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts (revised, v2) Chung-Lin Tang
2018-12-18 21:04   ` Thomas Schwinge
2018-12-21 16:25     ` [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts (revised, v3) Chung-Lin Tang
2018-12-28 14:52       ` Thomas Schwinge
2019-01-02 12:46     ` [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts (revised, v2) Chung-Lin Tang
2019-01-05  9:47       ` [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts (revised, v4) Chung-Lin Tang
2019-01-07 14:16         ` Thomas Schwinge
2019-01-08 14:04           ` Chung-Lin Tang
2019-01-07 14:15       ` [PATCH 2/6, OpenACC, libgomp] Async re-work, oacc-* parts (revised, v2) Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c7ff0cd-b549-f012-55a3-8d67b07cd6e5@mentor.com \
    --to=chunglin_tang@mentor.com \
    --cc=cltang@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).