[LLVMdev] Function-level metadata for OpenCL (was Re: OpenCL support)
Anton Lokhmotov
Anton.Lokhmotov at arm.com
Tue Dec 21 11:17:40 PST 2010
> 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). How one can even guarantee e.g. that a calling
convention for NVIDIA GPUs is appropriate for ATI GPUs? So using calling
conventions too early on (e.g. between invoking the clBuildProgram() and
clCreateKernel() API functions) is a path to implementation divergence,
rather than standardisation.
From: Nick Lewycky [mailto:nlewycky at google.com]
Sent: 17 December 2010 22:16
> > If that's not enough, could you swing it around and maintain single
> > named metadata node with a list of functions that are marked __kernel?
This is exactly what we would like to do if metadata "non-discardability"
could be guaranteed at least until the clCreateKernel() API function is
called.
Cheers,
Anton.
More information about the llvm-dev
mailing list