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: Jakub Jelinek <jakub at redhat dot com>
- To: 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: Mon, 23 Nov 2015 15:16:42 +0100
- Subject: Re: [hsa] depend nowait support for target
- Authentication-results: sourceware.org; auth=none
- References: <20150908092014 dot GA1847 at tucnak dot redhat dot com> <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>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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.
> + 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?
Jakub