[cfe-dev] OpenCL support
Peter Collingbourne
peter at pcc.me.uk
Sun Dec 12 15:44:48 PST 2010
On Fri, Dec 10, 2010 at 11:18:22PM -0000, Mike Gist wrote:
> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu on behalf of Anton Lokhmotov
> Sent: Fri 10/12/2010 18:21
> To: cfe-dev at cs.uiuc.edu
> Subject: [cfe-dev] OpenCL support
>
> > 1) For kernel functions (with the __kernel qualifier), we insert named
> > metadata nodes into LLVM-IR. Other options we have evaluated included:
> > - Shipping metadata separately from bitcode. This would be hard to
> > standardise on and maintain.
> > - Using imaginative name mangling. This would be pretty horrible too and
> > easy to misuse.
> >
> > The drawback of course is that metadata can be "silently dropped". However,
> > we are not aware of any transforms that would do this. Perhaps the
> > community should consider defining "sticky metadata"?
>
> You could also consider placing all kernel functions in a 'kernel' section, or
> adding a function attribute for kernels.
>
> Inserting metadata feels a little dirty to me, it shouldn't be used if it would change
> the semantics of the program (which it would in this case). Some kind of 'sticky' metadata
> would indeed get around 'dropping', however I don't believe (I may be wrong) that metadata was
> designed for this purpose. I'm not sure that trying to fit it to this purpose is a good idea.
The current PTX backend uses a target-specific calling convention for
kernel functions (CallingConv::PTX_Kernel). Another approach we may
consider is to standardise a kernel calling convention across backends.
Thanks,
--
Peter
More information about the cfe-dev
mailing list