Can not compile with OpenCL

Nov 10, 2014 at 3:23 PM
I am trying to compile this with OpenCL:

[Cudafy]
    unsafe static void MyKernelMethod(GThread thread, int[] a)
    {
        // fix our array to a ptr 
        fixed (int* aPtr = a)
        {
            // get a new array pointing to some offset of the original array
            int* aPtr_Offset = aPtr + thread.blockIdx.x;
            // use it for something
            aPtr_Offset[thread.threadIdx.x] = 2;

            // some more code...
        }
    }
which fails with the following error:
Unhandled Exception: Cudafy.CudafyCompileException: Compilation error: :15:13: error: illegal implic
it conversion between two pointers with different address spaces
    int* ptr = a;
               ^
:15:7: warning: initializing 'int *' with an expression of type 'int __attribute__((address_space(1)
)) *' discards qualifiers
    int* ptr = a;
         ^     ~
.

The kernel is compiled if I select CUDA as the eGPUType.
What am I doing wrong ?
Coordinator
Nov 11, 2014 at 2:56 PM
The OpenCL support is somewhat limited. The clunky workaround here is to use indexing on the original array and not get a pointer to offset.
Nov 11, 2014 at 6:54 PM
Ok, thanks.