shader: implement BUFFER_ATOMIC_CMPSWAP #357
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!357
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/357/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Techx3 on GitHub · 2026-08-28 21:49 UTC · original
Techx3:techx3/buffer-atomic-cmpswap→main· +142 −49 · 9 files · 1 commits · merged 2026-09-03 21:34 UTCSummary
Implementation notes
The compare-and-swap source pair occupies VDATA and VDATA+1, so address operands begin after both values. The translator records that layout explicitly instead of treating the comparator as an address component.
The SPIR-V emitter uses device scope, the same memory-barrier path as the existing buffer atomics, and emits operands in the OpAtomicCompareExchange order: replacement, then comparator.
LLVM exposes the equivalent AMDGPU operation with src followed by cmp: https://mlir.llvm.org/docs/Dialects/AMDGPU/#amdgpuraw_buffer_atomic_cmpswap-amdgpurawbufferatomiccmpswapop
Validation
Scope
This PR intentionally contains only BUFFER_ATOMIC_CMPSWAP support. Other experimental shader changes are reviewed separately.
@brandostrong on GitHub · 2026-09-02 18:56 UTC · original
I can concur, I independently implemented this as well as a fix for astrobot.