Results 1 to 2 of 2

Thread: setKernelArg as size in bytes and NULL for __global pointers

  1. #1
    Senior Member
    Join Date
    Mar 2011

    setKernelArg as size in bytes and NULL for __global pointers

    Similar to how you can pass a size in bytes and a NULL value for a __local pointer when you want to dynamically allocate some local memory, it would be useful to do the same for a __global pointer. If you don't be read or write to the __global pointer from any other device, why must you create a buffer which would seem to have more overhead than necessary? Think of any time you need some temporary scratch local memory, but you need a lot more of it than available, i.e., some temporary scratch global memory. If you can program this way for local memory then why not for global memory?

  2. #2
    Join Date
    Oct 2010
    Vancouver, Canada

    Re: setKernelArg as size in bytes and NULL for __global poin

    Because global memory is a shared resource that persists beyond the scope of a kernel. It is better to let the application allocate and reused it's allocated buffers as it knows best. Local memory cannot be preserved or shared in this way, and "allocation" of it for this purpose does not require a sophisticated allocator (it can be done with just a free pointer add at kernel launch).

Similar Threads

  1. Replies: 3
    Last Post: 01-22-2012, 05:29 PM
  2. Replies: 2
    Last Post: 12-22-2011, 10:13 PM

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