PDA

View Full Version : about pointer variable



ikedanaruki
12-10-2009, 12:57 AM
Hello,

I want to use a pointer in private allocatinon, And It's with global address for caching the pointer address.

But the error occured,


__kernel void func(__global float* f)
{
unsigned int gid = get_global_id(0);
__private float*p = f;
p += gid;
}


Compiling the kernel,
<<program source>:12:26:{12:26-12:27}: error: illegal implicit cast between two pointers with different address spaces
__private float* p = f;
^

In the Open CL specification 6.8 Restrictions (a) , It's said that this case is not allow.

Must I only use " f[gid] "?
I want to optimize and reduce global memory access. Is there more better implementation?

matrem
12-10-2009, 02:10 AM
Why don't you just use a register :
float p = *f;

If you want to allocate some space in private / local memory I guess you have to declare them in kernel arguments and copy content between the two areas.