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_t...@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 <tho...@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)