about pointer variable

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?

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.