d3d12: with no shader library, the descriptor table is tagged, the tr… #2543

Closed
leonida/mandy
JamesCicada wants to merge 0 commits from rt-descriptor-table-no-library-default into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

JamesCicada commented 2026-11-28 01:38:45 +00:00

… translator's default

With no library loaded (the GPU tests, the tools) the device picked the plain descriptor table, while tools/rdna2spirv.py translates for the tagged one by default. cs_texture_uav.spv then read an all-zero kind word, fell back to index 0 and skipped its image stores (got 0x11, expected 0x3f9).

kNoLibraryDescriptorTableLayout (runtime/src/shader_library.h) is now that default; the kind word is additive, so a plain module still reads only its index. A loaded library's vote and LEONIDA_DESCRIPTOR_TABLE are unchanged. tests/test_descriptor_table_default.py keeps the runtime's default equal to the translator's.

From qhukz13's finding in the coordination issue (#1608).

Tested on Windows 11 (CPU tests; GPU test not run, needs llvm-mc): shader_library, d3d12_vulkan_device, d3d12_texture_uav --descriptors-only, descriptor_table, tests/test_descriptor_table_default.py.

AI-assisted (Claude Code).

Claimed in the coordination issue as:

Depends on:

Fixes:

What and why

Tested

GPUs tested:

AI-assisted:

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
… translator's default With no library loaded (the GPU tests, the tools) the device picked the plain descriptor table, while tools/rdna2spirv.py translates for the tagged one by default. cs_texture_uav.spv then read an all-zero kind word, fell back to index 0 and skipped its image stores (got 0x11, expected 0x3f9). kNoLibraryDescriptorTableLayout (runtime/src/shader_library.h) is now that default; the kind word is additive, so a plain module still reads only its index. A loaded library's vote and LEONIDA_DESCRIPTOR_TABLE are unchanged. tests/test_descriptor_table_default.py keeps the runtime's default equal to the translator's. From qhukz13's finding in the coordination issue (#1608). Tested on Windows 11 (CPU tests; GPU test not run, needs llvm-mc): shader_library, d3d12_vulkan_device, d3d12_texture_uav --descriptors-only, descriptor_table, tests/test_descriptor_table_default.py. AI-assisted (Claude Code). Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (see AGENTS.md; the coordination issue lists the open pull requests); delete the line if it builds on none and conflicts with none --> Fixes: <!-- #N for each issue this closes (GitHub closes it on merge); delete the line if it closes none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> GPUs tested: <!-- vendor, model, driver and OS of each GPU the GPU tests ran on, or n/a --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### Checklist - [ ] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [ ] One topic; follow-up work goes in a new pull request. - [ ] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
Tyrannys commented 2026-11-28 02:41:29 +00:00

#2543 | head 4a83ecddcaa2194cff71a765be11ef0f31cacd3d | python -I tests/test_descriptor_table_default.py; ctest -C RelWithDebInfo -R "^(shader_library|d3d12_texture_uav|descriptor_table)$" | red: clean main + the PR's Python test: FAILED (failures=1), AssertionError, kNoLibraryDescriptorTableLayout not found (shader_library_test's new CHECK uses that constant, so it does not compile on main) | green: main 02f71ccfe merged into the head, Python: Ran 2 tests, OK; ctest 3/3 passed (d3d12_texture_uav with --descriptors-only only: the full cs_texture_uav GPU run needs llvm-mc, which this machine does not have yet) | full suite: not run (a game boot was using the machine) | Windows 11, RTX 4070 SUPER, NVIDIA 621.01, Python 3.14 | AI-assisted: yes, Claude Code

#2543 | head 4a83ecddcaa2194cff71a765be11ef0f31cacd3d | python -I tests/test_descriptor_table_default.py; ctest -C RelWithDebInfo -R "^(shader_library|d3d12_texture_uav|descriptor_table)$" | red: clean main + the PR's Python test: FAILED (failures=1), AssertionError, kNoLibraryDescriptorTableLayout not found (shader_library_test's new CHECK uses that constant, so it does not compile on main) | green: main 02f71ccfe merged into the head, Python: Ran 2 tests, OK; ctest 3/3 passed (d3d12_texture_uav with --descriptors-only only: the full cs_texture_uav GPU run needs llvm-mc, which this machine does not have yet) | full suite: not run (a game boot was using the machine) | Windows 11, RTX 4070 SUPER, NVIDIA 621.01, Python 3.14 | AI-assisted: yes, Claude Code
Tyrannys commented 2026-11-28 03:08:48 +00:00

#2543 (GPU follow-up) | head 4a83ecddcaa2194cff71a765be11ef0f31cacd3d | d3d12_texture_uav_test <cs_texture_uav.spv> (the shader built with test/shaders/build.py, llvm-mc 21.1.8 with the AMDGPU target) | red: clean main: fails on an assertion, line 650 (check_case on the 1D texture), 2 of 2 runs | green: main 02f71ccfe merged into the head: "texture UAVs: 14 GPU cases (10 compared with WARP), format/range/refusal checks passed", 2 of 2 runs | full suite: not run (a game boot was using the machine) | Windows 11, RTX 4070 SUPER, NVIDIA 621.01, Python 3.14 | AI-assisted: yes, Claude Code

#2543 (GPU follow-up) | head 4a83ecddcaa2194cff71a765be11ef0f31cacd3d | d3d12_texture_uav_test <cs_texture_uav.spv> (the shader built with test/shaders/build.py, llvm-mc 21.1.8 with the AMDGPU target) | red: clean main: fails on an assertion, line 650 (check_case on the 1D texture), 2 of 2 runs | green: main 02f71ccfe merged into the head: "texture UAVs: 14 GPU cases (10 compared with WARP), format/range/refusal checks passed", 2 of 2 runs | full suite: not run (a game boot was using the machine) | Windows 11, RTX 4070 SUPER, NVIDIA 621.01, Python 3.14 | AI-assisted: yes, Claude Code
lixonik approved these changes 2026-11-28 09:21:54 +00:00
lixonik left a comment

Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC), native llvm-mc (AMDGPU), Vulkan SDK 1.4.363.1 (spirv-val, spirv-as, glslangValidator), and LEONIDA_VK_VALIDATION=1.

Defaulting no-library runs to kNoLibraryDescriptorTableLayout = DescriptorTableLayout::tagged keeps the runtime aligned with tools/rdna2spirv.py, and tests/test_descriptor_table_default.py guards against future drift. Crucially, the translated-shader GPU test d3d12_texture_uav (which exercises cs_texture_uav.spv without a shader library) now builds and passes on real Vulkan hardware with zero validation errors.

Tests run

  • ctest --output-on-failure -R "^(shader_library|descriptor_table|d3d12_texture_uav|d3d12_translated_draw)$" (with LEONIDA_VK_VALIDATION=1): 4/4 passed (descriptor_table 0.03 s, shader_library 0.19 s, d3d12_texture_uav 2.45 s, d3d12_translated_draw 0.32 s).
  • python -I tests/test_descriptor_table_default.py -v: 2/2 passed.

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).

AI-assisted (Antigravity, Gemini).

Reviewed the diff and tested merged onto `main` (`493867366`) with Ninja Release (MSVC), native `llvm-mc` (AMDGPU), Vulkan SDK 1.4.363.1 (`spirv-val`, `spirv-as`, `glslangValidator`), and `LEONIDA_VK_VALIDATION=1`. Defaulting no-library runs to `kNoLibraryDescriptorTableLayout = DescriptorTableLayout::tagged` keeps the runtime aligned with `tools/rdna2spirv.py`, and `tests/test_descriptor_table_default.py` guards against future drift. Crucially, the translated-shader GPU test `d3d12_texture_uav` (which exercises `cs_texture_uav.spv` without a shader library) now builds and passes on real Vulkan hardware with zero validation errors. ### Tests run - `ctest --output-on-failure -R "^(shader_library|descriptor_table|d3d12_texture_uav|d3d12_translated_draw)$"` (with `LEONIDA_VK_VALIDATION=1`): **4/4 passed** (`descriptor_table` 0.03 s, `shader_library` 0.19 s, `d3d12_texture_uav` 2.45 s, `d3d12_translated_draw` 0.32 s). - `python -I tests/test_descriptor_table_default.py -v`: **2/2 passed**. GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, `VK_LAYER_KHRONOS_validation` 1.4.363). AI-assisted (Antigravity, Gemini).
zmasi commented 2026-11-28 23:02:13 +00:00

#2543 | head 4a83ecddcaa2194cff71a765be11ef0f31cacd3d (merged cleanly with main adfb3821a23612263c1c5b195453ed01c4c114db) | python -m unittest tests/test_descriptor_table_default.py + ctest --test-dir runtime/build -C RelWithDebInfo -R "^(shader_library|descriptor_table|d3d12_texture_uav|d3d12_compute)$" --output-on-failure (LEONIDA_VK_VALIDATION=1) | red on main: test_descriptor_table_default.py fails (AssertionError: unexpectedly None : kNoLibraryDescriptorTableLayout not found in runtime/src/shader_library.h) and shader_library_test fails to compile (error C2065: 'kNoLibraryDescriptorTableLayout': undeclared identifier) | green on PR+main: test_descriptor_table_default.py (2/2), test_docs_encoding.py, test_docs_repo_paths.py, and 4/4 CTests (shader_library, descriptor_table, d3d12_texture_uav, d3d12_compute) pass on RTX 3090, logging descriptor table: tagged (no shader library; the translator's default) with 0 Khronos validation errors; check_no_game_data.py 0 violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes

#2543 | head 4a83ecddcaa2194cff71a765be11ef0f31cacd3d (merged cleanly with main adfb3821a23612263c1c5b195453ed01c4c114db) | `python -m unittest tests/test_descriptor_table_default.py` + `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(shader_library|descriptor_table|d3d12_texture_uav|d3d12_compute)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`) | red on main: `test_descriptor_table_default.py` fails (`AssertionError: unexpectedly None : kNoLibraryDescriptorTableLayout not found in runtime/src/shader_library.h`) and `shader_library_test` fails to compile (`error C2065: 'kNoLibraryDescriptorTableLayout': undeclared identifier`) | green on PR+main: `test_descriptor_table_default.py` (`2/2`), `test_docs_encoding.py`, `test_docs_repo_paths.py`, and `4/4` CTests (`shader_library`, `descriptor_table`, `d3d12_texture_uav`, `d3d12_compute`) pass on RTX 3090, logging `descriptor table: tagged (no shader library; the translator's default)` with `0` Khronos validation errors; `check_no_game_data.py` `0` violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
timbot103 reviewed 2026-11-29 01:08:03 +00:00
timbot103 left a comment
No description provided.
Static audit of `4a83ecddc` against `48bae6cad`. No findings. The tagged default gives caller-supplied shaders the image kind bits they expect, while library metadata and `LEONIDA_DESCRIPTOR_TABLE` still determine the layout when present. The supplied results report a full texture UAV red/green and a separate Vulkan validation pass on earlier main merges. The registered CTest covers descriptor setup, and the full GPU test dispatches the translated shader and checks the texels. AI-assisted.
ecox982745 commented 2026-11-29 04:03:51 +00:00

Independent RTX 4090 verification on Windows 11 build 26300, NVIDIA 616.64, MSVC 19.44, LLVM 23.1.6 and SPIRV-Tools 2026.4. Khronos Vulkan validation was enabled. All fixtures were synthetic.

  • Stock main c8bf0e7b6: cs_texture_uav failed the 1D texture readback at line 650 in both modes (got 0x11, expected 0x3f9). The test executable was built before running this focused check.
  • Main b6bf3aa0b with #2543 head 4a83ecddc and the separate #1518 fixture diff: cs_texture_uav matched its D3D12/Vulkan readback in both native and Wave64-emulated runs. cs_imgatomic_ext also matched all 64 words in both modes.
  • The full native suite on that combined tree had 217 passes, 57 skips and zero failures. All 284 fixture shaders translated and passed spirv-val. The combined tree was 6a445886b6b09cd0ff1259d8405a1bf2ff9cc023. The descriptor-table unit test passed both cases.

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

Independent RTX 4090 verification on Windows 11 build 26300, NVIDIA 616.64, MSVC 19.44, LLVM 23.1.6 and SPIRV-Tools 2026.4. Khronos Vulkan validation was enabled. All fixtures were synthetic. - Stock main `c8bf0e7b6`: `cs_texture_uav` failed the 1D texture readback at line 650 in both modes (got `0x11`, expected `0x3f9`). The test executable was built before running this focused check. - Main `b6bf3aa0b` with #2543 head `4a83ecddc` and the separate #1518 fixture diff: `cs_texture_uav` matched its D3D12/Vulkan readback in both native and Wave64-emulated runs. `cs_imgatomic_ext` also matched all 64 words in both modes. - The full native suite on that combined tree had **217 passes, 57 skips and zero failures**. All 284 fixture shaders translated and passed `spirv-val`. The combined tree was `6a445886b6b09cd0ff1259d8405a1bf2ff9cc023`. The descriptor-table unit test passed both cases. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
TheGeogeo commented 2026-11-29 13:11:53 +00:00

Tested 4a83ecddc merged (no commit) with main 8fb974878: MSVC 19.52, Python 3.12.4, Windows 11 10.0.26300.
GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40.

  • Green: shader_library passes, and tests/test_descriptor_table_default.py passes (2 tests). The 296 relinked CTests pass, except xbox_present, which fails on main too (its resize case).
  • Red: with runtime/shims/d3d12_vulkan_device.cpp and runtime/src/shader_library.h back to main, shader_library_test.cpp does not compile (C2065: 'kNoLibraryDescriptorTableLayout'). test_descriptor_table_default.py fails with "kNoLibraryDescriptorTableLayout not found in runtime/src/shader_library.h".
  • gta6rt links with nothing new over main: no new unresolved symbol, same imports.
  • Not run here: the GPU runner case of d3d12_texture_uav with cs_texture_uav.spv. CTest runs that test with --descriptors-only.
  • No merge conflict with the other open PRs that touch these files.
  • No game data check passes.

AI-assisted (Claude Code).

Tested 4a83ecddc merged (no commit) with main 8fb974878: MSVC 19.52, Python 3.12.4, Windows 11 10.0.26300. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40. - Green: `shader_library` passes, and `tests/test_descriptor_table_default.py` passes (2 tests). The 296 relinked CTests pass, except `xbox_present`, which fails on main too (its resize case). - Red: with `runtime/shims/d3d12_vulkan_device.cpp` and `runtime/src/shader_library.h` back to main, `shader_library_test.cpp` does not compile (`C2065: 'kNoLibraryDescriptorTableLayout'`). `test_descriptor_table_default.py` fails with "kNoLibraryDescriptorTableLayout not found in runtime/src/shader_library.h". - `gta6rt` links with nothing new over main: no new unresolved symbol, same imports. - Not run here: the GPU runner case of `d3d12_texture_uav` with `cs_texture_uav.spv`. CTest runs that test with `--descriptors-only`. - No merge conflict with the other open PRs that touch these files. - No game data check passes. AI-assisted (Claude Code).
fiestorra commented 2026-11-30 06:03:21 +00:00

Independent verification on this machine (Windows 11, MSVC 19.44.35226, Python 3.13.14), and the negative control bites on the Python side.

1. It applies. merge-tree clean; 4a83ecddc cherry-picks onto main 0ae217ceb without a conflict. Five files: the Vulkan device shim, shader_library.h, its test, the doc paragraph and tests/test_descriptor_table_default.py.

2. Both test surfaces pass with the change:

python3 -m pytest tests/test_descriptor_table_default.py -q   -> 2 passed
cmake --build … --target shader_library_test  -> linked
shader_library_test.exe                       -> exit 0, 0, 0

3. The Python check fails on main's sources - the PR's test against the reverted shim and shader_library.h:

-> 1 failed, 1 passed
   FAILED DescriptorTableDefault::test_runtime_matches_translat…

So the pairing the commit establishes - with no shader library, the descriptor table is tagged the way the translator tags it - is absent on main and present with the change. The C++ test does not distinguish on its own (it exercises the new tagging path, which only exists with the change), so the Python half is the evidence.

What I did not test: a title run without a shader library on a device that needs one. The tests drive the decision and the tagging; whether the GPU stops complaining about an untagged table needs the title, which this machine can boot but not in the "no shader library" configuration the commit is about.

Written with an AI assistant.

Independent verification on this machine (Windows 11, MSVC 19.44.35226, Python 3.13.14), and **the negative control bites** on the Python side. **1. It applies.** `merge-tree` clean; `4a83ecddc` cherry-picks onto `main` `0ae217ceb` without a conflict. Five files: the Vulkan device shim, `shader_library.h`, its test, the doc paragraph and `tests/test_descriptor_table_default.py`. **2. Both test surfaces pass with the change:** ``` python3 -m pytest tests/test_descriptor_table_default.py -q -> 2 passed cmake --build … --target shader_library_test -> linked shader_library_test.exe -> exit 0, 0, 0 ``` **3. The Python check fails on `main`'s sources** - the PR's test against the reverted shim and `shader_library.h`: ``` -> 1 failed, 1 passed FAILED DescriptorTableDefault::test_runtime_matches_translat… ``` So the pairing the commit establishes - **with no shader library, the descriptor table is tagged the way the translator tags it** - is absent on `main` and present with the change. The C++ test does not distinguish on its own (it exercises the new tagging path, which only exists with the change), so the Python half is the evidence. **What I did not test:** a title run without a shader library on a device that needs one. The tests drive the decision and the tagging; whether the GPU stops complaining about an untagged table needs the title, which this machine can boot but not in the "no shader library" configuration the commit is about. Written with an AI assistant.
aslan2142 commented 2026-12-01 17:26:11 +00:00

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.

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.
Sign in to join this conversation.
No description provided.