[PR #647] [MERGED] rdna2spirv: accept vcc (s[106:107]) as 64-bit base pointer in s_load_dword* (SHADER-SLOAD-VCC-BASE) #687

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

📋 Pull Request Information

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

Base: main ← Head: feat/sload-vcc-base


📝 Commits (1)

  • a4c00f4 rdna2spirv: accept vcc (s[106:107]) as 64-bit base pointer in s_load_dword*

📊 Changes

3 files changed (+175 additions, -1 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/test_sload_vcc_base.py (+171 -0)
📝 tools/rdna2spirv.py (+3 -1)

📄 Description

Claimed in the coordination issue as: SHADER-SLOAD-VCC-BASE

AI-assisted.

What and why

In RDNA2 SMEM s_load_dword*, SBASE encodes a 2-SGPR-aligned 64-bit pointer (sbase * 2). When VCC is dead, the compiler allocates sbase = 53 (s[106:107] = vcc, i.e. {vcc_lo, vcc_hi}), emitting instructions such as s_load_dwordx4 s[12:15], vcc, 0x0.

Gen.scalar_load in tools/rdna2spirv.py previously accepted only sgpr and slist base operands, raising Unsupported: s_load_dwordx4 operands sgpr vcc (and s_load_dwordx8 operands sgpr vcc, s_load_dwordx4 operands slist vcc) on 79 pipeline-library compute shaders.

  • Accepts base["k"] == "special" and base["t"] == "vcc" as ["vcc_lo", "vcc_hi"] in Gen.scalar_load (load_slot already loads %vcc / %vcc_hi).
  • s_buffer_load* still requires a 4-dword V# (len(base_slots) != 4) and continues to reject 2-dword vcc.
  • Independent of #596 (OLD-10062, which recovers SGPR > 105 tuple encodings): together with #596 / high-SGPR tuple decoding, this brings the 2,684-shader pipeline library compute corpus to 2,684 / 2,684 (100.0%) translated and spirv-val-valid under --wave64-emulate.

Testing & Verification

  • python -m unittest discover -s tests/semantic -p test_sload_vcc_base.py -v (3/3 OK, including spirv-as + spirv-val validation)
  • python -m unittest discover -s tests/semantic -p test_scalar_mem_smem.py (44/44 OK)
  • python -I tests/test_text_write_line_endings.py (3/3 OK)
  • Corpus check (--wave64-emulate + spirv-val): all 79 / 79 previously failing vcc-base library compute shaders (72 s_load_dwordx4 sgpr, vcc, 6 s_load_dwordx8 sgpr, vcc, 1 s_load_dwordx4 slist, vcc) now translate and pass spirv-val (bringing library CS from 2,605 → 2,684 / 2,684).
  • Clean-room verified: python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_sload_vcc_base.py docs/design.md exited 0.

🔄 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/647 **Author:** [@TanmaySatyam](https://github.com/TanmaySatyam) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `feat/sload-vcc-base` --- ### 📝 Commits (1) - [`a4c00f4`](https://github.com/ubiquitarianism/leonida/commit/a4c00f4f4d9c4e42124fb0e367ee9679ef7a9053) rdna2spirv: accept vcc (s[106:107]) as 64-bit base pointer in s_load_dword* ### 📊 Changes **3 files changed** (+175 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/test_sload_vcc_base.py` (+171 -0) 📝 `tools/rdna2spirv.py` (+3 -1) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-SLOAD-VCC-BASE AI-assisted. ### What and why In RDNA2 SMEM `s_load_dword*`, `SBASE` encodes a 2-SGPR-aligned 64-bit pointer (`sbase * 2`). When `VCC` is dead, the compiler allocates `sbase = 53` (`s[106:107]` = `vcc`, i.e. `{vcc_lo, vcc_hi}`), emitting instructions such as `s_load_dwordx4 s[12:15], vcc, 0x0`. `Gen.scalar_load` in `tools/rdna2spirv.py` previously accepted only `sgpr` and `slist` base operands, raising `Unsupported: s_load_dwordx4 operands sgpr vcc` (and `s_load_dwordx8 operands sgpr vcc`, `s_load_dwordx4 operands slist vcc`) on 79 pipeline-library compute shaders. - Accepts `base["k"] == "special" and base["t"] == "vcc"` as `["vcc_lo", "vcc_hi"]` in `Gen.scalar_load` (`load_slot` already loads `%vcc` / `%vcc_hi`). - `s_buffer_load*` still requires a 4-dword V# (`len(base_slots) != 4`) and continues to reject 2-dword `vcc`. - Independent of #596 (`OLD-10062`, which recovers `SGPR > 105` tuple encodings): together with #596 / high-SGPR tuple decoding, this brings the 2,684-shader pipeline library compute corpus to **2,684 / 2,684 (100.0%)** translated and `spirv-val`-valid under `--wave64-emulate`. ### Testing & Verification - `python -m unittest discover -s tests/semantic -p test_sload_vcc_base.py -v` (3/3 OK, including `spirv-as` + `spirv-val` validation) - `python -m unittest discover -s tests/semantic -p test_scalar_mem_smem.py` (44/44 OK) - `python -I tests/test_text_write_line_endings.py` (3/3 OK) - Corpus check (`--wave64-emulate` + `spirv-val`): all **79 / 79** previously failing `vcc`-base library compute shaders (72 `s_load_dwordx4 sgpr, vcc`, 6 `s_load_dwordx8 sgpr, vcc`, 1 `s_load_dwordx4 slist, vcc`) now translate and pass `spirv-val` (bringing library CS from 2,605 → 2,684 / 2,684). - Clean-room verified: `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_sload_vcc_base.py docs/design.md` exited 0. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:42 +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#687
No description provided.