I have a large array of floats, possible millions of cells and an algorithm that will operate on this data until it reaches a state where no more work can be done. If a single float of these is greater than zero, a boolean should be set to true and then passed to the host which means that the kernel should be scheduled for execution again. There is a work-item for each cell doing calculations. I have so far considered using an two-stage |= reduction on the whole array which seems to be the proper way to do things. Another really slow way would be to use atomic operations.
As I only want to set a specific value if a work item does some work and leave it alone otherwise, can I pass a global boolean which can be modified by every work item in every work group without the use of atomics and still achieve the intended effect? Suppose that this boolean gets initialized to false and can only ever be set to true by the work items, can I ever get a wrong result? Is this a bad idea, if so, why?