Can I ignore data race?

I have boolean variable let’s say X


X may be in global or in shared memory

X may be set to true by multiple parts of the block or by other blocks - yet nothing can set it to false in this scenario

I care only whether the X is true or not - it is unimportant what set it to true or how many times it was set to true

In CPU I still should avoid data race as It may lead to runtime error / exception - but GPU seem to be different in this regard can I ignore data race in such setting?

I’m not familiar with problems doing that on a CPU, but in any event it is possible to construct that sort of algorithm on a GPU.

I would claim there isn’t actually a WAW race condition here if all threads are writing the same value, but perhaps someone will disagree with me.

Certainly if X is in shared memory you cannot set it (an instance of it) from multiple blocks - each block has its own logically separate version of shared memory.

Any RAW race concern is easily handled with proper synchronization between the threads doing the writing and the thread(s) doing the reading.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.