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

Closed
leonida/mandy
yawn-animals wants to merge 0 commits from test-lds-cmpst-wait into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

yawn-animals commented 2026-11-24 17:01:57 +00:00

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

Claimed in the coordination issue as: TEST-LDS-CMPST-WAIT ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7138548249)). ### 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)
morodirule commented 2026-11-24 17:06:29 +00:00

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.

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.
Sign in to join this conversation.
No description provided.