eyalroz / cuda-kat

CUDA kernel author's tools
BSD 3-Clause "New" or "Revised" License
105 stars 8 forks source link

Support atomicCAS() for all types #9

Closed eyalroz closed 5 years ago

eyalroz commented 5 years ago

We need to have an atomicCAS() equivalent available, some way or another for all types up to the hardware capability for atomic ops (8 bytes, i.e. unsigned long long int). Right now there's only apply_atomically() exposed, which is nice, but not enough.

So let's:

  1. Properly expose atomic::compare_and_swap() the way it is now (i.e. only for the types CUDA supports directly).
  2. Implement atomic::compare_and_swap() for smaller types using the larger type.