[PR #112] rdna2spirv: refuse 3D Dref c_lz samples (SHADER-1402) #164

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/112
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/9845


📝 Commits (1)

  • 71fdcc0 rdna2spirv: refuse 3D Dref c_lz samples

📊 Changes

5 files changed (+49 additions, -8 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/fixtures/dref_3d_c_lz.asm (+8 -0)
➕ tests/semantic/fixtures/dref_3d_c_lz_o.asm (+9 -0)
📝 tests/semantic/test_sample_c.py (+29 -8)
📝 tools/rdna2spirv.py (+2 -0)

📄 Description

Carried over from old PR 9845 by ThomasSAMP in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9845, 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.
ThomasSAMP: 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):

Resubmission of #9630, which was closed unmerged in the 22:28 UTC cleanup of outside PRs. I can't reopen it as its author, so this is the same commit, rebased onto main 2d53a8055 without conflicts. Reviews and checks of the earlier head ce4c3af2a are on #9630: an approval by @Zipettte, and checks by @SweatierKey (with a negative control), @catminou4, @molodayamama and @o-psi (merge-candidate).

Claimed in the coordination issue as: SHADER-1402

What and why

Refuse image_sample_c_lz and image_sample_c_lz_o on 3D images during translation.

Vulkan forbids Dref instructions on 3D images (VUID-StandaloneSpirv-OpImage-04777). Until now, the translator emitted OpImageSampleDrefExplicitLod there, producing a module that assembled but failed spirv-val --target-env vulkan1.2.

The refusal is narrow: 2D and 2D-array forms, texel-offset forms included, still translate and validate. The PR adds two hand-written assembly fixtures and a contract-table row.

The existing SHADER-1402 corpus census counted 15,155 image_sample_c_lz sites: 12,718 2D and 2,437 2D-array, none on 3D images. No game corpus was read for this PR.

Tested on the rebased head (main 2d53a8055)

Windows 11, Python 3.12.10, LLVM 23.1.6, SPIRV-Tools from Vulkan SDK 1.4.363.0.

  • python -m unittest discover -s tests/semantic -p test_sample_c.py: 10/10 OK, with no skips (spirv-val present).
  • python -I scripts/run_semantic_tests.py tests/semantic: 459 files and 6,048 tests. 3 files fail: test_exec_computed (2 failures), test_image_atomics_guard (47) and test_image_cube_store_glc (1 error). All three fail the same way on main 2d53a8055 without this change.
  • compileall, git diff --check and scripts/check_no_game_data.py on the five changed files: clean.

Tested on the original head (ce4c3af2a, on main 5d74c2723)

  • Hand-written shader fixtures before and after: 270/270 translated and 270/270 passed spirv-val. The generated SPIR-V directories are byte-identical.
  • Full semantic suite: before, 447 files, 5,957 tests, 3 pre-existing failing files. After, 447 files, 5,959 tests, the same 3 failing files and no new failure.
  • Full GPU suite on AMD Radeon RX 9070 XT, AMD driver 26.11.2, with Vulkan validation enabled: 225/241 passed, 16 skipped, 0 failed, before and after. The raw GPU readbacks are byte-identical.
  • MSVC runtime build succeeded. CTest reported 7 failures out of 275 both before and after, and the unrelated failing set varied between runs. No C++ source is changed here. (The xbox_present crashes on that machine come from an installed overlay's implicit Vulkan layer. See docs/testing.md: 5/5 pass with VK_LOADER_LAYERS_DISABLE=~implicit~.)

AI-assisted: yes. The change was written with Kimi Code; the rebase and retest were done with Claude Code.

Checklist

  • No game data, keys or decryption, including in logs or reports quoted here.
  • The new translator rule is in the contract table of docs/design.md, with its Vulkan validation reference and corpus count.

🤖 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/112 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/9845` --- ### 📝 Commits (1) - [`71fdcc0`](https://github.com/ubiquitarianism/leonida/commit/71fdcc005266812c90a45afade9d8cde90bc1d5e) rdna2spirv: refuse 3D Dref c_lz samples ### 📊 Changes **5 files changed** (+49 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/fixtures/dref_3d_c_lz.asm` (+8 -0) ➕ `tests/semantic/fixtures/dref_3d_c_lz_o.asm` (+9 -0) 📝 `tests/semantic/test_sample_c.py` (+29 -8) 📝 `tools/rdna2spirv.py` (+2 -0) </details> ### 📄 Description > Carried over from **old PR 9845** by `ThomasSAMP` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9845`, 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. > `ThomasSAMP`: 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): Resubmission of `#9630`, which was closed unmerged in the 22:28 UTC cleanup of outside PRs. I can't reopen it as its author, so this is the same commit, rebased onto `main` `2d53a8055` without conflicts. Reviews and checks of the earlier head `ce4c3af2a` are on `#9630`: an approval by `@Zipettte`, and checks by `@SweatierKey` (with a negative control), `@catminou4`, `@molodayamama` and `@o-psi` (merge-candidate). Claimed in the coordination issue as: [SHADER-1402](https://github.com/ProjectLeonida/Leonida/issues/9401#issuecomment-7114624960) ### What and why Refuse `image_sample_c_lz` and `image_sample_c_lz_o` on 3D images during translation. Vulkan forbids Dref instructions on 3D images (`VUID-StandaloneSpirv-OpImage-04777`). Until now, the translator emitted `OpImageSampleDrefExplicitLod` there, producing a module that assembled but failed `spirv-val --target-env vulkan1.2`. The refusal is narrow: 2D and 2D-array forms, texel-offset forms included, still translate and validate. The PR adds two hand-written assembly fixtures and a contract-table row. The existing SHADER-1402 corpus census counted 15,155 `image_sample_c_lz` sites: 12,718 2D and 2,437 2D-array, none on 3D images. No game corpus was read for this PR. ### Tested on the rebased head (`main` `2d53a8055`) Windows 11, Python 3.12.10, LLVM 23.1.6, SPIRV-Tools from Vulkan SDK 1.4.363.0. - `python -m unittest discover -s tests/semantic -p test_sample_c.py`: 10/10 OK, with no skips (`spirv-val` present). - `python -I scripts/run_semantic_tests.py tests/semantic`: 459 files and 6,048 tests. 3 files fail: `test_exec_computed` (2 failures), `test_image_atomics_guard` (47) and `test_image_cube_store_glc` (1 error). All three fail the same way on `main` `2d53a8055` without this change. - `compileall`, `git diff --check` and `scripts/check_no_game_data.py` on the five changed files: clean. ### Tested on the original head (`ce4c3af2a`, on `main` `5d74c2723`) - Hand-written shader fixtures before and after: 270/270 translated and 270/270 passed `spirv-val`. The generated SPIR-V directories are byte-identical. - Full semantic suite: before, 447 files, 5,957 tests, 3 pre-existing failing files. After, 447 files, 5,959 tests, the same 3 failing files and no new failure. - Full GPU suite on AMD Radeon RX 9070 XT, AMD driver 26.11.2, with Vulkan validation enabled: 225/241 passed, 16 skipped, 0 failed, before and after. The raw GPU readbacks are byte-identical. - MSVC runtime build succeeded. CTest reported 7 failures out of 275 both before and after, and the unrelated failing set varied between runs. No C++ source is changed here. (The `xbox_present` crashes on that machine come from an installed overlay's implicit Vulkan layer. See `docs/testing.md`: 5/5 pass with `VK_LOADER_LAYERS_DISABLE=~implicit~`.) AI-assisted: yes. The change was written with Kimi Code; the rebase and retest were done with Claude Code. ### Checklist - [x] No game data, keys or decryption, including in logs or reports quoted here. - [x] The new translator rule is in the contract table of `docs/design.md`, with its Vulkan validation reference and corpus count. 🤖 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>
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#164
No description provided.