[PR #1021] [MERGED] rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR) #1058

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

📋 Pull Request Information

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

Base: main ← Head: w64-sdst-pair


📝 Commits (1)

  • bc7143b rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR)

📊 Changes

3 files changed (+114 additions, -0 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/test_wave64_single_sdst.py (+87 -0)
📝 tools/rdna2spirv.py (+26 -0)

📄 Description

Claim: SHADER-W64-SDST-PAIR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137991126).

The shader listings come from llvm-mc without +wavefrontsize64, so a VALU instruction's lane-mask SGPR is printed as one register: v_cmp_gt_u32_e64 s8, ... for the s[8:9] a wave64 writes, v_cndmask_b32_e64 ..., s10 for the s[10:11] it reads. The translator wrote s8 alone. A scalar 64-bit instruction prints the pair, and mask_src gives lanes 32..63 the high register's bit (since 804f4aeff), so after s_mov_b64 exec, s[8:9] those lanes had whatever s9 held before. The semantic tests print the pair, so none of them saw it.

widen_wave64_masks makes the operand the pair once a program is known to be wave64: v_cmp_* with an SDST, the carry out and in of v_*_co_*, v_div_scale, v_mad_[ui]64_[ui]32 and the mask of v_cndmask.

How it was found: a 128-thread pipeline-library compute shader (lib_cs_03141) hung an RTX 5080 (device lost) while the retail title's loading screen runs. The translated shader also loops for ever in test_wave64_emulate_opt.run_emulated_workgroup with the title's own constants; with this it ends after 76 barriers, and the title gets past it.

Tested

  • tests/semantic/test_wave64_single_sdst.py (new): both printed forms translate to the same module, natively and emulated, and all 64 lanes are run. On main: 2 failures, 1 error.
  • scripts/run_semantic_tests.py tests/semantic: 470 files, 6,165 tests; the one file that fails, test_image_cube_store_glc, cannot start llvm-mc on this machine (FileNotFoundError).
  • Corpus, with --wave64-emulate, on my boot stack (main plus other open pull requests): 26,503 translated before and after, the 2,671 pipeline-library programs too, none lost. I did not run spirv-val over the new modules separately; the translator's own assembly step accepted them all.
  • RTX 5080, driver 621.24, Windows 11. No game data.

The modules have to be translated again (make_game.py --stages shaders).

AI-assisted (Claude Code, Opus 5.5).

🤖 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/1021 **Author:** [@DadaCap](https://github.com/DadaCap) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `w64-sdst-pair` --- ### 📝 Commits (1) - [`bc7143b`](https://github.com/ubiquitarianism/leonida/commit/bc7143b5f18ba8fbaaac8ece425d80893c9fa1bb) rdna2spirv: a wave64 VALU mask operand printed as one SGPR is the pair (SHADER-W64-SDST-PAIR) ### 📊 Changes **3 files changed** (+114 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/test_wave64_single_sdst.py` (+87 -0) 📝 `tools/rdna2spirv.py` (+26 -0) </details> ### 📄 Description Claim: SHADER-W64-SDST-PAIR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137991126). The shader listings come from llvm-mc without `+wavefrontsize64`, so a VALU instruction's lane-mask SGPR is printed as one register: `v_cmp_gt_u32_e64 s8, ...` for the `s[8:9]` a wave64 writes, `v_cndmask_b32_e64 ..., s10` for the `s[10:11]` it reads. The translator wrote `s8` alone. A scalar 64-bit instruction prints the pair, and `mask_src` gives lanes 32..63 the high register's bit (since 804f4aeff), so after `s_mov_b64 exec, s[8:9]` those lanes had whatever `s9` held before. The semantic tests print the pair, so none of them saw it. `widen_wave64_masks` makes the operand the pair once a program is known to be wave64: `v_cmp_*` with an SDST, the carry out and in of `v_*_co_*`, `v_div_scale`, `v_mad_[ui]64_[ui]32` and the mask of `v_cndmask`. How it was found: a 128-thread pipeline-library compute shader (`lib_cs_03141`) hung an RTX 5080 (device lost) while the retail title's loading screen runs. The translated shader also loops for ever in `test_wave64_emulate_opt.run_emulated_workgroup` with the title's own constants; with this it ends after 76 barriers, and the title gets past it. ### Tested - `tests/semantic/test_wave64_single_sdst.py` (new): both printed forms translate to the same module, natively and emulated, and all 64 lanes are run. On `main`: 2 failures, 1 error. - `scripts/run_semantic_tests.py tests/semantic`: 470 files, 6,165 tests; the one file that fails, `test_image_cube_store_glc`, cannot start llvm-mc on this machine (`FileNotFoundError`). - Corpus, with `--wave64-emulate`, on my boot stack (`main` plus other open pull requests): 26,503 translated before and after, the 2,671 pipeline-library programs too, none lost. I did not run `spirv-val` over the new modules separately; the translator's own assembly step accepted them all. - RTX 5080, driver 621.24, Windows 11. No game data. The modules have to be translated again (`make_game.py --stages shaders`). AI-assisted (Claude Code, Opus 5.5). 🤖 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>
4ld0 2026-11-26 20:19:57 +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#1058
No description provided.