Repository navigation
rdna2spirv: add --int64-atomics option for 64-bit OpAtomicExchange on *_atomic_swap_x2 (SHADER-868) - #251
Conversation
|
I tested this on a GPU. The 64-bit path works, and it fixes a real tearing problem. Some suggestions to help it land are at the end. Hardware: Intel Meteor Lake graphics (ANV, Mesa 26.2.7, Fedora 45, 1. Single thread, exact. This is a temporary variant of 2. Contention. Here 40 groups × 64 threads each swap
On RDNA2 these instructions are single 64-bit atomics, so the returned old value never tears. Two 32-bit atomics per element (what The contention fixture (hand-written, no game data). It replaces
|
|
Not merging yet. This adds an opt-in feature rather than fixing a bug, and
|
06de9fe to
a48dc6e
Compare
|
Tested a48dc6e on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, regression check Runtime built at this head with
|
a48dc6e to
8435a80
Compare
|
Updated per feedback and rebased cleanly onto current
|
|
I ran
The 64-bit path does fix tearing. I used Mouad-Scriptz-0's contention test: 2,560 threads swapping
No regressions.
Still open from Mouad-Scriptz-0's review: the claim in #14, Two more points:
AI-assisted (Claude Code, Claude Opus 5.5). |
8435a80 to
14eaf60
Compare
|
@aslan2142 @Mouad-Scriptz-0 Updated in commit
|
… *_atomic_swap_x2 (SHADER-868)
14eaf60 to
2d0a082
Compare
|
Rebased on current ubi/main (3f81d46) and pushed. Conflicts resolved against the newer main changes; test suite for the touched area passes locally (xs_proxy_mock_test PASS on Windows; the int64-atomics semantic tests 6/6 and test_rdna2_decode 21/21 where applicable). AI-assisted: yes |
Claimed in the coordination issue as: SHADER-868 (#14 (comment))
What and why
ds_wrxchg_rtn_b64is untouched).--int64-atomicsflag forwarding inmake_game.py(FALLBACK_FLAGSand CLI parser) alongsidetools/rdna2spirv.pyandruntime/test/shaders/build.py(LEONIDA_INT64_ATOMICS=1).Global atomicsandbuffer_atomic_{and,or,xor,swap}_x2rows indocs/design.mdto document opt-in--int64-atomicsvs the default 32-bit dword-pair approximation.runtime/test/shaders/cs_atomic_swap_x2_int64.asm, registered it inruntime/test/shaders/check.py,scripts/run_gpu_tests.py, andtests/semantic/regen_fixtures.py(tests/semantic/fixtures/disasm/cs_atomic_swap_x2_int64.s).14eaf6052: enabledshaderBufferInt64AtomicsonVkPhysicalDeviceVulkan12Featuresinruntime/shims/d3d12_vulkan_device.cpp(recorded inruntime/shims/d3d12_com.h, asserted inruntime/test/d3d12_vulkan_device_test.cpp), replaced the single-threadcs_atomic_swap_x2_int64.asmfixture with a 64-thread tearing check, and added dedicated--int64-atomicsrunner pass inscripts/run_gpu_tests.py.Tested
On commit
14eaf6052:python -I tests/semantic/regen_fixtures.py --check(OK)python -I tests/semantic/test_atomic_swap_x2_int64.py(6/6 OKviaspirv_mini_interp.run_workgroup, 64 threads + 14= OpAtomicExchange %ulong)tests/semantic/test_fixtures.py&tests/semantic/test_regen_fixtures.py(OK)tests/test_docs_*.py(OK)compileall(OK)/W4compile-check ofruntime/shims/d3d12_vulkan_device.cpp&runtime/test/d3d12_vulkan_device_test.cpp(OK)GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.