cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

atomic_add & float4

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

0 Likes
4 Replies
rick_weber
Adept II

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.

0 Likes

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.

0 Likes

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?

 

0 Likes

Atomic operations only apply to integers. You'll have to use a reduction to add floating point numbers in parallel.

0 Likes