Wrong result from clEnqueueReadBuffer on CPU?

Discussion created by diapolo on Jan 18, 2010
Latest reply on Jan 20, 2010 by MicahVillmow

I use a clEnqueueReadBuffer, which reads 16 Bytes into an int[4] array. In my kernel I have got an if-clause, which if true, writes only then data into a memory buffer (and only 8 Bytes).

Situation is as follows, on the GPU I get 0 (zero / NULL) as an expected value in int[0] to int[3], everytime I do my clEnqueueReadBuffer (which is in a for-Loop in my host code) and only another value, if my if-clause in the kernel is true.

On the CPU I get a value of 3131961357 for all elements of the array, when I expect the value to be 0. What is even more strange, if I assume the value of 3131961357 is zero in my host code and I only react on other values, everything works. Even the computation-result is then correct.

I know the description is vague, but for now that´s all I got.