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

Reply via email to