mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #865] tools/rdna2spirv: native SPIR-V 64-bit atomics for global_atomic_*_x2 and buffer_atomic_*_x2 (OLD-9909) #903
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#903
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/865
Author: @Tortoche
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:feat/rdna2spirv-64bit-atomics📝 Commits (1)
46fc4d4tools/rdna2spirv: native SPIR-V 64-bit atomics for global_atomic_x2 and buffer_atomic_x2📊 Changes
6 files changed (+268 additions, -89 deletions)
View changed files
📝
docs/design.md(+3 -3)📝
tests/semantic/spirv_mini_interp.py(+30 -13)📝
tests/semantic/test_buffer_atomics_x2.py(+59 -12)📝
tests/semantic/test_global_atomics.py(+1 -1)📝
tests/semantic/test_global_atomics_x2.py(+67 -12)📝
tools/rdna2spirv.py(+108 -48)📄 Description
Claimed in the coordination issue as: OLD-9909 / SHADER-64BIT-ATOMICS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134973876)
Completes and supersedes draft #174 (old-pr/9909).
What and why
Previously,
global_atomic_add_x2/sub_x2andbuffer_atomic_add_x2/sub_x2were rejected asUnsupported, while bitwise buffer atomics (and, or, xor, swap) were lowered as independent 32-bit dwords with known tearing approximations.This PR provides full native SPIR-V 64-bit atomic support for all 11 operations on both global and buffer memory:
global_atomic_*_x2:add,sub,smin,smax,umin,umax,and,or,xor,swap, andcmpswapbuffer_atomic_*_x2:add,sub,smin,smax,umin,umax,and,or,xor,swap, andcmpswapKey details:
OpAtomicIAdd,OpAtomicISub,OpAtomicUMin,OpAtomicUMax,OpAtomicSMin,OpAtomicSMax,OpAtomicAnd,OpAtomicOr,OpAtomicXor,OpAtomicExchange,OpAtomicCompareExchange) targetingPhysicalStorageBuffer%ulongand%long.OpCapability Int64Atomicswhenever 64-bit atomics are used, and decorates%rt_ulong/%rt_longwithArrayStride 8.cmpswap_x2:{DATA[63:0], CMP[63:0]}as specified by AMD ISA.fixed_fmt=62).spirv_mini_interp.pywith 64-bit PSB atomic read/modify/writeback emulation.tests/semantic/test_global_atomics_x2.pyandtests/semantic/test_buffer_atomics_x2.py(value verification, cmpswap match/mismatch, unaligned address handling, and rejected invalid forms).docs/design.md.Tested
scripts/check_no_game_data.py: Clean (0 violations).python -I tests/semantic/test_global_atomics_x2.py: 6/6 passed.python -I tests/semantic/test_buffer_atomics_x2.py: 7/7 passed.python -I tests/semantic/test_global_atomics.py: 12/12 passed.spirv-asand validated withspirv-val: 0 errors.newline="\n").AI-assisted: yes.
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.