This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [hsa] depend nowait support for target
- From: Martin Jambor <mjambor at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Ilya Verbin <iverbin at gmail dot com>, Aldy Hernandez <aldyh at redhat dot com>, gcc-patches at gcc dot gnu dot org, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Thomas Schwinge <thomas at codesourcery dot com>, Alexander Monakov <amonakov at ispras dot ru>
- Date: Wed, 25 Nov 2015 16:34:47 +0100
- Subject: Re: [hsa] depend nowait support for target
- Authentication-results: sourceware.org; auth=none
- References: <20151002192801 dot GA24765 at msticlxl57 dot ims dot intel dot com> <20151015140156 dot GE478 at tucnak dot redhat dot com> <20151019194754 dot GB1855 at msticlxl57 dot ims dot intel dot com> <20151111165222 dot GL5675 at tucnak dot redhat dot com> <20151112174509 dot GG5675 at tucnak dot redhat dot com> <20151112205133 dot GC4917 at msticlxl57 dot ims dot intel dot com> <20151113101841 dot GL5675 at tucnak dot redhat dot com> <20151113151150 dot GQ5675 at tucnak dot redhat dot com> <20151123141205 dot GN14925 at virgil dot suse dot cz> <20151123141642 dot GD5675 at tucnak dot redhat dot com>
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