__constant vs const __global

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.

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?

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.

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.

i’m working with 16 cl_float, my problem is not due to constant memory overflow