According to your comment, it seems like you want atomic operations on float values.
Please check out this link: atomic operation and floats in opencl
The idea is to use the built in atom_cmpxchg
operation to try to swap the old value of a float point variable with a new value, which could be be its addition with another value, or multiplication, division, subtraction, etc.
The swapping only succeeds if the old value is actually the old value (that's where the cmp
comes into play). Otherwise, it will do it again in a while loop.
Notice that this atomic operation could be quite slow if many threads are doing this operation on a single value.