[cfe-dev] [LLVMdev] OpenCL support

Anton Lokhmotov Anton.Lokhmotov at arm.com
Thu Dec 9 02:14:12 PST 2010


> Also, don't forget there is a difference between local int a and local
> int* a, one is just a pointer to some pre-allocated memory and the
> other actually requires memory to be allocated.
Correct.

> Any implementation should ignore local pointers variables and only deal
> with local scalar, vector and array variables.
Sorry, I'm not sure what do you mean by this.

int f()
{
    int * __local p; // __local pointer to __private memory
    __local int * p; // __private pointer to __local memory
}

Both examples seem reasonable to me.


> [Villmow, Micah] A kernel with locally defined variables cannot call
> another kernel with local variables. This is illegal in OpenCL because
> when a kernel calls another kernel, that kernel is treated as a normal
> function. A normal function is not allowed to have local variables
> declared inside the body. Basically this restricts locally defined
> variables in a kernel body to the top level kernel function only.
This sounds reasonable, but, to be precise, the specification says: "The
behavior of calling kernel functions with variables declared inside the
function with the __local or local qualifier from other kernel functions is
implementation-defined."  In principle, an implementation can statically
compute the call graph of the kernel function being compiled and conflate
local memory allocation requirements from different kernel functions in the
graph...

Regards,
Anton.







More information about the cfe-dev mailing list