tests: the LDS GPU fixtures order plain and atomic accesses (TEST-LDS-FIXTURE-ORDER) #1352

Open
github-bot wants to merge 1 commit from github-bot/gh-1352 into main AGit
Owner

@⁠klikso on GitHub · 2026-11-24 22:16 UTC · original
klikso:test/lds-fixture-order → main · +47 −0 · 9 files · 1 commits · open

Claimed in the coordination issue as: TEST-LDS-FIXTURE-ORDER (claim)

What and why

Six compute fixtures return the expected words but print a shared-memory data race under GPU-assisted validation, so a validated run of run_gpu_tests.py is never clean and a real race in the translator would not stand out. They are what is left of the list @⁠natterman12 posted after #382: #412 fixed cs_w32_lds_subdword, #1309 fixed cs_w32_lds_wide, #481 has cs_pk_mul_lo_const. This does the rest the same way, in the fixtures only.

cs_lds_atomics_ext, cs_lds_b64_cmpst, cs_lds_xchg64_ext, cs_w32_fcmpswap, cs_w32_misc_ext and cs_w32_new_ops already run on lane 0 alone. They seed a word with ds_write, change it with an atomic op and read it back with ds_read, and the layer reports the plain access next to the atomic one (RaceOnLoadStoreVsAtomic). An s_barrier now separates each run of plain LDS accesses (ds_read*, ds_write*) from each run of atomic ones. It goes after the s_waitcnt lgkmcnt(0) that ends the earlier run; one place in cs_lds_b64_cmpst had no wait between a read and the next ds_cmpst_b32 and gets one.

No instruction that computes a result changes, and neither do the expected words. Where a fixture's words were measured on hardware, the listing measured there differs from this one by those barriers; I have no RDNA2 hardware to run them on again. The three fixtures that have a checked-in listing are regenerated with tests/semantic/regen_fixtures.py.

This pull request first also moved the lane-0 mask in cs_w32_lds_wide. #1309 landed that on main, so the rebase dropped it here.

Tested

Windows 11 26200.9974, RTX 3060 Ti (driver 621.14, 32-wide subgroups), main 3f81d46ac, test programs built from it with MSVC 19.44, llvm-mc 23.1.6, SPIRV-Tools v2026.4, VK_LAYER_KHRONOS_validation 1.4.357 loaded through VK_INSTANCE_LAYERS with VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1. The branch is main 3f81d46ac plus this one commit.

Validation errors per fixture, the same natively and with LEONIDA_W64_EMULATE=1:

Fixture main this branch s_barrier added
cs_w32_misc_ext 1 RaceOnLoadStoreVsAtomic 0 2
cs_w32_new_ops 1 0 2
cs_lds_b64_cmpst 1 0 4
cs_w32_fcmpswap 1 0 6
cs_lds_xchg64_ext 1 0 10
cs_lds_atomics_ext 1 0 12

All six print the same eight words before and after, in both modes.

Whole suite, run_gpu_tests.py with the layer loaded for every test program (284 runs):

main this branch
native 209/263 passed, 53 skipped, 1 failed; 7 fixtures print a validation error the same results; 1 fixture
LEONIDA_W64_EMULATE=1 243/263 passed, 19 skipped, 1 failed; 7 fixtures the same results; 1 fixture

The one failure is cs_imgatomic_ext, in both trees and both modes; on main it fails without the layer too (#1518 addresses it). The one fixture left with a validation error is cs_pk_mul_lo_const (#481).

  • tests/semantic/regen_fixtures.py --check: clean.
  • The three test files that name these fixtures: 13 passed.
  • Before the rebase, on 4a50cafc7: scripts/run_semantic_tests.py tests/semantic 471 files, 6177 tests, 1 file failed, test_image_cube_store_glc (LlvmMcRoundTrip), which failed the same way on main on this host. Not rerun after the rebase; the change since is the dropped fixture.
  • python -I scripts/check_no_game_data.py on the 9 changed files: no hits. git diff --check: clean.

GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Vulkan 1.4.357, Windows 11 26200. @⁠Gefik23 ran the earlier head on an RTX 4060 (comment).

AI-assisted: yes (Claude Code; run and measured on the machine above)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed: n/a (fixtures only, no translator change).

🤖 Generated with Claude Code

**@⁠klikso** on GitHub · 2026-11-24 22:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1352) `klikso:test/lds-fixture-order` → `main` · +47 −0 · 9 files · 1 commits · open Claimed in the coordination issue as: TEST-LDS-FIXTURE-ORDER ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### What and why Six compute fixtures return the expected words but print a shared-memory data race under GPU-assisted validation, so a validated run of `run_gpu_tests.py` is never clean and a real race in the translator would not stand out. They are what is left of the list @⁠natterman12 posted after #382: #412 fixed `cs_w32_lds_subdword`, #1309 fixed `cs_w32_lds_wide`, #481 has `cs_pk_mul_lo_const`. This does the rest the same way, in the fixtures only. `cs_lds_atomics_ext`, `cs_lds_b64_cmpst`, `cs_lds_xchg64_ext`, `cs_w32_fcmpswap`, `cs_w32_misc_ext` and `cs_w32_new_ops` already run on lane 0 alone. They seed a word with `ds_write`, change it with an atomic op and read it back with `ds_read`, and the layer reports the plain access next to the atomic one (`RaceOnLoadStoreVsAtomic`). An `s_barrier` now separates each run of plain LDS accesses (`ds_read*`, `ds_write*`) from each run of atomic ones. It goes after the `s_waitcnt lgkmcnt(0)` that ends the earlier run; one place in `cs_lds_b64_cmpst` had no wait between a read and the next `ds_cmpst_b32` and gets one. No instruction that computes a result changes, and neither do the expected words. Where a fixture's words were measured on hardware, the listing measured there differs from this one by those barriers; I have no RDNA2 hardware to run them on again. The three fixtures that have a checked-in listing are regenerated with `tests/semantic/regen_fixtures.py`. This pull request first also moved the lane-0 mask in `cs_w32_lds_wide`. #1309 landed that on `main`, so the rebase dropped it here. ### Tested Windows 11 26200.9974, RTX 3060 Ti (driver 621.14, 32-wide subgroups), `main` `3f81d46ac`, test programs built from it with MSVC 19.44, `llvm-mc` 23.1.6, SPIRV-Tools v2026.4, `VK_LAYER_KHRONOS_validation` 1.4.357 loaded through `VK_INSTANCE_LAYERS` with `VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1`. The branch is `main` `3f81d46ac` plus this one commit. Validation errors per fixture, the same natively and with `LEONIDA_W64_EMULATE=1`: | Fixture | `main` | this branch | `s_barrier` added | |---|---|---|---| | `cs_w32_misc_ext` | 1 `RaceOnLoadStoreVsAtomic` | 0 | 2 | | `cs_w32_new_ops` | 1 | 0 | 2 | | `cs_lds_b64_cmpst` | 1 | 0 | 4 | | `cs_w32_fcmpswap` | 1 | 0 | 6 | | `cs_lds_xchg64_ext` | 1 | 0 | 10 | | `cs_lds_atomics_ext` | 1 | 0 | 12 | All six print the same eight words before and after, in both modes. Whole suite, `run_gpu_tests.py` with the layer loaded for every test program (284 runs): | | `main` | this branch | |---|---|---| | native | 209/263 passed, 53 skipped, 1 failed; 7 fixtures print a validation error | the same results; 1 fixture | | `LEONIDA_W64_EMULATE=1` | 243/263 passed, 19 skipped, 1 failed; 7 fixtures | the same results; 1 fixture | The one failure is `cs_imgatomic_ext`, in both trees and both modes; on `main` it fails without the layer too (#1518 addresses it). The one fixture left with a validation error is `cs_pk_mul_lo_const` (#481). - `tests/semantic/regen_fixtures.py --check`: clean. - The three test files that name these fixtures: 13 passed. - Before the rebase, on `4a50cafc7`: `scripts/run_semantic_tests.py tests/semantic` 471 files, 6177 tests, 1 file failed, `test_image_cube_store_glc` (`LlvmMcRoundTrip`), which failed the same way on `main` on this host. Not rerun after the rebase; the change since is the dropped fixture. - `python -I scripts/check_no_game_data.py` on the 9 changed files: no hits. `git diff --check`: clean. GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Vulkan 1.4.357, Windows 11 26200. @⁠Gefik23 ran the earlier head on an RTX 4060 ([comment](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1352)). AI-assisted: yes (Claude Code; run and measured on the machine above) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed: n/a (fixtures only, no translator change). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Six compute fixtures printed a shared-memory data race under GPU-assisted
validation while returning the expected words: cs_lds_atomics_ext,
cs_lds_b64_cmpst, cs_lds_xchg64_ext, cs_w32_fcmpswap, cs_w32_misc_ext and
cs_w32_new_ops. Lane 0 alone read or wrote a word plainly next to an atomic
access of it. An s_barrier now separates each run of plain LDS accesses
(ds_read*, ds_write*) from each run of atomic ones, after the
s_waitcnt lgkmcnt(0) that ends the earlier run; one place had no wait and
gets one.

The expected words do not change. The three checked-in listings are
regenerated.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:48:25 +00:00
Author
Owner

@⁠Gefik23 on GitHub · 2026-11-25 06:36 UTC · original

Tested dcc36c527 on NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200, native Windows: pass for the fixtures this host can run.

Built at this head with scripts\build_runtime.ps1 (MSVC 19.44, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.0). No llvm-mc here, so run_gpu_tests.py --disasm-dir tests/semantic/fixtures/disasm with LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1, native and with LEONIDA_W64_EMULATE=1. That subset has four of the seven fixtures (cs_w32_fcmpswap, cs_w32_lds_wide, cs_w32_misc_ext, cs_w32_new_ops); the three cs_lds_* ones were not run.

  • Before (main @ 6293c1c, same GPU and settings): those four failed under GPU-AV with 1, 6, 1 and 1 shared-memory race errors.
  • This head: all four PASS with 0 validation errors, natively and emulated, and their eight output words are identical to the earlier run.
  • Remaining errors in the validated run, all outside this PR: cs_pk_mul_lo_const (VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819, #481) in both modes, and 16 wave64 fixtures with 6 errors each under LEONIDA_W64_EMULATE=1 only (the sink-word race #1110 clears).

AI-assisted (Claude Code ran the build and tests). No game files.

**@⁠Gefik23** on GitHub · 2026-11-25 06:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1352#issuecomment-7154963106) Tested dcc36c527 on NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200, native Windows: pass for the fixtures this host can run. Built at this head with `scripts\build_runtime.ps1` (MSVC 19.44, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.0). No llvm-mc here, so `run_gpu_tests.py --disasm-dir tests/semantic/fixtures/disasm` with `LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1`, native and with `LEONIDA_W64_EMULATE=1`. That subset has four of the seven fixtures (`cs_w32_fcmpswap`, `cs_w32_lds_wide`, `cs_w32_misc_ext`, `cs_w32_new_ops`); the three `cs_lds_*` ones were not run. - Before (main @ 6293c1c, same GPU and settings): those four failed under GPU-AV with 1, 6, 1 and 1 shared-memory race errors. - This head: all four PASS with 0 validation errors, natively and emulated, and their eight output words are identical to the earlier run. - Remaining errors in the validated run, all outside this PR: `cs_pk_mul_lo_const` (VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819, #481) in both modes, and 16 wave64 fixtures with 6 errors each under `LEONIDA_W64_EMULATE=1` only (the sink-word race #1110 clears). AI-assisted (Claude Code ran the build and tests). No game files.
Author
Owner

@⁠klikso on GitHub · 2026-11-25 08:16 UTC · original

Rebased onto main 3f81d46ac; the head moved from dcc36c527 to ffb9ff07e. #1309 landed the cs_w32_lds_wide change on main in the meantime, so the rebase took main's version of that fixture and this pull request now covers the six atomic fixtures only (9 files instead of 11). The barriers in those six are unchanged.

Measured again on the new head, RTX 3060 Ti, test programs built from 3f81d46ac: each of the six prints 1 RaceOnLoadStoreVsAtomic on main and 0 on the branch, natively and with LEONIDA_W64_EMULATE=1, with the same eight words. A validated run of the whole suite goes from 7 fixtures with an error to 1 (cs_pk_mul_lo_const, #481) in both modes. The description has the tables. Thanks @⁠Gefik23 for the RTX 4060 run on the earlier head. AI-assisted (Claude Code).

**@⁠klikso** on GitHub · 2026-11-25 08:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1352#issuecomment-7156830119) Rebased onto `main` `3f81d46ac`; the head moved from `dcc36c527` to `ffb9ff07e`. #1309 landed the `cs_w32_lds_wide` change on `main` in the meantime, so the rebase took `main`'s version of that fixture and this pull request now covers the six atomic fixtures only (9 files instead of 11). The barriers in those six are unchanged. Measured again on the new head, RTX 3060 Ti, test programs built from `3f81d46ac`: each of the six prints 1 `RaceOnLoadStoreVsAtomic` on `main` and 0 on the branch, natively and with `LEONIDA_W64_EMULATE=1`, with the same eight words. A validated run of the whole suite goes from 7 fixtures with an error to 1 (`cs_pk_mul_lo_const`, #481) in both modes. The description has the tables. Thanks @⁠Gefik23 for the RTX 4060 run on the earlier head. AI-assisted (Claude Code).
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-25 10:11 UTC · original

Tested ffb9ff07e merged onto main 57ba40bd6 (merges cleanly here), native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060, driver 621.14, VS 2022 RelWithDebInfo + Ninja, llvm-mc 21.1.8 (scripts/build_llvm_mc.ps1), so all six fixtures ran, including the three cs_lds_* ones the earlier RTX 4060 run had no listing for.

With LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1, one fixture per run:

main this PR this PR, LEONIDA_W64_EMULATE=1
each of the six 1 shared-memory data race, FAIL 0 races, PASS 0 races, PASS

Whole suite without validation: 209/263 passed, 53 skipped on both main and the branch; the one failure, cs_imgatomic_ext, is the same on main.

AI-assisted testing (non-developer tester).

**@⁠potatoe0100** on GitHub · 2026-11-25 10:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1352#issuecomment-7159345429) Tested `ffb9ff07e` merged onto `main` `57ba40bd6` (merges cleanly here), native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060, driver 621.14, VS 2022 RelWithDebInfo + Ninja, llvm-mc 21.1.8 (`scripts/build_llvm_mc.ps1`), so all six fixtures ran, including the three `cs_lds_*` ones the earlier RTX 4060 run had no listing for. With `LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1`, one fixture per run: | | `main` | this PR | this PR, `LEONIDA_W64_EMULATE=1` | |---|---|---|---| | each of the six | 1 shared-memory data race, FAIL | 0 races, PASS | 0 races, PASS | Whole suite without validation: 209/263 passed, 53 skipped on both `main` and the branch; the one failure, `cs_imgatomic_ext`, is the same on `main`. AI-assisted testing (non-developer tester).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1352/head:github-bot/gh-1352'
git switch 'github-bot/gh-1352'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1352'
git switch 'github-bot/gh-1352'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1352'
git switch 'github-bot/gh-1352'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1352'
git switch 'main'
git merge --squash 'github-bot/gh-1352'
git switch 'main'
git merge --ff-only 'github-bot/gh-1352'
git switch 'main'
git merge 'github-bot/gh-1352'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.