Repository navigation
rdna2spirv: global_atomic_csub and buffer_atomic_csub - #3193
LouisRiverstone wants to merge 1 commit into
Conversation
|
Measured on gfx1036 (RDNA2, driver 26.10.1, game MODE; integer atomics): |
f46d08d to
068d5b0
Compare
Both raised Unsupported. csub (GFX10.3) stores (DATA > M) ? 0 : M - DATA, an unsigned subtract clamped at 0 (measured on gfx1036 by Vonsek in ItsNotRexed#3193); it goes through main's inc/dec CAS loop (atomic_inc_dec_cas), exact under contention. tests/semantic/test_atomic_csub.py: value grid, no glc, buffer bounds, 32 lanes on one dword, seeded values. docs/design.md row added.
|
Tested Translated All 14 dispatches matched (448 returned words), and the 95 guard dwords in each readback stayed intact. Starting at 100 and subtracting 3 finished at 4; starting at 50 reached zero partway through. The cases also included zero data, an initially zero dword, equality at 0x80000000, and subtracting 0x80000000 from 0xffffffff. All six translated compute modules passed Vulkan 1.2 SPIR-V validation. This covers in-range accesses with all lanes active. AI-assisted verification. |
|
Tested
Synthetic fixtures only, no game data. AI-assisted (Claude Code). |
global_atomic_csubandbuffer_atomic_csub(GFX10.3) raisedUnsupported.Semantics:
tmp = M; M = (DATA > tmp) ? 0 : tmp - DATA. It's an unsigned subtract clamped at 0 that never wraps. Withglc, the old M comes back. @Vonsek measured this on gfx1036 (comment below): 162/162 (memory, data) pairs over both forms.Implementation: a
csubcase inmain'sGen.atomic_inc_dec_cas(from #2448), pluscsubin theis_inc_decrouting ofglobal_atomicandbuffer_atomic. That's 10 lines intools/rdna2spirv.py.glc: as forinc/dec.Tests:
tests/semantic/test_atomic_csub.py:glc(vdstkept)Without the change the file fails (111 errors); with it, 6/6 pass.
python -I -m unittest discover -s tests/semantic: 10 failures, the same onesmainhas without this change (test_loop_ballot_barrier,test_vcmp16_opsel,test_cmp_class_f64,test_mutations). None are in the atomics tests.docs/design.md: new row after "Global atomics".Previously stacked on my #3097, which I closed as a duplicate of #2448. Now rebuilt on
main.The translation is tested on CPU only; no GPU run. No game files. Claimed on #3047 before starting.
AI-assisted (Claude Code): I reviewed and ran the change and the tests.