This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp4] OpenACC async re-work
- From: Cesar Philippidis <cesar at codesourcery dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>, Chung-Lin Tang <chunglin_tang at mentor dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 10 Oct 2017 14:01:22 -0700
- Subject: Re: [gomp4] OpenACC async re-work
- Authentication-results: sourceware.org; auth=none
- References: <f3fe2923-fd7f-64e5-326d-c20f161aa205@mentor.com> <469ff96f-b7de-cac6-0051-e23f70997cf4@codesourcery.com> <96ee71af-5ab2-4c8b-965a-74813c20e075@mentor.com> <957af04c-b58c-7d55-8713-b750815b32d4@codesourcery.com> <e8d2c3f5-6ecf-2915-3289-5243406097d0@mentor.com> <87zi8yj2p6.fsf@euler.schwinge.homeip.net>
On 10/10/2017 11:08 AM, Thomas Schwinge wrote:
> Reported by Cesar for a test case similar to the one below, where we
> observe:
>
> acc_prof-cuda-1.exe: [...]/libgomp/oacc-profiling.c:592: goacc_profiling_dispatch_p: Assertion `thr->prof_info == NULL' failed.
>
> This is because of:
>
> On Tue, 25 Jul 2017 20:51:05 +0800, Chung-Lin Tang <chunglin_tang@mentor.com> wrote:
>> --- libgomp/oacc-cuda.c (revision 250497)
>> +++ libgomp/oacc-cuda.c (working copy)
>> @@ -99,17 +99,12 @@ acc_get_cuda_stream (int async)
>> prof_info.async_queue = prof_info.async;
>> }
>>
>> - void *ret = NULL;
>> if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func)
>> - ret = thr->dev->openacc.cuda.get_stream_func (async);
>> -
>> - if (profiling_setup_p)
>> {
>> - thr->prof_info = NULL;
>> - thr->api_info = NULL;
>> + goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async);
>> + return aq ? thr->dev->openacc.cuda.get_stream_func (aq) : NULL;
>> }
>> -
>> - return ret;
>> + return NULL;
>> }
>
> Pushed to openacc-gcc-7-branch:
>
> commit db149741171147fa86a9bfe708a9082f508115ac
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date: Tue Oct 10 19:25:19 2017 +0200
>
> acc_get_cuda_stream: Clean up data of the OpenACC Profiling Interface
>
> libgomp/
> * oacc-cuda.c (acc_get_cuda_stream): Clean up data of the OpenACC
> Profiling Interface.
> * testsuite/libgomp.oacc-c-c++-common/acc_prof-cuda-1.c: New file.
> ---
> libgomp/oacc-cuda.c | 13 +++++++++++--
> .../libgomp.oacc-c-c++-common/acc_prof-cuda-1.c | 16 ++++++++++++++++
> 2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git libgomp/oacc-cuda.c libgomp/oacc-cuda.c
> index 1fbe77d..0ac93e9 100644
> --- libgomp/oacc-cuda.c
> +++ libgomp/oacc-cuda.c
> @@ -99,12 +99,21 @@ acc_get_cuda_stream (int async)
> prof_info.async_queue = prof_info.async;
> }
>
> + void *ret = NULL;
> if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func)
> {
> goacc_aq aq = lookup_goacc_asyncqueue (thr, false, async);
> - return aq ? thr->dev->openacc.cuda.get_stream_func (aq) : NULL;
> + if (aq)
> + ret = thr->dev->openacc.cuda.get_stream_func (aq);
> }
> - return NULL;
> +
> + if (profiling_setup_p)
> + {
> + thr->prof_info = NULL;
> + thr->api_info = NULL;
> + }
> +
> + return ret;
> }
Thanks!
I wonder if it makes sense to apply my patch to og7. It's the workaround
that I was using in case the async queue doesn't exist. Basically, in
that case, goacc_wait turns into a nop.
Cesar
diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index 1172d739ec7..85ed2327795 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -855,6 +855,9 @@ goacc_wait (int async, int num_waits, va_list *ap)
{
int qid = va_arg (*ap, int);
goacc_aq aq = get_goacc_asyncqueue (qid);
+ /* There's nothing to do if an async queue doesn't exit. */
+ if (aq == NULL)
+ return;
if (acc_dev->openacc.async.test_func (aq))
continue;
if (async == acc_async_sync)