Repository navigation
tests/semantic: run LDS atomics in the interpreter, and value-test them - #812
Merged
ItsNotRexed merged 2 commits intoNov 22, 2026
Merged
Conversation
spirv_mini_interp ran 32-bit atomics on physical-storage-buffer pointers only, so the LDS atomics the translator emits (ds_add/sub/min/max/and/or/xor, ds_wrxchg_rtn_b32, ds_cmpst_rtn_b32) had no value test. With one invocation an atomic is read-combine-write on any pointer, so it now also takes the variable-element pointers OpLoad/OpStore use (Workgroup = LDS since ItsNotRexed#592, Function); push constants stay read-only. tests/semantic/test_lds_atomics_values.py runs compute listings as one invocation and checks the returned and stored words against a plain-Python model of each RDNA2 DS atomic.
This was referenced Nov 22, 2026
ItsNotRexed
added a commit
that referenced
this pull request
Nov 22, 2026
quackottu
reviewed
Nov 22, 2026
quackottu
left a comment
Contributor
There was a problem hiding this comment.
Tested e6e7ceb on NVIDIA GeForce RTX 5070 (subgroup 32), driver 621.24, Windows 11 Pro (26300), Vulkan SDK 1.4.363.0, llvm-mc 21.1.8 (built with scripts/build_llvm_mc.ps1), scripts/run_gpu_tests.py:
- native: 71/98 passed, 27 skipped (
main8df277f here: 64/91 passed, 27 skipped, all wave64 tests needing a 64-wide subgroup) LEONIDA_W64_EMULATE=1: 98/98 passed (mainhere: 91/91)python -m unittest discover -s tests/semantic: Ran 980 tests in 224.316s OK
|
Tested e6e7ceb on two GPUs, Linux 7.3.5 (CachyOS): pass.
|
This was referenced Nov 22, 2026
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.
Depended on #592, which is now merged; the branch is up to date with
main, so the diff is this PR's change only.tests/semantic/spirv_mini_interp.pyruns 32-bit atomics only on physical-storage-buffer pointers. So the LDS atomics thattools/rdna2spirv.pyalready emits have no value test:ds_add_u32,ds_sub_u32ds_min_u32,ds_max_u32,ds_min_i32,ds_max_i32ds_and_b32,ds_or_b32,ds_xor_b32_rtn_forms, plusds_wrxchg_rtn_b32andds_cmpst_rtn_b32test_lds_atomic_add.pymodelsOpAtomicIAddin its own small interpreter. Claimed in #634.Change
tests/semantic/spirv_mini_interp.py:OpLoad/OpStoreuse: Workgroup, which is LDS since Translator: ds_read_u8/i8_d16[_hi] 8-bit LDS reads into a 16-bit half (SHADER-85) #592, and Function. The PSB path is unchanged.tests/semantic/test_lds_atomics_values.py(new, stdlibunittest):_rtn_kinds on a 7×4 grid of edge values, including the signed/unsigned min/max split at0x80000000.ds_wrxchg_rtn_b32, andds_cmpst_rtn_b32with both a match and a mismatch (data0 is the comparator, data1 the value written).offset:reaches the same dword, plus 20 seeded cases.No translator change. All of these already matched the RDNA2 definitions; nothing checked their values before.
Tested
python -I -m unittest discover -s tests/semantic: all pass. Without the interpreter change, the new file has 307 errors (UnsupportedConstruct: Op… outside PhysicalStorageBuffer).python -I tests/test_lds_fuzz.pyandpython -I tests/test_mem_diff.pypass.compileallpasses. CPU only, no game files.AI-assisted (Claude Code): it wrote the change and the tests, and ran the checks listed above.