Skip to content

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

Closed
CodingRule wants to merge 1 commit into
ProjectLeonida:mainfrom
CodingRule:texture-uav-test-tagged-table
Closed

CodingRule wants to merge 1 commit into
ProjectLeonida:mainfrom
CodingRule:texture-uav-test-tagged-table

Conversation

@CodingRule

Copy link
Copy Markdown
Contributor

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

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

… .spv (GPU-TEXTURE-UAV-1D-REGRESSION)

Since 9f98dcc 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 <noreply@anthropic.com>
@Tyrannys

Copy link
Copy Markdown
Contributor

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).

@ecox982745

Copy link
Copy Markdown

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).

@RenoThaGutta

Copy link
Copy Markdown
Contributor

Additional independent hardware evidence for the historical head 409da28db73dd249c24c4aba175a33369ebbcc7b: RTX 4080, NVIDIA 621.01, native Windows 11 Pro, baseline 02f71ccfe78160997a02950607be583af87e1180. I see this PR is closed without merge; this records measurements only.

The unchanged baseline executable fails cs_texture_uav by default (first texel stays 17, expected 1017), but passes with LEONIDA_DESCRIPTOR_TABLE=tagged in both native and wave64-emulated runs. After applying only this PR's test-program change and rebuilding that target, the default environment passes in both modes. Forcing plain with the tagged module on the patched executable fails again in the native negative control. Direct shader-backed execution passes 14 GPU cases, 10 compared with WARP; descriptor-only CTest passes 1/1.

Report-only #2558 includes reproduction, source heads, complete-suite before/after counts, and coverage limits. Counts/controls independently checked against raw logs by a second agent. Synthetic inputs only, no game files or services. Existing fix remains yours. AI-assisted: OpenAI Codex.

DadaCap pushed a commit that referenced this pull request Nov 28, 2026
…01-02F71CCF)

Record independent synthetic GPU validation at baseline 02f71cc and with existing PRs #1518 and #2261. Includes before/after counts, focused controls, exact source heads, and coverage limits. One report file only; no performance benchmark or game data.
DadaCap pushed a commit that referenced this pull request Nov 28, 2026
…U-RX9060XT-WIN)

First record of an RX 9060 XT (RDNA4, GFX1200 / Navi 44): run_gpu_tests.py
247/268 passed, 19 skipped, 2 failed (cs_imgatomic_ext #1518, cs_texture_uav
#2261) natively and with LEONIDA_W64_EMULATE=1; build.py and check.py with
#1444; ctest with the four known failures and their pull requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants