d3d12_texture_uav_test: fill the tagged descriptor table for its bare .spv (GPU-TEXTURE-UAV-1D-REGRESSION) #2261

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

@⁠CodingRule on GitHub · 2026-11-26 11:14 UTC · original
CodingRule:texture-uav-test-tagged-table → main · +11 −0 · 1 files · 1 commits · open

Claimed in the coordination issue as: GPU-TEXTURE-UAV-1D-REGRESSION (#1608)

What and why

cs_texture_uav in scripts/run_gpu_tests.py (the D3D-78 fixture, run through d3d12_texture_uav_test <spv>) fails on main wherever the test program is built:

kind 0 mip 0 first 0 count 1 texel 0: got 0x11, expected 0x3f9
line 650: check_case(device.Get(), dispatch, one_d, texture(one_d, 1), source, copy, false, 0, 0, 1, true)

The first GPU case reads back its seed: the dispatch stored nothing.

Cause, found by bisecting the translator against one fixed set of test programs (ed94fbef good, a73a57e13 bad, first bad 9f98dcc61):

  • 9f98dcc61 made --descriptor-table tagged the translator's default. A tagged module reads the kind word next to each table index and takes the array's fallback (index 0, where stores are dropped) when the word does not mark its T# as bound in that array.
  • The device fills the kind word only when the loaded shader library's index says a module reads it (descriptor_table_census); with no library the layout is plain and the word stays 0 (d3d12_vulkan_device.cpp, "descriptor table: plain (all 0 modules)").
  • This test gives the device a bare .spv and no library. The sibling tests (d3d12_m4_compute, d3d12_buffer_uav, ...) load a folder with index.json, which is why they were not affected, and ctest runs this one with --descriptors-only, which is why CI did not see it.

It is the shader, not the program: yesterday's d3d12_texture_uav_test fails with today's module, today's passes with yesterday's module.

The fix is in the test: when it is given a shader and LEONIDA_DESCRIPTOR_TABLE is not set, it asks for the tagged table. The kind word is additive and a plain module never reads it, so that suits a module of either translation; the variable still decides when someone sets it.

One file, test only. I left the device's no-library default alone: whether a device with no index should fill the kind word is a runtime decision for whoever owns that contract, and this does not depend on it.

Tested

main a73a57e13, scripts\build_runtime.ps1 (MSVC 14.44.35207, RelWithDebInfo), llvm-mc 21.1.8, SPIRV-Tools v2026.4.

python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_texture_uav before after
native 0/1, 3 of 3 runs 1/1, 3 of 3 runs
LEONIDA_W64_EMULATE=1 0/1 1/1
LEONIDA_DESCRIPTOR_TABLE=plain (forced mismatch, to show the variable still decides) 0/1 0/1
the unpatched program with LEONIDA_DESCRIPTOR_TABLE=tagged 1/1

After: texture UAVs: 14 GPU cases (10 compared with WARP), format/range/refusal checks passed. ctest -R texture_uav (the --descriptors-only mode, which this does not touch) passes.

The records that list cs_texture_uav as failed so far (#2204) say the test program was not built there; this is the failure a machine that does build it gets.

GPUs tested: NVIDIA GeForce RTX 4090, driver 591.86, Vulkan 1.4.325, Windows 11 Pro build 26200

AI-assisted: yes (Claude Code found the failure, bisected it, wrote the change and ran the tests)

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. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠CodingRule** on GitHub · 2026-11-26 11:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2261) `CodingRule:texture-uav-test-tagged-table` → `main` · +11 −0 · 1 files · 1 commits · open Claimed in the coordination issue as: GPU-TEXTURE-UAV-1D-REGRESSION (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `cs_texture_uav` in `scripts/run_gpu_tests.py` (the D3D-78 fixture, run through `d3d12_texture_uav_test <spv>`) fails on `main` wherever the test program is built: ``` kind 0 mip 0 first 0 count 1 texel 0: got 0x11, expected 0x3f9 line 650: check_case(device.Get(), dispatch, one_d, texture(one_d, 1), source, copy, false, 0, 0, 1, true) ``` The first GPU case reads back its seed: the dispatch stored nothing. Cause, found by bisecting the translator against one fixed set of test programs (`ed94fbef` good, `a73a57e13` bad, first bad `9f98dcc61`): - `9f98dcc61` made `--descriptor-table tagged` the translator's default. A tagged module reads the kind word next to each table index and takes the array's fallback (index 0, where stores are dropped) when the word does not mark its T# as bound in that array. - The device fills the kind word only when the loaded shader library's index says a module reads it (`descriptor_table_census`); with no library the layout is plain and the word stays 0 (`d3d12_vulkan_device.cpp`, "descriptor table: plain (all 0 modules)"). - This test gives the device a bare `.spv` and no library. The sibling tests (`d3d12_m4_compute`, `d3d12_buffer_uav`, ...) load a folder with `index.json`, which is why they were not affected, and ctest runs this one with `--descriptors-only`, which is why CI did not see it. It is the shader, not the program: yesterday's `d3d12_texture_uav_test` fails with today's module, today's passes with yesterday's module. The fix is in the test: when it is given a shader and `LEONIDA_DESCRIPTOR_TABLE` is not set, it asks for the tagged table. The kind word is additive and a plain module never reads it, so that suits a module of either translation; the variable still decides when someone sets it. One file, test only. I left the device's no-library default alone: whether a device with no index should fill the kind word is a runtime decision for whoever owns that contract, and this does not depend on it. ### Tested `main` `a73a57e13`, `scripts\build_runtime.ps1` (MSVC 14.44.35207, RelWithDebInfo), llvm-mc 21.1.8, SPIRV-Tools v2026.4. | `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_texture_uav` | before | after | |---|---|---| | native | 0/1, 3 of 3 runs | 1/1, 3 of 3 runs | | `LEONIDA_W64_EMULATE=1` | 0/1 | 1/1 | | `LEONIDA_DESCRIPTOR_TABLE=plain` (forced mismatch, to show the variable still decides) | 0/1 | 0/1 | | the unpatched program with `LEONIDA_DESCRIPTOR_TABLE=tagged` | 1/1 | | After: `texture UAVs: 14 GPU cases (10 compared with WARP), format/range/refusal checks passed`. `ctest -R texture_uav` (the `--descriptors-only` mode, which this does not touch) passes. The records that list `cs_texture_uav` as failed so far (#2204) say the test program was not built there; this is the failure a machine that does build it gets. GPUs tested: NVIDIA GeForce RTX 4090, driver 591.86, Vulkan 1.4.325, Windows 11 Pro build 26200 AI-assisted: yes (Claude Code found the failure, bisected it, wrote the change and ran the tests) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Since 9f98dcc61 the translator's default is --descriptor-table tagged: a
module reads the kind word next to each index and takes the array's fallback
when its T# is not marked as bound there. The device fills that word only
when a shader library's index says a module reads it; with no library it
uses the plain layout. This test hands the device one .spv and no library,
so every store of cs_texture_uav landed on the fallback and the first GPU
case read back its seed (got 0x11, expected 0x3f9).

The kind word is additive and a plain module never reads it, so the test
asks for the tagged table unless LEONIDA_DESCRIPTOR_TABLE is set.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:24:46 +00:00
Author
Owner

@⁠Tyrannys on GitHub · 2026-11-26 12:48 UTC · original

Partial independent verification of head 409da28db73dd249c24c4aba175a33369ebbcc7b, with current main (a73a57e13) merged in, no conflicts.

Windows 11 Pro, RTX 4070 SUPER (NVIDIA 621.01), MSVC 19.52.37029, RelWithDebInfo.

  • Builds. d3d12_texture_uav (ctest, --descriptors-only) passes.
  • Full suite with the PR: 475/477, the same as plain main on this machine (xbox_present and d3d12_set_descriptor_heaps fail on main too).
  • Not run: the cs_texture_uav shader case (run_gpu_tests.py --filter cs_texture_uav). This machine has no llvm-mc and there is no pre-disassembled listing for that fixture, so I could not reproduce the before/after on this card. Someone with llvm-mc should still confirm it on NVIDIA.

Diff read: the variable is set before the D3D12 device is created, which is where descriptor_table_layout_from_env reads it; a value the user already set (including one longer than the 2-byte buffer, where getenv_s returns an error) is left alone. No problem found.

No game files used. AI-assisted (Claude Code).

**@⁠Tyrannys** on GitHub · 2026-11-26 12:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2261#issuecomment-7192479842) **Partial independent verification** of head `409da28db73dd249c24c4aba175a33369ebbcc7b`, with current `main` (`a73a57e13`) merged in, no conflicts. Windows 11 Pro, RTX 4070 SUPER (NVIDIA 621.01), MSVC 19.52.37029, RelWithDebInfo. - Builds. `d3d12_texture_uav` (ctest, `--descriptors-only`) passes. - Full suite with the PR: 475/477, the same as plain `main` on this machine (`xbox_present` and `d3d12_set_descriptor_heaps` fail on `main` too). - **Not run:** the `cs_texture_uav` shader case (`run_gpu_tests.py --filter cs_texture_uav`). This machine has no `llvm-mc` and there is no pre-disassembled listing for that fixture, so I could not reproduce the before/after on this card. Someone with `llvm-mc` should still confirm it on NVIDIA. Diff read: the variable is set before the D3D12 device is created, which is where `descriptor_table_layout_from_env` reads it; a value the user already set (including one longer than the 2-byte buffer, where `getenv_s` returns an error) is left alone. No problem found. No game files used. AI-assisted (Claude Code).
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-26 17:23 UTC · original

I ran the shader-backed NVIDIA check requested in the earlier review on a physical RTX 4090, Windows 11, driver 616.64, with LLVM 23.1.6. I applied the test-program change from 409da28db7 to the runtime at 935a2cd5b6 and passed the same validated tagged cs_texture_uav.spv to both executables.

Shader layout Environment Before With this PR
Tagged LEONIDA_DESCRIPTOR_TABLE unset First 1D texel stayed at 0x11, expected 0x3f9 All 14 GPU cases passed
Tagged Explicit tagged 14/14 passed 14/14 passed
Plain Explicit plain 14/14 passed 14/14 passed

The plain control used a second validated module produced from the same synthetic input with --descriptor-table plain. Each successful run also compared 10 cases against Windows WARP. As a negative control, forcing plain for the tagged module on the patched executable reproduced the first-texel mismatch. This confirms explicit caller settings still take effect. The patched executable also passed its descriptors-only mode.

AI-assisted hardware verification with OpenAI Codex (GPT-6).

**@⁠ecox982745** on GitHub · 2026-11-26 17:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2261#issuecomment-7198945792) I ran the shader-backed NVIDIA check requested in the [earlier review](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2261) on a physical RTX 4090, Windows 11, driver 616.64, with LLVM 23.1.6. I applied the test-program change from `409da28db7` to the runtime at `935a2cd5b6` and passed the **same** validated tagged `cs_texture_uav.spv` to both executables. | Shader layout | Environment | Before | With this PR | | --- | --- | --- | --- | | Tagged | `LEONIDA_DESCRIPTOR_TABLE` unset | First 1D texel stayed at `0x11`, expected `0x3f9` | All 14 GPU cases passed | | Tagged | Explicit `tagged` | 14/14 passed | 14/14 passed | | Plain | Explicit `plain` | 14/14 passed | 14/14 passed | The plain control used a second validated module produced from the same synthetic input with `--descriptor-table plain`. Each successful run also compared 10 cases against Windows WARP. As a negative control, forcing `plain` for the tagged module on the patched executable reproduced the first-texel mismatch. This confirms explicit caller settings still take effect. The patched executable also passed its descriptors-only mode. AI-assisted hardware verification with OpenAI Codex (GPT-6).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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