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

Open
opened 2026-11-26 20:21:03 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1352
Author: @klikso
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: test/lds-fixture-order


📝 Commits (1)

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

📊 Changes

9 files changed (+47 additions, -0 deletions)

View changed files

📝 runtime/test/shaders/cs_lds_atomics_ext.asm (+12 -0)
📝 runtime/test/shaders/cs_lds_b64_cmpst.asm (+5 -0)
📝 runtime/test/shaders/cs_lds_xchg64_ext.asm (+10 -0)
📝 runtime/test/shaders/cs_w32_fcmpswap.asm (+6 -0)
📝 runtime/test/shaders/cs_w32_misc_ext.asm (+2 -0)
📝 runtime/test/shaders/cs_w32_new_ops.asm (+2 -0)
📝 tests/semantic/fixtures/disasm/cs_w32_fcmpswap.s (+6 -0)
📝 tests/semantic/fixtures/disasm/cs_w32_misc_ext.s (+2 -0)
📝 tests/semantic/fixtures/disasm/cs_w32_new_ops.s (+2 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1352 **Author:** [@klikso](https://github.com/klikso) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test/lds-fixture-order` --- ### 📝 Commits (1) - [`ffb9ff0`](https://github.com/ubiquitarianism/leonida/commit/ffb9ff07e2d3eebcd7e03cd46223fd314517f09e) tests: the LDS GPU fixtures order plain and atomic accesses (TEST-LDS-FIXTURE-ORDER) ### 📊 Changes **9 files changed** (+47 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/shaders/cs_lds_atomics_ext.asm` (+12 -0) 📝 `runtime/test/shaders/cs_lds_b64_cmpst.asm` (+5 -0) 📝 `runtime/test/shaders/cs_lds_xchg64_ext.asm` (+10 -0) 📝 `runtime/test/shaders/cs_w32_fcmpswap.asm` (+6 -0) 📝 `runtime/test/shaders/cs_w32_misc_ext.asm` (+2 -0) 📝 `runtime/test/shaders/cs_w32_new_ops.asm` (+2 -0) 📝 `tests/semantic/fixtures/disasm/cs_w32_fcmpswap.s` (+6 -0) 📝 `tests/semantic/fixtures/disasm/cs_w32_misc_ext.s` (+2 -0) 📝 `tests/semantic/fixtures/disasm/cs_w32_new_ops.s` (+2 -0) </details> ### 📄 Description Claimed in the coordination issue as: TEST-LDS-FIXTURE-ORDER ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145547424)) ### 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://github.com/ubiquitarianism/leonida/pull/1352#issuecomment-7154963106)). 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1381
No description provided.