Forum Discussion
I don't think you can use anything other than OpenCL's datatypes as kernel argument, unless the argument is a pointer to global memory. Even though your code compiles just fine with recent versions of the compiler and just crashes during emulation, with older versions of the compiler (below v18.1) a clear error is printed as follows:
error: unsupported kernel argument type
__kernel void app(const int N, my_type_t id, __global int * mem)
^The following code works fine with every version of the compiler and in both normal compilation and emulation:
typedef struct{
char my_id;
char num_ids;
}my_type_t;
__kernel void app(const int N, __global my_type_t* id, __global int * mem)
{
for(int i=0;i<N;i++)
mem[i]=id->my_id;
}I think the previous behavior of the compiler (below v18.1) was correct and the fact that your original code compiles fine starting from v18.1 (but crashes during emulation) is the incorrect behavior.
P.S. You should probably consider using the __attribute__ ((packed)) to avoid padding differences between host and kernel for the struct.
I see,
thanks I will pass through device memory (or use standard opencl types).
Thanks