Skip to content

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

Open
klikso wants to merge 1 commit into
ProjectLeonida:mainfrom
klikso:test/lds-fixture-order
Open

klikso wants to merge 1 commit into
ProjectLeonida:mainfrom
klikso:test/lds-fixture-order

Conversation

@klikso

@klikso klikso commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

@Gefik23

Gefik23 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Tested dcc36c5 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.

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

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
…-FIXTURE-ORDER)

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 <noreply@anthropic.com>
@klikso
klikso force-pushed the test/lds-fixture-order branch from dcc36c5 to ffb9ff0 Compare November 25, 2026 08:01
@klikso

klikso commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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).

@potatoe0100

Copy link
Copy Markdown
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants