FleX icon indicating copy to clipboard operation
FleX copied to clipboard

Atomic operations on float4

Open korzen opened this issue 6 years ago • 1 comments

Hi,

I am writing a kernel for projecting custom constraints type. I would like to solve them in a constraint centric way. However, I am not sure how to use atomic operations such a as add on structs such as float4. From the unified particles paper I know that such approach is being used in Flex.

Some code snippet would be much appreciated.

Thanks

korzen avatar Apr 26 '18 11:04 korzen

Hi there,

We simply emulate float4 atomics by performing it on each element, i.e.: in CUDA calling atomicAdd() 4 times. D3D11 does not have atomic floating point operations so they have to be emulated using InterlockedCompareExchange().

Hope that helps.

Cheers, Miles

mmacklin avatar Apr 26 '18 22:04 mmacklin