ReadBuffer strange error clEnqueueReadBuffer returns strange error code

Hello,

I’m implementing a resampler with FIR filter in OpenCL and I’m experiencing some strange behaviour with clEnqueueReadBuffer function. I’m using GeForce GTX 275 with 190.89 drivers, Windows 7 32-bit.

My resampling function is cyclically called, every time with new input data. In first iteration, necessary buffers are created (input and output), after that only input is written to GPU using clEnqueueWriteBuffer (blocking), kernel executed (parameters set in 1st iteration), then blocking read with clEnqueueReadBuffer.

And here comes the trouble. I’m testing it on 10000 iterations, but with the same data, something like this:

[codebox]

//Make resampler object

//Make 2 float arrays

//Load input array with some data

//Set filter coefficients, resampling ratio

for(i=0;i<10000;++i)

{	res = resampler.resample(INPUT_LEN,input,output); //res==0 means error

            if(res==0)

		break;

}

[/codebox]

I get -5 return code from clEnqueueWriteBuffer when reading computed data, but after random number of iterations. Sometimes its cca 7000, sometimes it crashes after second iteration, but seems quite random. Never got higher than cca 7300 iterations and never below 2. Whats the problem? And what does the return code mean? Its not a value specified in sepcification document.

So I tested this code on a different machine (notebook with GeForce 8600M GT), and it seems to be a hardware problem with my GTX 275, because on 8600M it ran flawlessly. I’m gonna replace GTX 275 with 8800GTX and see, what will happen.

8800GTX - same story as GTX 275… something must be wrong with my computer…