You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[RISC-V] Zacas support for Interlocked.CompareExchange #137345
Interlocked.CompareExchange intrinsics currently use lr/sc retry loop sequences, processors supporting Zacas could lagely benefit from using amocas.w and amocas.d.
Admittedly, hardware support is currently lacking, but considering the importance of CAS operations as a building block for synchronization and concurrent algorithms, preemptive support seems justified. Zacas is also required to represent 128-bit CAS, which is not currently exposed, but may unblock work in the future, as it allows for a genuine cmpxchg16b emulation on RISC-V.
There is also a precedent with OpenJDK supporting it, as well as a precedent in the JIT for introducing ISA support before hardware validation.
I find it useful personally in VM/Emulator scenarios as well.
The initial scope would be to cover 32-bit and 64-bit Interlocked.CompareExchange intrinsics. Memory ordering on comparison failure needs special attention, since failed amocas operations do not provide release semantics by themselves.
I have a PR draft with the intial bringup, tested and passing with QEMU locally and I would love to contribute.
I would appreciate feedback on the scope and general direction
cc @am11@filipnavara
Activity
dotnet-policy-service commentedon Nov 11, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.