[PR #85] [CLOSED] Tests: GPU coverage for v_swaprel_b32 and s_movrels_b32/b64 #137

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/85
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/9813


📝 Commits (1)

  • 2057c0e Tests: GPU coverage for v_swaprel_b32 and s_movrels_b32/b64

📊 Changes

4 files changed (+89 additions, -7 deletions)

View changed files

📝 docs/design.md (+2 -2)
📝 runtime/test/shaders/check.py (+5 -2)
➕ runtime/test/shaders/cs_relidx_ext.asm (+76 -0)
📝 scripts/run_gpu_tests.py (+6 -3)

📄 Description

Carried over from old PR 9813 by KoLolX3 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9813, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
KoLolX3: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

docs/design.md marks v_swaprel_b32 and the relative SGPR reads (s_movrels_b32, s_movrels_b64) Not GPU-verified: both translations are CPU-checked (and v_swaprel_b32 was measured on hardware), but the SPIR-V the translator emits had never run on a GPU. s_movrels only appears in a comment of cs_movrelsd_2.asm.

runtime/test/shaders/cs_relidx_ext.asm (one lane, laid out like cs_lds_b64_cmpst.asm):

word op case expected
0, 1 v_swaprel_b32 v10, v11, M0 0xFC02FC03 M0[25:16] = 2, M0[9:0] = 3, other bits ignored: v12 and v14 swap 0x1414, 0x1212
2 v_swaprel_b32 v11, v12, M0 0x10000 both name v12, which keeps its value 0xABCD
3 s_movrels_b32 s30, s20, M0 3 s[20+3] 0x67
4, 5 s_movrels_b64 s[30:31], s[20:21], M0 2 the pair s22, s23 0x66, 0x67
6 s_movrels_b32 s20, s20, M0 1 destination overlapping the source 0x65
7 s_movrels_b32 between s_cmp_eq_u32 0, 0 and s_cselect_b32 7, 9 SCC is not written 0x7

The words are derived in the .asm header from the rows. Registered in check.py and scripts/run_gpu_tests.py next to cs_lds_xchg64_ext (#9761). Both rows keep their marker and add a "GPU-checked by" note; the s_movrels note says the lane-mask case (SHADER-284) is not covered.

Tested on an AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, subgroup 32..64), Artix Linux, llvm-mc 23.1.5, test programs rebuilt from this branch's base 2d53a8055:

  • cs_relidx_ext passes with all eight words exact, native and with LEONIDA_W64_EMULATE=1.
  • Negative control: expecting no swap (words 0/1 exchanged) makes it FAIL.
  • Full scripts/run_gpu_tests.py suite: the only failures are cs_imgload_tfe, cs_imgload_d16_tfe, cs_w32_exec_computed, cs_w64_exec_computed and the known ms_wave_info_s3 flake (#6172), and the four fail the same way on a clean worktree of main on this card.
  • The test files that read check.py, run_gpu_tests.py, design.md or the shader fixtures: the same failure set as a clean worktree of the merge base (28, environment-only on this machine). The branch adds 2 passing tests and 12 subtests.

Synthetic fixture only, no game files. AI-assisted (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/85 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/9813` --- ### 📝 Commits (1) - [`2057c0e`](https://github.com/ubiquitarianism/leonida/commit/2057c0ef153add24134d44c7e174b2731aa623fa) Tests: GPU coverage for v_swaprel_b32 and s_movrels_b32/b64 ### 📊 Changes **4 files changed** (+89 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+2 -2) 📝 `runtime/test/shaders/check.py` (+5 -2) ➕ `runtime/test/shaders/cs_relidx_ext.asm` (+76 -0) 📝 `scripts/run_gpu_tests.py` (+6 -3) </details> ### 📄 Description > Carried over from **old PR 9813** by `KoLolX3` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9813`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `KoLolX3`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `docs/design.md` marks `v_swaprel_b32` and the relative SGPR reads (`s_movrels_b32`, `s_movrels_b64`) **Not GPU-verified**: both translations are CPU-checked (and `v_swaprel_b32` was measured on hardware), but the SPIR-V the translator emits had never run on a GPU. `s_movrels` only appears in a comment of `cs_movrelsd_2.asm`. `runtime/test/shaders/cs_relidx_ext.asm` (one lane, laid out like `cs_lds_b64_cmpst.asm`): | word | op | case | expected | |---|---|---|---| | 0, 1 | `v_swaprel_b32 v10, v11`, M0 `0xFC02FC03` | `M0[25:16]` = 2, `M0[9:0]` = 3, other bits ignored: v12 and v14 swap | `0x1414`, `0x1212` | | 2 | `v_swaprel_b32 v11, v12`, M0 `0x10000` | both name v12, which keeps its value | `0xABCD` | | 3 | `s_movrels_b32 s30, s20`, M0 3 | `s[20+3]` | `0x67` | | 4, 5 | `s_movrels_b64 s[30:31], s[20:21]`, M0 2 | the pair s22, s23 | `0x66`, `0x67` | | 6 | `s_movrels_b32 s20, s20`, M0 1 | destination overlapping the source | `0x65` | | 7 | `s_movrels_b32` between `s_cmp_eq_u32 0, 0` and `s_cselect_b32 7, 9` | SCC is not written | `0x7` | The words are derived in the `.asm` header from the rows. Registered in `check.py` and `scripts/run_gpu_tests.py` next to `cs_lds_xchg64_ext` (`#9761`). Both rows keep their marker and add a "GPU-checked by" note; the `s_movrels` note says the lane-mask case (SHADER-284) is not covered. Tested on an AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, subgroup 32..64), Artix Linux, llvm-mc 23.1.5, test programs rebuilt from this branch's base `2d53a8055`: - `cs_relidx_ext` passes with all eight words exact, native and with `LEONIDA_W64_EMULATE=1`. - Negative control: expecting no swap (words 0/1 exchanged) makes it FAIL. - Full `scripts/run_gpu_tests.py` suite: the only failures are `cs_imgload_tfe`, `cs_imgload_d16_tfe`, `cs_w32_exec_computed`, `cs_w64_exec_computed` and the known `ms_wave_info_s3` flake (`#6172`), and the four fail the same way on a clean worktree of `main` on this card. - The test files that read `check.py`, `run_gpu_tests.py`, `design.md` or the shader fixtures: the same failure set as a clean worktree of the merge base (28, environment-only on this machine). The branch adds 2 passing tests and 12 subtests. Synthetic fixture only, no game files. AI-assisted (Claude Code). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:54 +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#137
No description provided.