Reputation: 13195
I have an opencl buffer that is used by kernel A as read only, and kernel B as read_write. SO, the buffer is created read_write.
In kernel A, is there a way of indicating that the buffer is read only for this kernel?
Thanks!
Upvotes: 0
Views: 696
Reputation: 8410
Yes, you can indicate it by setting the pointer as constant:
__kernel void mykernel (__global const int * a, ...)
Or even by setting the memory as constant memory (if it fits in the constant space):
__kernel void mykernel (__constant int * a, ...)
Upvotes: 2