[PR #857] [MERGED] tests: GPU fixtures for the ds_wrxchg2_rtn_b32 pair cases and ds_wrxchg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT) #895

Closed
opened 2026-11-26 20:19:25 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/857
Author: @ohshitwaddup
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: tests/gpu-wrxchg2-b32


📝 Commits (1)

  • a9761ab tests: GPU fixtures for the ds_wrxchg2_rtn_b32 pair cases and ds_wrxchg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT)

📊 Changes

4 files changed (+201 additions, -5 deletions)

View changed files

📝 runtime/test/shaders/check.py (+8 -2)
➕ runtime/test/shaders/cs_w32_wrxchg2_ext.asm (+91 -0)
➕ runtime/test/shaders/cs_w32_wrxchg2st64.asm (+93 -0)
📝 scripts/run_gpu_tests.py (+9 -3)

📄 Description

Claimed in the coordination issue as: TEST-WRXCHG2-B32-EXT

Depends on: #413 (conflicts only — it rewrites this row's prose and I add fixtures plus runner lists; if it lands first I rebase onto it and re-check the row text).

What and why

docs/design.md's ds_wrxchg2_rtn_b32 row names cs_w32_new_ops as its GPU fixture. That fixture compares only the first returned word and data1 in LDS — so four things the same row states had never run on a GPU:

  • the second returned word of the pair,
  • data0 as the second exchange's return when both offsets name one dword,
  • vdst aliasing the data VGPRs (the data must be read before the result is written),
  • the st64 step at all (the row records it from a gfx1100 measurement, not from a fixture).

Two branchless, one-lane fixtures (32 lanes on one LDS address would race — which lane's exchange runs first is up to the hardware, as the existing cs_w32_new_ops header notes):

Fixture Covers Words
cs_w32_wrxchg2_ext.asm offsets 1/1 on one dword: first exchange returns the old word, second returns data0 (not the word the first wrote), M[0x204] ends as data1, a seeded neighbour at 0x700 is untouched; then vdst aliased onto the data VGPRs 8
cs_w32_wrxchg2st64.asm st64 = 256 bytes: base 0x80 offsets 1/2 must address 0x180/0x280 8

The st64 fixture is built so the stride is proven, not assumed: it seeds 0x84/0x88 (where a 4-byte step would land) and 0x140/0x2c0 (one 256-byte step either side of the real elements), and requires all four to come back untouched. A translator that used the wrong unit fails on those words rather than passing by luck.

Both judge all eight words in hex, and are registered in runtime/test/shaders/check.py (CS_DUMPS, WAVE32_DUMPS, WAVE32_LANE_DUMPS) and scripts/run_gpu_tests.py (the shared branch, its cs_dump_wants, the wave32-waiver list and the hex list).

Scope note: this deliberately does not edit the docs/design.md row's prose — #413 is rewriting that row and owns it. Once #413 lands, the row can name these two fixtures in the same pass that names the others.

Tested

On current main d0da7da (the branch's base), Radeon RX 6900 XT (RDNA2 / GFX1030, Navi 21), RADV Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44 (kernel 7.2.10), llvm-mc 22.1.8, SPIRV-Tools v2026.1, GCC 16.2.1:

build.py          283 shaders: 283 translated, 283 pass spirv-val
                  wave64 VS/PS/GS on 32-wide subgroups: tier A: 11, tier B: 8, tier C: 13
check.py          217 of 222 pass, 3 skipped, 2 failed
                  cs_w32_wrxchg2_ext   ok
                  cs_w32_wrxchg2st64   ok
run_gpu_tests.py  --filter wrxchg2:
                  native                 2/2 passed
                  LEONIDA_W64_EMULATE=1  2/2 passed
                  full suite             233/251 passed, 16 skipped, 2 failed

Both new fixtures pass in all four runs, with every word exact (16/16). Before this commit the same suite was 231/249 passed, 16 skipped, 2 failed on this card — the +2 passed is exactly these two fixtures.

The two failures in the full runs are cs_imgload_tfe and cs_imgload_d16_tfe ("r32 sint (sint view): 64 bad, texel(5,3) = 2071") — the pre-existing SHADER-1266 / #31 pair, reproduced from stock main and unchanged by this commit. LEONIDA_W64_EMULATE=1 gives byte-identical verdicts, as expected for single-lane shaders with no cross-lane operation.

Also: python -I scripts/check_no_game_data.py on all four changed files is clean, python -m compileall on tools tests scripts and the two edited Python files passes, and the fixtures are LF with a trailing newline like the neighbouring .asm files. ctest/translator suite not run — no translator or runtime C++ change.

GPUs tested: AMD Radeon RX 6900 XT (RDNA2, GFX1030, Navi 21, PCI 1002:73bf), RADV / Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44 (Fedora 44), kernel 7.2.10-200.nobara.fc44.x86_64.

AI-assisted: yes (Hermes Agent) — wrote the two fixtures, derived their expected words from the ISA and the row, ran them, and registered them in both runners.

Checklist

  • Based on current main and merges cleanly.
  • 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 — n/a, no translator change.

🔄 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/857 **Author:** [@ohshitwaddup](https://github.com/ohshitwaddup) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `tests/gpu-wrxchg2-b32` --- ### 📝 Commits (1) - [`a9761ab`](https://github.com/ubiquitarianism/leonida/commit/a9761ab2f9aaae5a29df2351c3edb2cd602deb31) tests: GPU fixtures for the ds_wrxchg2_rtn_b32 pair cases and ds_wrxchg2st64_rtn_b32 (TEST-WRXCHG2-B32-EXT) ### 📊 Changes **4 files changed** (+201 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/shaders/check.py` (+8 -2) ➕ `runtime/test/shaders/cs_w32_wrxchg2_ext.asm` (+91 -0) ➕ `runtime/test/shaders/cs_w32_wrxchg2st64.asm` (+93 -0) 📝 `scripts/run_gpu_tests.py` (+9 -3) </details> ### 📄 Description Claimed in the coordination issue as: [TEST-WRXCHG2-B32-EXT](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134736401) Depends on: #413 (conflicts only — it rewrites this row's prose and I add fixtures plus runner lists; if it lands first I rebase onto it and re-check the row text). ### What and why `docs/design.md`'s `ds_wrxchg2_rtn_b32` row names `cs_w32_new_ops` as its GPU fixture. That fixture compares only **the first returned word and `data1` in LDS** — so four things the same row states had never run on a GPU: - the **second** returned word of the pair, - **`data0`** as the second exchange's return when both offsets name one dword, - **`vdst` aliasing the data VGPRs** (the data must be read before the result is written), - the **`st64`** step at all (the row records it from a gfx1100 measurement, not from a fixture). Two branchless, one-lane fixtures (32 lanes on one LDS address would race — which lane's exchange runs first is up to the hardware, as the existing `cs_w32_new_ops` header notes): | Fixture | Covers | Words | |---|---|---| | `cs_w32_wrxchg2_ext.asm` | offsets `1/1` on one dword: first exchange returns the old word, second returns `data0` (not the word the first wrote), `M[0x204]` ends as `data1`, a seeded neighbour at `0x700` is untouched; then `vdst` aliased onto the data VGPRs | 8 | | `cs_w32_wrxchg2st64.asm` | `st64` = 256 bytes: base `0x80` offsets `1/2` must address `0x180`/`0x280` | 8 | The `st64` fixture is built so the stride is **proven, not assumed**: it seeds `0x84`/`0x88` (where a 4-byte step would land) and `0x140`/`0x2c0` (one 256-byte step either side of the real elements), and requires all four to come back untouched. A translator that used the wrong unit fails on those words rather than passing by luck. Both judge all eight words in hex, and are registered in `runtime/test/shaders/check.py` (`CS_DUMPS`, `WAVE32_DUMPS`, `WAVE32_LANE_DUMPS`) and `scripts/run_gpu_tests.py` (the shared branch, its `cs_dump_wants`, the wave32-waiver list and the hex list). Scope note: this deliberately does **not** edit the `docs/design.md` row's prose — #413 is rewriting that row and owns it. Once #413 lands, the row can name these two fixtures in the same pass that names the others. ### Tested On current `main` `d0da7da` (the branch's base), Radeon RX 6900 XT (RDNA2 / GFX1030, Navi 21), RADV Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44 (kernel 7.2.10), llvm-mc 22.1.8, SPIRV-Tools v2026.1, GCC 16.2.1: ``` build.py 283 shaders: 283 translated, 283 pass spirv-val wave64 VS/PS/GS on 32-wide subgroups: tier A: 11, tier B: 8, tier C: 13 check.py 217 of 222 pass, 3 skipped, 2 failed cs_w32_wrxchg2_ext ok cs_w32_wrxchg2st64 ok run_gpu_tests.py --filter wrxchg2: native 2/2 passed LEONIDA_W64_EMULATE=1 2/2 passed full suite 233/251 passed, 16 skipped, 2 failed ``` Both new fixtures pass in all four runs, with every word exact (16/16). Before this commit the same suite was 231/249 passed, 16 skipped, 2 failed on this card — the `+2 passed` is exactly these two fixtures. The two failures in the full runs are `cs_imgload_tfe` and `cs_imgload_d16_tfe` (`"r32 sint (sint view): 64 bad, texel(5,3) = 2071"`) — the pre-existing SHADER-1266 / #31 pair, reproduced from stock `main` and unchanged by this commit. `LEONIDA_W64_EMULATE=1` gives byte-identical verdicts, as expected for single-lane shaders with no cross-lane operation. Also: `python -I scripts/check_no_game_data.py` on all four changed files is clean, `python -m compileall` on `tools tests scripts` and the two edited Python files passes, and the fixtures are LF with a trailing newline like the neighbouring `.asm` files. `ctest`/translator suite not run — no translator or runtime C++ change. GPUs tested: AMD Radeon RX 6900 XT (RDNA2, GFX1030, Navi 21, PCI 1002:73bf), RADV / Mesa 26.2.4, Vulkan 1.4.354, Nobara Linux 44 (Fedora 44), kernel 7.2.10-200.nobara.fc44.x86_64. AI-assisted: yes (Hermes Agent) — wrote the two fixtures, derived their expected words from the ISA and the row, ran them, and registered them in both runners. ### Checklist - [x] Based on current `main` and merges cleanly. - [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` — n/a, no translator change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:25 +01:00
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#895
No description provided.