[PR #1994] rdna2spirv: extract per-lane bits for non-mask special sources in s_mov_b32 exec_hi (SHADER-EXEC-HI-SPECIAL-SRC) #2003

Open
opened 2026-11-26 21:19:42 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1994
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/exec-hi-special-bits


📝 Commits (1)

  • 37d433c rdna2spirv: extract per-lane bits for non-mask special sources in s_mov_b32 exec_hi

📊 Changes

3 files changed (+148 additions, -4 deletions)

View changed files

📝 docs/design.md (+1 -1)
➕ tests/semantic/test_exec_hi_special_src.py (+142 -0)
📝 tools/rdna2spirv.py (+5 -3)

📄 Description

Claimed in #1608 as SHADER-EXEC-HI-SPECIAL-SRC.

What and why

  • In tools/rdna2spirv.py, s_mov_b32 exec_lo, <special> falls through to Gen.dst -> Gen.exec_bit, which extracts bit (lane & 31) for every non-mask source (m0, scc/src_scc, plain-data vcc_lo/vcc_hi, etc.).
  • By contrast, the special-cased s_mov_b32 exec_hi, <src> branch only extracted per-lane bits when src["k"] == "sgpr" and otherwise passed raw self.src_u(src) straight into Gen.exec_half_write(1, val, None). Because exec_half_write tests val != 0, any non-zero bit in m0, src_scc, or plain-data vcc_lo/vcc_hi silently activated all 32 upper lanes (32..63) instead of only the lanes whose bits were set.
  • Routing non-mask sources through self.exec_bit(self.src_u(src)) while keeping lane-mask sources (self.holds_lane_mask(src)) on self.src_u(src) brings exec_hi into parity with exec_lo and hardware (both native wave64 and --wave64-emulate).
  • Updated the Constant lane masks / SHADER-1264 contract row in docs/design.md.

Testing

  • AI-assisted: yes.
  • Environment: Windows 11, Python 3.12 (no GPU / LLVM / SPIRV-Tools installed locally).
  • New regression suite: tests/semantic/test_exec_hi_special_src.py — tests s_mov_b32 exec_hi from m0, plain-data vcc_lo, plain-data vcc_hi (native wave64 and --wave64-emulate), src_scc (0 and 1), and a lane-mask vcc_hi control while confirming exec_lo is preserved.
  • RED control on origin/main (fd33a31): tests/semantic/test_exec_hi_special_src.py fails on origin/main (proving m0, plain-data vcc_lo/vcc_hi, and src_scc = 1 turn on all 32 upper lanes instead of the set bits).
  • GREEN checks on branch:
    • python -I tests/semantic/test_exec_hi_special_src.py -v
    • python -m unittest discover -s tests/semantic -p test_exec_computed.py
    • python -m unittest discover -s tests/semantic -p test_wave64_mov_b32_cross_half.py
    • python -m unittest discover -s tests -p "test_docs_*.py"
    • python -I tests/test_text_write_line_endings.py
    • python -m compileall -q tools/rdna2spirv.py tests/semantic/test_exec_hi_special_src.py
    • python -I scripts/check_no_game_data.py tools/rdna2spirv.py docs/design.md tests/semantic/test_exec_hi_special_src.py

🔄 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/1994 **Author:** [@ShotTechOp](https://github.com/ShotTechOp) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/exec-hi-special-bits` --- ### 📝 Commits (1) - [`37d433c`](https://github.com/ubiquitarianism/leonida/commit/37d433c7900707b3b191016264db8f3de9de624e) rdna2spirv: extract per-lane bits for non-mask special sources in s_mov_b32 exec_hi ### 📊 Changes **3 files changed** (+148 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -1) ➕ `tests/semantic/test_exec_hi_special_src.py` (+142 -0) 📝 `tools/rdna2spirv.py` (+5 -3) </details> ### 📄 Description Claimed in #1608 as `SHADER-EXEC-HI-SPECIAL-SRC`. ## What and why - In `tools/rdna2spirv.py`, `s_mov_b32 exec_lo, <special>` falls through to `Gen.dst` -> `Gen.exec_bit`, which extracts bit `(lane & 31)` for every non-mask source (`m0`, `scc`/`src_scc`, plain-data `vcc_lo`/`vcc_hi`, etc.). - By contrast, the special-cased `s_mov_b32 exec_hi, <src>` branch only extracted per-lane bits when `src["k"] == "sgpr"` and otherwise passed raw `self.src_u(src)` straight into `Gen.exec_half_write(1, val, None)`. Because `exec_half_write` tests `val != 0`, any non-zero bit in `m0`, `src_scc`, or plain-data `vcc_lo`/`vcc_hi` silently activated all 32 upper lanes (`32..63`) instead of only the lanes whose bits were set. - Routing non-mask sources through `self.exec_bit(self.src_u(src))` while keeping lane-mask sources (`self.holds_lane_mask(src)`) on `self.src_u(src)` brings `exec_hi` into parity with `exec_lo` and hardware (both native wave64 and `--wave64-emulate`). - Updated the `Constant lane masks` / `SHADER-1264` contract row in `docs/design.md`. ## Testing - **AI-assisted**: yes. - **Environment**: Windows 11, Python 3.12 (no GPU / LLVM / SPIRV-Tools installed locally). - **New regression suite**: `tests/semantic/test_exec_hi_special_src.py` — tests `s_mov_b32 exec_hi` from `m0`, plain-data `vcc_lo`, plain-data `vcc_hi` (native wave64 and `--wave64-emulate`), `src_scc` (`0` and `1`), and a lane-mask `vcc_hi` control while confirming `exec_lo` is preserved. - **RED control on `origin/main` (`fd33a31`)**: `tests/semantic/test_exec_hi_special_src.py` fails on `origin/main` (proving `m0`, plain-data `vcc_lo`/`vcc_hi`, and `src_scc = 1` turn on all 32 upper lanes instead of the set bits). - **GREEN checks on branch**: - `python -I tests/semantic/test_exec_hi_special_src.py -v` - `python -m unittest discover -s tests/semantic -p test_exec_computed.py` - `python -m unittest discover -s tests/semantic -p test_wave64_mov_b32_cross_half.py` - `python -m unittest discover -s tests -p "test_docs_*.py"` - `python -I tests/test_text_write_line_endings.py` - `python -m compileall -q tools/rdna2spirv.py tests/semantic/test_exec_hi_special_src.py` - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py docs/design.md tests/semantic/test_exec_hi_special_src.py` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2003
No description provided.