Is it fair to say that if I have a kernel in which I perform an atomic operation (say an atomicAdd) on foo in global memory and later in the same kernel i read the value of foo, then I’m looking for trouble? It can be the other way too: reading foo and then atomically incrementing it.
I can imagine a situation when a thread from a block reads foo through a pointer while a thread from a different block, exactly at the dame time, is atomically operating on foo. While this could happen rarely, when it does the behavior i imagine it’s undefined.
Am i getting this right?