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

Closed
Andretuta wants to merge 1 commit from upstream-pr/112 into main
Andretuta commented 2026-11-24 02:20:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:20:32Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464853873 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/112). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:20:32Z. --- > 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)
MoonEyes commented 2026-11-30 18:50:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T18:50:39Z.


This change is still relevant: current main recognizes image_sample_c_lz / image_sample_c_lz_o and has no 3D Dref refusal guard in tools/rdna2spirv.py; tests/semantic/test_sample_c.py has no 3D Dref case. The hand-written refusal fixtures and documented VUID are the right kind of regression coverage.\n\nNot merge-ready: this is still a draft, conflicts with main, all CI checks are cancelled, and I found no current claim in coordination issue #2570. Please claim it, update/rebase on current main, and rerun the required CI before requesting merge. No merge until those criteria are satisfied.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288449247 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/112#issuecomment-7288449247). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T18:50:39Z. --- This change is still relevant: current main recognizes image_sample_c_lz / image_sample_c_lz_o and has no 3D Dref refusal guard in tools/rdna2spirv.py; tests/semantic/test_sample_c.py has no 3D Dref case. The hand-written refusal fixtures and documented VUID are the right kind of regression coverage.\n\nNot merge-ready: this is still a draft, conflicts with main, all CI checks are cancelled, and I found no current claim in coordination issue #2570. Please claim it, update/rebase on current main, and rerun the required CI before requesting merge. No merge until those criteria are satisfied.
aslan2142 commented 2026-12-01 12:00:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:00:13Z.

Review: COMMENTED


Draft review against current main: refusing 3D image_sample_c_lz/image_sample_c_lz_o in tools/rdna2spirv.py:13188-13189 is still relevant and clean-room verified, but this branch conflicts with main and has cancelled CI. Please rebase onto current main and mark Ready for Review so CI runs green.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130842576 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/112#pullrequestreview-6130842576). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:00:13Z. **Review:** COMMENTED --- Draft review against current `main`: refusing 3D `image_sample_c_lz`/`image_sample_c_lz_o` in `tools/rdna2spirv.py:13188-13189` is still relevant and clean-room verified, but this branch conflicts with `main` and has cancelled CI. Please rebase onto current `main` and mark Ready for Review so CI runs green. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:08:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:08:14Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310702498 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/112#issuecomment-7310702498). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:08:14Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 12:57:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:57:19Z.

Review: CHANGES_REQUESTED


Now ready for review, requesting changes before merge:

  • Merge conflicts (CONFLICTING/DIRTY): conflicts with main in docs/design.md and tools/rdna2spirv.py.
  • CI: all checks from 2026-11-24 were cancelled. The 3D Dref c_lz refusal in tools/rdna2spirv.py:13188 looks clean; please rebase onto current main and run fresh green CI.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6131692642 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/112#pullrequestreview-6131692642). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:57:19Z. **Review:** CHANGES_REQUESTED --- Now ready for review, requesting changes before merge: - **Merge conflicts (`CONFLICTING`/`DIRTY`)**: conflicts with `main` in `docs/design.md` and `tools/rdna2spirv.py`. - **CI**: all checks from 2026-11-24 were cancelled. The 3D Dref `c_lz` refusal in `tools/rdna2spirv.py:13188` looks clean; please rebase onto current `main` and run fresh green CI. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 16:21:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:21:35Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317472342 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/112#issuecomment-7317472342). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:21:35Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!112
No description provided.