The platform i am using is AMD radeon 200 series (sapphire 250 (GPU- Oland)
I am creating a class on host having a pointer as data member, and same class on kernel side too.
now if in kernel side, pointer is present in the class, build error( -11) arises. if we remove pointer on kernel side, code builds up.
there, the pointer value is copied to a global pointer and dereference value comes to be zero.
My main objective is to access a pointer in a class on device side.
opencl c++ version 1.2
any help would be appreciated.
In OpenCL, you cannot pass a struct that contains regular pointer(s). OpenCL 1.x doesn't support it. With OpenCL 2.x, Shared Virtual Memory (SVM) allows this kind of pointer passing however the pointer must be a SVM pointer.
There are several ways to pass the data referred by the pointer. You may create separate memory objects corresponding to the pointers and pass them to kernel as separate arguments. If the pointer refers to a particular element of an array, you can pass the whole array as a single buffer object and store the index of the element in the structure instead of the raw pointer.