A compare-and-swap (CAS) loop updates a value by reading its current contents, computing a replacement, and attempting to write it only if the value is unchanged. If another thread has modified it, the attempt fails and the loop retries. section 4.1.3
This fallback can be slower than a native atomic operation: under contention, only one thread succeeds per attempt while others retry. Older GPUs may use CAS loops for data types without native atomic support. section 4.1.3
tl.atomic_cas(pointer, cmp, val, sem=None, scope=None)
The compare-and-swap primitive used to attempt a conditional update. section 4.1.3
