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.
Thanks,
Dia
i think you get just random uninicialized numbers. could you please post your kernel code?
Well, that could be ... perhaps I should zero that memory buffer in my kernel as an else condition. I have to try that.
But why would GPU give correct 0 and CPU an invalid value? Guess that could be AMD implementation specific.
I´ll report back tomorrow, thanks nou.
Dia
Yes I have seen that behavior, as in GPU assigning NULL to unwritten values and CPU just giving some random value.
You should use an else clause to write null values.