Repository navigation
Conversation
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.
# Conflicts: # runtime/test/shaders/check.py # scripts/run_gpu_tests.py # tests/semantic/regen_fixtures.py
…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.
# Conflicts: # runtime/test/shaders/check.py # scripts/run_gpu_tests.py # tests/semantic/regen_fixtures.py
# Conflicts: # runtime/test/shaders/check.py # scripts/run_gpu_tests.py # tests/semantic/regen_fixtures.py
# Conflicts: # runtime/test/shaders/check.py # scripts/run_gpu_tests.py
This was referenced Nov 24, 2026
Contributor
|
Tested on Linux, merged onto GPU: NVIDIA GeForce RTX 2070 SUPER (Turing, subgroup 32), proprietary driver 620.70.06, Fedora 44, llvm-mc 22.1.8, SPIRV-Tools 2026.1.
New fixture The only failures in both runs are the known AI-assisted: yes (Claude Code ran the build and tests on my machine; numbers are the runners' own output). |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):buffer_atomic_inc/dec(#2448) areOpAtomicCompareExchangeloops. Their tests run them in one lane, or in the CPU interpreter, which runs lanes in lockstep.@TheMrBeezchecked the loops under contention by hand on#3097, but nothing in the suite does. This GPU fixture,runtime/test/shaders/cs_w32_atomic_contend.asm, has all 32 lanes of a wave32 group run every op on the same dwords, so the loops race for real on a GPU.Re-submission of
#4331.#4331was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with currentmain.Checked on
#4331by: theswiss24 (two NVIDIA GPUs), vibryxcx (RX 6800), radv-tinker (AMD Radeon RX 9070 XT), javdc (Steam Deck LCD), sovljanskii (Apple M4), nicknickalive (RTX 5090), Mortify7612 (AMD Radeon RX 9060 XT), Itschotsch (RTX 4090), lukasas74 (RTX 5080), YordiLorenzo (RTX 5090), matheusfermiano-source (main 867d922)), nicolasabosch (RTX 4070 Laptop GPU).No game files.
AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with
main.