[llvm] [NVPTX] Add syncscope support for cmpxchg (PR #140812)

Akshay Deodhar via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 14:39:07 PDT 2025


akshayrdeodhar wrote:

> @akshayrdeodhar when looking at the tests, e.g., here: https://github.com/llvm/llvm-project/blob/026e94ab2832d1e207439c8f52f2482206b848f5/llvm/test/CodeGen/NVPTX/cmpxchg-sm90.ll#L28
> 
> I observe that a non-atomic load is being generated to read the initial CAS value. Do you agree?
> 
> If so, that load needs to be an atomic load of the appropriate scope.

This does make sense- the first load generated by the emulation loop should be atomic! AtomicExpand does not currently do this.   Are we sure that generating an atomic load is valid for all targets? Then we'll have to modify AtomicExpand to issue atomic loads. 

https://github.com/llvm/llvm-project/pull/140812


More information about the llvm-commits mailing list