rdna2spirv: refuse 3D Dref c_lz samples (SHADER-1402) #112

Open
github-bot wants to merge 1 commit from github-bot/gh-112 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:20 UTC · original
ubiquitarianism:old-pr/9845 → main · +49 −8 · 5 files · 1 commits · draft

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

**@⁠Andretuta** on GitHub · 2026-11-24 02:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/112) `ubiquitarianism:old-pr/9845` → `main` · +49 −8 · 5 files · 1 commits · draft > 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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:44:52 +00:00
This pull request has changes conflicting with the target branch.
  • tools/rdna2spirv.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/112/head:github-bot/gh-112'
git switch 'github-bot/gh-112'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-112'
git switch 'github-bot/gh-112'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-112'
git switch 'github-bot/gh-112'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-112'
git switch 'main'
git merge --squash 'github-bot/gh-112'
git switch 'main'
git merge --ff-only 'github-bot/gh-112'
git switch 'main'
git merge 'github-bot/gh-112'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.