[Bulk] [OpenACC 0/7] host_data construct

Jakub Jelinek jakub@redhat.com
Mon Nov 2 19:29:00 GMT 2015


On Mon, Nov 02, 2015 at 06:33:39PM +0000, Julian Brown wrote:
> As the author of the original patch, I have to say using the mapping
> structures seems like a far better approach, but I've hit some trouble
> with the details of adapting OpenACC to use that method.
> 
> Firstly, on trunk at least, use_device_ptr variables are restricted to
> pointer or array types: that restriction doesn't exist in OpenACC, nor
> actually could I find it in the OpenMP 4.1 document (my guess is the

^^ 4.5 ;)

> standards are supposed to match in this regard). I think that a program
> such as this should work:
> 
> void target_fn (int *targ_data);
> 
> int
> main (int argc, char *argv[])
> {
>   char out;
>   int myvar;
> #pragma omp target enter data map(to: myvar)
> 
> #pragma omp target data use_device_ptr(myvar) map(from:out)
>   {
>     target_fn (&myvar);
>     out = 5;
>   }
> 
>   return 0;
> }

You are right, I've been misreading the standard (the only testcases that
have been provided with the change were using arrays and so it was
non-obvious that it relies on array to pointer decay).
I'll work on changing the implementation accordingly tomorrow.

	Jakub



More information about the Gcc-patches mailing list