[PATCH] D19932: [OpenCL] Add to_{global|local|private} builtin functions.
Jan Vesely via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 23 11:49:37 PDT 2016
jvesely added a comment.
In http://reviews.llvm.org/D19932#465784, @yaxunl wrote:
> In http://reviews.llvm.org/D19932#465781, @jvesely wrote:
>
> > In http://reviews.llvm.org/D19932#465763, @cfe-commits wrote:
> >
> > > The returned pointer should point to the same pointee type as the argument. Header file cannot guarantee that.
> > >
> > > Sam
> >
> >
> > how come? is there a possibility to have two different types using the same name?
>
>
> Because the pointee type is arbitrary, you can only define it as
>
> global void* to_global(void*);
>
>
> in the header file. Then you could have
>
> int *a;
> global double *b = to_global(a);
>
>
> without diagnostics, but the spec requires that to_global(a) should have global int* type, therefore there should be some diagnostics.
this is not true. as I pointed out earlier, take a look at libclc headers. a lot functions are defined for multiple types while maintaining type safety.
there is no problem having TYPE * to_global(TYPE *), for every permissible CLC type, declared in headers without any builtin.
Repository:
rL LLVM
http://reviews.llvm.org/D19932
More information about the cfe-commits
mailing list