Hi,
I have an array of float4 values and I would like to use atomic_add with.
The problem is that it is illegal to get the address of .x .y .z of the float4 and so it is impossible to use atomic_add.
Is there a solution ?
Thanks
You can't even atomically add scalar floating point numbers together. It would simple be too expensive to build this feature from a hardware perspective.
I suggest to create copy of float4 in 4 floats and do atomic_add.
Also check out the atomics_counter extension, if it is useful in your case.
[Edit] notzd, Thanks for the correction.
Originally posted by: himanshu.gautam I suggest to create copy of float4 in 4 floats and do atomic_add. Also check out the atomics_counter extension, if it is useful in your case.
How exactly do you atomic add with 4 floats?
And hou could an atomic_counter extension possibly be any help to working with floating point addition?
Atomic operations only apply to integers. You'll have to use a reduction to add floating point numbers in parallel.