PDA

View Full Version : __constant vs const __global



guy.brush
05-11-2010, 02:30 AM
what's exactly the difference between the __constant qualifier and the const __global one?? they're just directions for device memory allocation or they implies different initialization for the associated variables?

What i observed is that while my kernels with const __global arguments run without errors, when i change to __constant i get 0xc0000005 Access violation errors.

david.garcia
05-11-2010, 12:08 PM
Typically on GPUs you will get much better performance from __constant kernel arguments than from const __global. Keep in mind, though, that there's a limited amount of __constant storage in any GPU, so you can't usually put, say, 100MB worth of data in __constant memory.

The problems you are seeing are probably a driver bug. What OpenCL implementation are you using?

guy.brush
05-11-2010, 03:02 PM
i'm running on a nvidia geforce 310m gpu ( notebook ) with the latest sdk. Actually i don't get this error with the ati stream sdk.

Barneybear
05-12-2010, 02:23 AM
On nvidia hardware the __constant qualifier has the added benefit of allowing caching of said memory. However, the amount of constant memory is quite limited so it might be possible that you've overflown the capacity of the constant memory. I suggest checking the specifications of the GPU being used.

guy.brush
05-12-2010, 07:06 AM
i'm working with 16 cl_float, my problem is not due to constant memory overflow