From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60503 invoked by alias); 25 Nov 2015 15:34:53 -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 60489 invoked by uid 89); 25 Nov 2015 15:34:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 25 Nov 2015 15:34:51 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6EF7CAB12; Wed, 25 Nov 2015 15:33:08 +0000 (UTC) Date: Wed, 25 Nov 2015 15:41:00 -0000 From: Martin Jambor To: Jakub Jelinek Cc: Ilya Verbin , Aldy Hernandez , gcc-patches@gcc.gnu.org, Kirill Yukhin , Thomas Schwinge , Alexander Monakov Subject: Re: [hsa] depend nowait support for target Message-ID: <20151125153447.GO14925@virgil.suse.cz> Mail-Followup-To: Jakub Jelinek , Ilya Verbin , Aldy Hernandez , gcc-patches@gcc.gnu.org, Kirill Yukhin , Thomas Schwinge , Alexander Monakov References: <20151002192801.GA24765@msticlxl57.ims.intel.com> <20151015140156.GE478@tucnak.redhat.com> <20151019194754.GB1855@msticlxl57.ims.intel.com> <20151111165222.GL5675@tucnak.redhat.com> <20151112174509.GG5675@tucnak.redhat.com> <20151112205133.GC4917@msticlxl57.ims.intel.com> <20151113101841.GL5675@tucnak.redhat.com> <20151113151150.GQ5675@tucnak.redhat.com> <20151123141205.GN14925@virgil.suse.cz> <20151123141642.GD5675@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20151123141642.GD5675@tucnak.redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg03095.txt.bz2 On Mon, Nov 23, 2015 at 03:16:42PM +0100, Jakub Jelinek wrote: > On Mon, Nov 23, 2015 at 03:12:05PM +0100, Martin Jambor wrote: > > +/* Thread routine to run a kernel asynchronously. */ > > + > > +static void * > > +run_kernel_asynchronously (void *thread_arg) > > +{ > > + struct async_run_info *info = (struct async_run_info *) thread_arg; > > + int device = info->device; > > + void *tgt_fn = info->tgt_fn; > > + void *tgt_vars = info->tgt_vars; > > + void **args = info->args; > > + void *async_data = info->async_data; > > + > > + free (info); > > + GOMP_OFFLOAD_run (device, tgt_fn, tgt_vars, args); > > + GOMP_PLUGIN_target_task_completion (async_data); > > + return NULL; > > Is this just a temporary hack to work-around the missing task.c/target.c > support for plugins that need polling (calling some hook) to determine > completion of the tasks, or there is no way to tell HSA to spawn something > asynchronously? > Short term it is ok this way. Basically yes. There is no way to tell HSA-run time to be notified of kernel completion. If libgomp provides a way to poll the device, I'll gladly use that instead. > > > + int err = pthread_create (&pt, NULL, &run_kernel_asynchronously, info); > > + if (err != 0) > > + GOMP_PLUGIN_fatal ("HSA asynchronous thread creation failed: %s", > > + strerror (err)); > > + err = pthread_detach (pt); > > + if (err != 0) > > + GOMP_PLUGIN_fatal ("Failed to detach a thread to run HRA kernel " > > + "asynchronously: %s", strerror (err)); > > HSA instead of HRA? > Oh, thanks. Will fix. Martin