Results 1 to 2 of 2

Thread: about pointer variable

  1. #1
    Junior Member
    Join Date
    Oct 2009

    about pointer variable


    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

    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, 05:03 PM
  2. OpenCL pointer to pointer
    By MrSir in forum OpenCL
    Replies: 3
    Last Post: 02-26-2012, 08: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
Proudly hosted by Digital Ocean