Repository navigation
tests: GPU fixture cs_w32_atomic_contend for buffer_atomic_inc/dec contention (OLD-9912) - #868
TanmaySatyam wants to merge 3 commits into
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Audited and verified. Adds synthetic GPU test fixture cs_w32_atomic_contend.asm and companion software unit test ests/semantic/test_atomic_contend_fixture.py testing �uffer_atomic_inc/dec compare-exchange loops under 32-lane hardware contention with power-of-two checksum validation for lost updates. Clean-room compliant with zero game data. Approved.
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Clean-Room Audit & Shader Verification — PR #868 (OLD-9912)
High-concurrency atomic contention validation.
Technical Verification
- Contention Loops:
- Tests
buffer_atomic_incandbuffer_atomic_decwith all 32 lanes contending on a single buffer offset, verifying that CAS loops guarantee zero lost updates. - Verified clean-room synthetic assembly.
- Tests
Verdict: APPROVED
|
Tested b61deca on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: pass Built at this head with
|
All 32 lanes of a wave32 group run each op on the same dwords, so the translated CAS loops race for real on a GPU (the CPU interpreter runs lanes in lockstep). Same op on every lane: the final words are order-independent, including inc/dec wrapping at a small D. Each lane adds 1 << (old - fill) into another word, so a lost or doubled update changes the sum; umax/umin of the returned values check the extremes. Registered in check.py, run_gpu_tests.py and regen_fixtures.py; tests/semantic/ test_atomic_contend_fixture.py runs it on the CPU against 32 sequential ops.
python -I on the file failed with ModuleNotFoundError: support, as the folder was not on sys.path (found by @justr4mzi on #4323, the same template). It is now inserted, as test_cs_shared_memory_limit does.
…give the same word @sovljanskii on #4331: with 32 ops and D = 20, inc ends at 31 mod 21 = 10 and dec at 20 - (31 mod 21) = 10, so swapping buffer_atomic_inc v8 for a dec still passed on the GPU (D = 2, 6 and 8 coincide the same way). With D = 19 inc gives 31 mod 20 = 11 (0xB) and dec would give 8. Fixture, header, both expected-word lists and the CPU reference updated; the test now also checks that inc and dec differ at that D. llvmpipe: PASS with 11 in word 2.
b61deca to
34005bd
Compare
|
GPU test on an NVIDIA Ada card, for the record: this passes on an RTX 4090.
Only the filtered fixture(s) were run for this PR, not the full suite or ctest; the full-suite baseline for this card on |
|
Hi @TanmaySatyam, thanks for this pull request. It currently conflicts with AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: OLD-9912
Summary
Carries forward
old-pr/9912(carried-over draft #178) onto currentmain(f3e26be7c), preserving the original author's (Luiz Neves) three commits:GPU test cs_w32_atomic_contend: buffer_atomic_inc/dec under contentiontest_atomic_contend_fixture: runs under python -Ics_w32_atomic_contend: word 2 uses D = 19, so an inc and a dec can't give the same wordRebase adjustments
runtime/test/shaders/check.pyandscripts/run_gpu_tests.pyagainst currentmain.main's dynamictests/semantic/regen_fixtures.pyand added the; regen_fixtures: this source has a translator fixture in tests/semantic/fixtures/disasmmarker line toruntime/test/shaders/cs_w32_atomic_contend.asm.Testing & Hardware Verification
python -I scripts/check_no_game_data.pyclean on all touched files).LEONIDA_VK_VALIDATION=1,VKC_SUBGROUP_SIZE=32).runtime/test/shaders/build.py+vk_compute_test.exe cs_w32_atomic_contend.spv 1 dump):[0xEEEEEF0E, 0xEEEEEEED, 0xB, 0xEEEEEECE, 0x4, 0xEEEEEF0D, 0xEEEEEECF, 0xEEEEEEED]under real 32-lane hardware CAS contention with 0 mismatches and 0 Vulkan validation errors.python -I tests/semantic/test_atomic_contend_fixture.py -v: 4/4 OKpython -I tests/test_regen_fixtures.py: 7/7 OKpython -I tests/test_text_write_line_endings.py: 3/3 OK