From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109467 invoked by alias); 10 Oct 2017 18:08:33 -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 109457 invoked by uid 89); 10 Oct 2017 18:08:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=observe, gr=c3=bc=c3, H*r:PDT?= 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; Tue, 10 Oct 2017 18:08:31 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtps (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1e1yxA-000152-Lu from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Tue, 10 Oct 2017 11:08:28 -0700 Received: from tftp-cs (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Tue, 10 Oct 2017 11:08:28 -0700 Received: by tftp-cs (Postfix, from userid 49978) id F2165C2316; Tue, 10 Oct 2017 11:08:27 -0700 (PDT) From: Thomas Schwinge To: Chung-Lin Tang , Cesar Philippidis , gcc-patches Subject: Re: [gomp4] OpenACC async re-work In-Reply-To: References: <469ff96f-b7de-cac6-0051-e23f70997cf4@codesourcery.com> <96ee71af-5ab2-4c8b-965a-74813c20e075@mentor.com> <957af04c-b58c-7d55-8713-b750815b32d4@codesourcery.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/25.2.1 (x86_64-pc-linux-gnu) Date: Tue, 10 Oct 2017 18:37:00 -0000 Message-ID: <87zi8yj2p6.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2017-10/txt/msg00607.txt.bz2 Hi! 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_profilin= g_dispatch_p: Assertion `thr->prof_info =3D=3D NULL' failed. This is because of: On Tue, 25 Jul 2017 20:51:05 +0800, Chung-Lin Tang 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 =3D prof_info.async; > } >=20=20 > - void *ret =3D NULL; > if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func) > - ret =3D thr->dev->openacc.cuda.get_stream_func (async); > -=20 > - if (profiling_setup_p) > { > - thr->prof_info =3D NULL; > - thr->api_info =3D NULL; > + goacc_aq aq =3D 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 Date: Tue Oct 10 19:25:19 2017 +0200 acc_get_cuda_stream: Clean up data of the OpenACC Profiling Interface =20=20=20=20 libgomp/ * oacc-cuda.c (acc_get_cuda_stream): Clean up data of the OpenA= CC Profiling Interface. * testsuite/libgomp.oacc-c-c++-common/acc_prof-cuda-1.c: New fi= le. --- 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 =3D prof_info.async; } =20 + void *ret =3D NULL; if (thr && thr->dev && thr->dev->openacc.cuda.get_stream_func) { goacc_aq aq =3D lookup_goacc_asyncqueue (thr, false, async); - return aq ? thr->dev->openacc.cuda.get_stream_func (aq) : NULL; + if (aq) + ret =3D thr->dev->openacc.cuda.get_stream_func (aq); } - return NULL; + + if (profiling_setup_p) + { + thr->prof_info =3D NULL; + thr->api_info =3D NULL; + } + + return ret; } =20 int diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-cuda-1.c li= bgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-cuda-1.c new file mode 100644 index 0000000..63f5e49 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-cuda-1.c @@ -0,0 +1,16 @@ +/* TODO: This is to eventually test dispatch of events to callbacks. */ + +#include + +int main() +{ + acc_init(acc_device_default); + + (void) acc_get_cuda_stream(acc_async_default); + /* The following used to crash the runtime due to acc_get_cuda_stream not + cleaning up data of the OpenACC Profiling Interface. */ +#pragma acc data + ; + + return 0; +} Gr=C3=BC=C3=9Fe Thomas