Hi,
I am trying to develop a kernel, that relies on an arbitrary amount of image parameters (within the CL_DEVICE_MAX_READ_IMAGE_ARGS amount). Since I only know how many images I have when providing my kernel input data, I was wondering if it is possible to do something like this:
__kernel void test(__global image2d_t * images,
__global float2 * texcoord,
sampler_t sampler,
__global float4 * output
)
{
int idx = get_global_id(0);
float2 lookup = texcoord[idx];
float4 texLookup = read_imagef(images[idx], sampler, lookup);
output[idx] = texLookup;
}
When I try compiling this (Mac OSX 10.7, OpenCL 1.1) I get the following build errors:
- on the CPU (Intel Xeon)
cvmsErrorCompilerFailure: LLVM compiler has crashed or hung compiling a function.
- on my GPU (AMD Radeon HD 5870) it first compiles forever (> 15s, compared to bigger kernels compiling instantly) and then my build log contains the following
Error getting function data from server
So my question here is: are these errors a result of me using an array of images, or am I just using wrong syntax.
If it is just wrong syntax, what would be the right one? I only could find out, that samplers are not supposed to be put into an array, so I assumed textures should be possible.
If it is not possible to have an array of images, is there a workaround I could use (I’d rather avoid passing the data as plain arrays instead of textures and code my own texture lookup)?
Thank you
Herbert
PS: I use the C++ wrapper for OpenCL as defined in the cl.hpp, if that could make a difference.