Hello,
It seems that currently GOMP_target perform call to host variant of the routine:

void
GOMP_target (int device, void (*fn) (void *), const char *fnname,
             size_t mapnum, void **hostaddrs, size_t *sizes,
             unsigned char *kinds)
{
  device = resolve_device (device);
  if (device == -1)
    {
      /* Host fallback.  */
      fn (hostaddrs);
      return;
    }
...
}

Why not to make GOMP_target return bool and run host fallback on the 
application site
instead of library site.
Was:
  ...
  GOMP_target (handle, &foo, "foo", ...);
  ...
Proposed to be:
  ...
  if (!GOMP_target (handle, &foo, "foo", ...))
    foo (hostaddrs);
  ...
The main advantage, IMHO, is that by doing so, we may probably enable inlining 
of host variant.
We also may eliminate pointer to host function and hostaddr from GOMP_target 
declaration.
Having instead of:
void
GOMP_target (int device, void (*fn) (void *), const char *fnname,
             size_t mapnum, void **hostaddrs, size_t *sizes,
             unsigned char *kinds)

This:
bool
GOMP_target (int device, const char *fnname,
             size_t mapnum, size_t *sizes,
             unsigned char *kinds)

What do you think?

--
Thanks, K

Reply via email to