Results 1 to 2 of 2

Thread: about pointer variable

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    7

    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,

    Code :
    __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?

  2. #2
    Senior Member
    Join Date
    Nov 2009
    Posts
    118

    Re: about pointer variable

    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.

Similar Threads

  1. Replies: 1
    Last Post: 12-27-2012, 06:03 PM
  2. OpenCL pointer to pointer
    By MrSir in forum OpenCL
    Replies: 3
    Last Post: 02-26-2012, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •