Repository navigation
rdna2spirv: global_atomic_csub and buffer_atomic_csub - #3193
Conversation
|
Measured on gfx1036 (RDNA2, driver 26.10.1, game MODE; integer atomics): |
f46d08d to
068d5b0
Compare
|
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). |
068d5b0 to
9437193
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 9437193 on Windows 11, Python 3.12.10 (CPU/semantic check only, no GPU, no game files): pass.
AI-assisted review (Gemini). |
|
Tested
|
|
Thanks @DenRakEiw and @raxjinn, including the red control (111 errors with the translator change reverted). Both ran the current head |
|
Tested 9437193 merged with main d974c88 on native Windows (Python 3.13.1, llvm-mc 23.1.6) and with main 98fa503 on Linux (Python 3.12.16): pass. tests/semantic/test_atomic_csub.py, test_value_semantics.py and the rdna2spirv and shader_checks tests: Windows 8/8, Linux 12/12. Negative control with main's tools/rdna2spirv.py: test_atomic_csub fails (111 errors). |
# Conflicts: # docs/design.md
|
Tested 3a36b59 (head includes the latest main merge) on two Vulkan devices, Windows 11, Vulkan SDK 1.4.363, llvm-mc 23.1.6 (AMDGPU, LLVM-MinGW build):
AI-assisted. No game files. |
# Conflicts: # tools/rdna2spirv.py
|
Tested Verified both Sixteen odd lanes contended on one word. For each dispatch I compared their returned old values as a multiset against 16 serial unsigned saturating subtractions. I also checked the final word, inactive lane outputs and surrounding guard words. With operand 3, initial values 100, 48, 47 and 0 finished at 52, 0, 0 and 0 respectively. Both forms also passed with operands 0x80000000 and zero from initial values 0xffffffff and 0x80000000. AI-assisted verification. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
rdna2spirv: global_atomic_csub and buffer_atomic_csub. Changes docs/design.md and tests/semantic/test_atomic_csub.py (plus 1 more). globalatomiccsub and bufferatomiccsub (GFX10.3) raised Unsupported.
New tests: test_reference, test_global_values, test_global_without_glc_keeps_vdst, test_buffer_values_and_bounds.
Why merge
Addresses a concrete failure mode with a focused, scoped change and regression coverage. The patch stays within the affected code path, so it is low risk and prevents bad output or failures in real use.
Verdict: Approve
Summaryrdna2spirv: global_atomic_csub and buffer_atomic_csub. Changes Why mergeAddresses a concrete failure mode with a focused, scoped change and regression coverage. The patch stays within the affected code path, so it is low risk and prevents bad output or failures in real use. Verdict: Approve |
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.