[PR #24] [MERGED] rdna2spirv: a computed value written to EXEC sets the lanes of its bits (SHADER-1264) #78

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

📋 Pull Request Information

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

Base: main ← Head: fix/shader-1264-exec-computed


📝 Commits (1)

  • 1b15cd2 rdna2spirv: a computed value written to EXEC sets the lanes of its bits (SHADER-1264)

📊 Changes

2 files changed (+13 additions, -3 deletions)

View changed files

📝 docs/design.md (+1 -1)
📝 tools/rdna2spirv.py (+12 -2)

📄 Description

Item: SHADER-1264 (claimed in #14).

What

s_lshl_b32 exec_lo, 1, s5 ran all 32 lanes of that half instead of lane 3. The generic SALU destination
path (Gen.dst) wrote a computed 32-bit value to EXEC through set_exec / exec_half_write, which test the
value for non-zero. A computed value is not a lane mask: lane L takes bit L of it.

Gen.exec_bit takes that bit, and Gen.dst uses it for the wave32 exec/exec_lo writes and the wave64
exec_lo/exec_hi writes. The other paths into EXEC already pass a per-lane mask or bit (mask_dst,
put_mask, exec_half_write's constant form, s_mov_b32's mask_src, and the saveexec/wrexec forms) and are
unchanged; a value that already holds this lane's bit of a mask (0 or ~0) gives the same answer under bit
extraction, so no caller has to say which it has.

Tests

  • python -I -m unittest discover -s tests/semantic -p 'test_exec_computed.py' - 2 tests, pass; both fail
    before the change (8192 8192 8192 instead of 259 1028 3088).
  • python -I scripts/run_semantic_tests.py tests/semantic -j 6 - 463 files, 6075 tests: test_exec_computed
    goes green. The three files that still fail are the same before and after: test_image_atomics_guard (a
    separate stale test, listed in #14) and test_sopc_validation / test_unary_f16_validation, which need
    spirv-as/spirv-val on PATH and skip in this environment.
  • python -I -m unittest discover -s tests/semantic -p 'test_salu_b32_lane_masks.py' - 9 tests, pass (the
    wave64 EXEC paths, including s_bitreplicate_b64_b32 exec, which already pass a per-lane bit).

Environment: macOS arm64, Python 3.14, no GPU. The expected words are the ones already recorded in
runtime/test/shaders/cs_w32_exec_computed.asm and cs_w64_exec_computed.asm (measured on an RTX 5070) and
replayed through the CPU interpreter; I have not re-measured them on hardware.

Docs

docs/design.md's constant-lane-masks row records the rule and how it was confirmed.

AI-assisted. Nothing here quotes game files, extracted assets or generated shaders.


🔄 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/24 **Author:** [@ddddddddwp](https://github.com/ddddddddwp) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `fix/shader-1264-exec-computed` --- ### 📝 Commits (1) - [`1b15cd2`](https://github.com/ubiquitarianism/leonida/commit/1b15cd23164b509c60ddc40f1b3382c65278a091) rdna2spirv: a computed value written to EXEC sets the lanes of its bits (SHADER-1264) ### 📊 Changes **2 files changed** (+13 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -1) 📝 `tools/rdna2spirv.py` (+12 -2) </details> ### 📄 Description Item: `SHADER-1264` (claimed in #14). ## What `s_lshl_b32 exec_lo, 1, s5` ran all 32 lanes of that half instead of lane 3. The generic SALU destination path (`Gen.dst`) wrote a computed 32-bit value to EXEC through `set_exec` / `exec_half_write`, which test the value for non-zero. A computed value is not a lane mask: lane L takes bit L of it. `Gen.exec_bit` takes that bit, and `Gen.dst` uses it for the wave32 `exec`/`exec_lo` writes and the wave64 `exec_lo`/`exec_hi` writes. The other paths into EXEC already pass a per-lane mask or bit (`mask_dst`, `put_mask`, `exec_half_write`'s constant form, `s_mov_b32`'s `mask_src`, and the saveexec/wrexec forms) and are unchanged; a value that already holds this lane's bit of a mask (0 or ~0) gives the same answer under bit extraction, so no caller has to say which it has. ## Tests - `python -I -m unittest discover -s tests/semantic -p 'test_exec_computed.py'` - 2 tests, pass; both fail before the change (`8192 8192 8192` instead of `259 1028 3088`). - `python -I scripts/run_semantic_tests.py tests/semantic -j 6` - 463 files, 6075 tests: `test_exec_computed` goes green. The three files that still fail are the same before and after: `test_image_atomics_guard` (a separate stale test, listed in #14) and `test_sopc_validation` / `test_unary_f16_validation`, which need `spirv-as`/`spirv-val` on PATH and skip in this environment. - `python -I -m unittest discover -s tests/semantic -p 'test_salu_b32_lane_masks.py'` - 9 tests, pass (the wave64 EXEC paths, including `s_bitreplicate_b64_b32 exec`, which already pass a per-lane bit). Environment: macOS arm64, Python 3.14, no GPU. The expected words are the ones already recorded in `runtime/test/shaders/cs_w32_exec_computed.asm` and `cs_w64_exec_computed.asm` (measured on an RTX 5070) and replayed through the CPU interpreter; I have not re-measured them on hardware. ## Docs `docs/design.md`'s constant-lane-masks row records the rule and how it was confirmed. AI-assisted. Nothing here quotes game files, extracted assets or generated shaders. --- <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:43 +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#78
No description provided.