TEST-LDS-CMPST-WAIT: wait for the last LDS read in cs_lds_b64_cmpst #1026

Closed
github-bot wants to merge 1 commit from gh-pr/1026/head into gh-pr/1026/base
Owner

@⁠yawn-animals on GitHub · 2026-11-24 17:01 UTC · original
test-lds-cmpst-wait → main · +1 −0 · 1 files · 1 commits · closed without merging

Claimed in the coordination issue as: TEST-LDS-CMPST-WAIT (claim).

What and why

runtime/test/shaders/cs_lds_b64_cmpst.asm reads v11 with ds_read_b32 and uses it in the very next instruction, v_xor_b32_e32 v16, v10, v11, with no s_waitcnt lgkmcnt(0) in between.

  • Translated: the SPIR-V has no such race, so the GPU suite passes.
  • Native: the fixture's header derives its words from the RDNA2 ISA, so it should also be valid as native code. On real RDNA2 the v_xor reads v11 before the LDS load returns, using the stale value from the ds_write2st64_b64 block. Word 7 becomes 0x2468ABCD ^ 0x22220002 = 0x064AABCF instead of 0x3579BADC.

This adds the one missing wait. The expected output and the translator are unchanged. A scan of the fixture found no other LDS read result used before a wait.

Tested

RX 6800 XT (gfx1030), Arch Linux, kernel 7.3.4, Mesa 26.3.1. This repository's main is fce586c. The fixture blob is 0998d857 before and 400ff65c after, identical to LeonidaReforge's before and after (LeonidaReforge/Leonida#166).

before (main) after (this PR)
native, this tree's tools/hw_oracle (Linux DRM launcher), the fixture body as a raw kernel* word 7 0x064aabcf, DIFF 0x3579badc, MATCH (all 8 words)
translated, this tree's scripts/run_gpu_tests.py --filter cs_lds_b64_cmpst --require-pass on RADV PASS, … 0xbbbb000b 0x3579badc PASS, same words

* The only change for the raw-kernel ABI is the output store: buffer_store_dword … s[0:3] … offen is respelled as global_store_dword … s[2:3].

  • Other checks: python -I tests/test_shader_checks.py OK. The kernel log shows 0 ring timeouts and 0 page faults.
  • Translator interpreter: @⁠akimfomin ran both versions through this repository's translator and CPU interpreter, with identical listings and all eight expected words (PortBridge PB-0019).
  • Not covered: other GPUs and the Windows launcher.

AI-assisted. Synthetic fixture only.

🤖 Generated with Claude Code

**@⁠yawn-animals** on GitHub · 2026-11-24 17:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1026) `test-lds-cmpst-wait` → `main` · +1 −0 · 1 files · 1 commits · closed without merging Claimed in the coordination issue as: TEST-LDS-CMPST-WAIT ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). ### What and why `runtime/test/shaders/cs_lds_b64_cmpst.asm` reads `v11` with `ds_read_b32` and uses it in the very next instruction, `v_xor_b32_e32 v16, v10, v11`, with no `s_waitcnt lgkmcnt(0)` in between. - **Translated:** the SPIR-V has no such race, so the GPU suite passes. - **Native:** the fixture's header derives its words from the RDNA2 ISA, so it should also be valid as native code. On real RDNA2 the `v_xor` reads `v11` before the LDS load returns, using the stale value from the `ds_write2st64_b64` block. Word 7 becomes `0x2468ABCD ^ 0x22220002 = 0x064AABCF` instead of `0x3579BADC`. This adds the one missing wait. The expected output and the translator are unchanged. A scan of the fixture found no other LDS read result used before a wait. ### Tested RX 6800 XT (gfx1030), Arch Linux, kernel 7.3.4, Mesa 26.3.1. This repository's `main` is `fce586c`. The fixture blob is `0998d857` before and `400ff65c` after, identical to LeonidaReforge's before and after (LeonidaReforge/Leonida#166). | | before (`main`) | after (this PR) | |---|---|---| | native, this tree's `tools/hw_oracle` (Linux DRM launcher), the fixture body as a raw kernel* | word 7 `0x064aabcf`, DIFF | `0x3579badc`, MATCH (all 8 words) | | translated, this tree's `scripts/run_gpu_tests.py --filter cs_lds_b64_cmpst --require-pass` on RADV | PASS, `… 0xbbbb000b 0x3579badc` | PASS, same words | \* The only change for the raw-kernel ABI is the output store: `buffer_store_dword … s[0:3] … offen` is respelled as `global_store_dword … s[2:3]`. - **Other checks:** `python -I tests/test_shader_checks.py` OK. The kernel log shows 0 ring timeouts and 0 page faults. - **Translator interpreter:** @⁠akimfomin ran both versions through this repository's translator and CPU interpreter, with identical listings and all eight expected words ([PortBridge PB-0019](https://akimfomin.github.io/PortBridge/cases/pb-0019.html)). - **Not covered:** other GPUs and the Windows launcher. AI-assisted. Synthetic fixture only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The fixture read v11 with ds_read_b32 and used it in the next
instruction without s_waitcnt lgkmcnt(0). Translated SPIR-V has no such
race, so the GPU suite passed, but run natively (its words are derived
from the RDNA2 ISA) the v_xor read v11's stale value: word 7 was
0x064aabcf on gfx1030 instead of 0x3579badc. Add the wait; the expected
output and the translator are unchanged.

Same fix as LeonidaReforge/Leonida#166 (identical file before and after).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:34:07 +00:00
github-bot closed this pull request 2026-11-26 09:34:07 +00:00
Author
Owner

@⁠morodirule on GitHub · 2026-11-24 17:06 UTC · original

Independent Linux/RTX 4070 check (NVIDIA 620.70.06, Vulkan 1.4.357, no game files): cs_lds_b64_cmpst from head 40a2b1c6b builds clean (1 translated, spirv-val pass) and vk_compute_test reports "1 groups x 64: 0 mismatches", exit 0, with word 7 = 897170140 (0x3579BADC) as expected — translated output unchanged by the added wait, as claimed. The native RDNA race itself is not re-tested here (needs gfx1030). Not claiming; review evidence.

**@⁠morodirule** on GitHub · 2026-11-24 17:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1026#issuecomment-7138695955) Independent Linux/RTX 4070 check (NVIDIA 620.70.06, Vulkan 1.4.357, no game files): cs_lds_b64_cmpst from head 40a2b1c6b builds clean (1 translated, spirv-val pass) and vk_compute_test reports "1 groups x 64: 0 mismatches", exit 0, with word 7 = 897170140 (0x3579BADC) as expected — translated output unchanged by the added wait, as claimed. The native RDNA race itself is not re-tested here (needs gfx1030). Not claiming; review evidence.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.