[LLVMdev] Function-level metadata for OpenCL (was Re: OpenCL support)

Peter Collingbourne peter at pcc.me.uk
Fri Dec 24 15:49:54 PST 2010


On Tue, Dec 21, 2010 at 07:17:40PM -0000, Anton Lokhmotov wrote:
> > From: Peter Collingbourne [mailto:peter at pcc.me.uk]
> > Sent: 20 December 2010 20:11
> > As with __local variables, it may be that "kernelness" cannot be
> > represented in a standard form in LLVM.  For example on a CPU a
> > kernel function may have an additional parameter which is a pointer to
> > __local memory space, which would not be necessary on GPUs.  Then in
> > fact you would use a standard calling convention on a CPU.
> > 
> > But for GPUs, I think using the calling convention is appropriate.
> > If we standardise the calling convention number, this can be the
> > default behaviour.
> I don't think we want LLVM-IR coming from an OpenCL C frontend to be
> different for GPU and CPU targets. In my view, the frontend should be
> parameterised by only two (more or less) parameters: bitness (32/64) and
> endianness (little/big).

Not only sizes but alignment requirements will change between
platforms.  Also, what about __local on CPU?

> How one can even guarantee e.g. that a calling
> convention for NVIDIA GPUs is appropriate for ATI GPUs?

We have full control over the target code generators.  There's nothing
stopping us defining a specific constant representing the 'kernel'
calling convention and harmonising the GPU targets to use that
calling convention.

Thanks,
-- 
Peter



More information about the llvm-dev mailing list