We are trying to invoke an OpenCL kernel with a decorated pointer: i.e. a pointer with information about the data it references. Our plan was to embed the pointer in a struct:
struct DecoratedPtrHost {
cl_mem ptr;
int size;
...
};
struct DecoratedPtrDev {
float *ptr;
int size;
...
};
However, it appears that there is no way to make this structure on the host size. A pointer is normally passed as a cl_mem object, which on the host is a pointer to an anonymous structure (presumably containing information about the buffer). It appears that clSetKernelArg() does some magic to turn this into a pointer for the device.
Am I right to assume that the standard does not provision for passing a structure like this from the host to the kernel?
i even failed to set a float3 vector as kernel argument… or does anyone has a clue how to do this?
afaik there’s no such information in the opencl spec.:
“For all other kernel arguments, the arg_value entry must be a pointer to the actual data to be used as argument value.”
thus cl_mem objects are only allowed as direct arguments.
this would be a feature request to nvidia as a nvidia specific feature.
but according to the spec., my float3 vector has to be handled as a copy operation which does not work so far…