Hello,

quick question: can integer/bitwise operations on the device assumed to be 100% accurate?

I’m currently doing the following:

On the device:

- calculate a matrix of floats
- treat these floats as ints (__float_as_int)
- perform a lot of operations on the bit level (trying to represent long chains of zeros in a more efficient way, so essentially perform coding)

After that, on the host:

4) copy the coded values to host memory

5) perform the inverse bitwise operations (decoding)

6) convert the ints back to floats

7) compare the resulting matrix with a reference matrix calculated on the host

My source code seems to be correct, since in emulation mode everything works as expected. However, in non-emulation mode the decoder runs out of synch resulting in wrongly decoded ints.

Therefore I assumed that the error has to happen during the coding part since this is done on the device.

So I compared the array of coded values generated in emulation and non-emulation mode (step 3). And in fact, some of these values differ to an extent that cannot be explained by floating point inaccuracies. And they also appear around the area where the decoder loses synch.

That means that most likely the coder doesn’t work correctly when executed on the device. But the coder only performs integer/bitwise operations and it performs them correctly as shown by the correct results in emulation mode, hence my initial question.

I don’t want to bother you too much, but maybe someone could give me hint how to locate the error? Thanks for reading so far!