Skip to content

test(runtime): read cs_indirect_dispatch_count's root UAV from s4:s5 (fixes d3d12_indirect_dispatch_count) - #6210

Open
ttd0x wants to merge 1 commit into
ItsNotRexed:mainfrom
ttd0x:patch-1
Open

ttd0x wants to merge 1 commit into
ItsNotRexed:mainfrom
ttd0x:patch-1

Conversation

@ttd0x

@ttd0x ttd0x commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #6162.

Claimed in the coordination issue as: #6089 (comment)

Depends on: none. #6191 touches vulkan_indirect_dispatch_count.h and a new test, not this fixture.

What and why

runtime/test/glsl/cs_indirect_dispatch_count.comp read its root UAV from pc.s[0], pc.s[1]. #4312 (D3D-448) moved the compute root arguments to start at s4 (pack_stage) and updated cs_user_data.comp, cs_set0_sample.comp and cs_sg_probe.comp, but not this fixture. pc.s[0..1] are the driver's block and stay 0, so the shader wrote to the wrong address and the layer's counters stayed 0/0 (d3d12_indirect_dispatch_count failed on main).

The fix reads the root UAV from pc.s[4], pc.s[5] and corrects the header comment (wrapped to two lines). Nothing else changes. A scan of the other runtime/test/glsl/*.comp files finds no other read of pc.s[0]/pc.s[1].

Tested

NVIDIA GeForce RTX 2080 Ti, driver 610.88, Windows 11 Pro 10.0.26200, MSVC from VS 18, CMake 4.4.4, Vulkan SDK 1.4.363.1.

  • Before (main 561b65a83): ctest -R ^d3d12_indirect_dispatch_count$ fails with count 0 update 1: host 6/10, layer 0/0, expected 6/10, on every run.
  • After (the same one-line change rebuilt at 561b65a83): Test #165: d3d12_indirect_dispatch_count ... Passed. The comment wrap was not in that local run; CI builds it.
  • Bisect (first-parent, limited to runtime/src and runtime/shims, each step a real build and ctest): good 43f41a1d8, bad f54c6395e (the merge of D3D-448: console root-argument layout, measured for compute and used there #4312).

AI-assisted: yes (Claude Code).

Checklist

  • 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. (Not applicable: test fixture only.)

ItsNotRexed#4312 moved the compute root arguments to start at s4 and updated cs_user_data.comp, cs_set0_sample.comp and cs_sg_probe.comp, but not this fixture, which still read the root UAV from pc.s[0], pc.s[1] (the driver's block, zero). d3d12_indirect_dispatch_count then failed on main with "count 0 update 1: host 6/10, layer 0/0, expected 6/10". Read it from pc.s[4], pc.s[5] and fix the header comment.

Fixes ItsNotRexed#6162. Claim: ItsNotRexed#6089 (comment)

AI-assisted (Claude Code).
@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 6e210ed on Windows 11: pass on NVIDIA GeForce RTX 4090 (driver 32.0.16.2101) and AMD Radeon(TM) Graphics (driver 32.0.21043.5001).

On parent 561b65a, both GPUs fail at the same comparison: count 0 update 1: host 6/10, layer 0/0, expected 6/10. With the shader reading s4:s5, all eight native WARP / Vulkan comparisons pass on each GPU. Both runs report zero validation errors. The cases cover zero count, count above the maximum, nonzero offsets, and a count updated by the GPU.

I built and ran the changed fixture on both revisions:

  • cmake --build <build> --config RelWithDebInfo --target d3d12_indirect_dispatch_count_test -j 8
  • ctest --test-dir <build> -C RelWithDebInfo -R "^d3d12_indirect_dispatch_count$" -V

I set LEONIDA_VK_VALIDATION=1. The NVIDIA run used LEONIDA_VK_DEVICE=4090 and VK_LOADER_DRIVERS_DISABLE=amd. The AMD run used Radeon and nv. I checked the device line in all four runs.

AI-assisted.

@SirKingg SirKingg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6e210ed63fb88ec98ed32bc6fa0bbe669ac5373c: no blocking defect. The test binds one root UAV; pack_stage(Compute) starts at s4, root descriptors occupy two dwords, and replay copies those dwords into the push constants before indirect dispatch. The fixture now reads the matching pair.

Windows, MSVC 19.44, RTX 4070 Ti / NVIDIA 610.88, Vulkan SDK 1.4.363.0: built d3d12_indirect_dispatch_count_test; ctest --test-dir <build> -C RelWithDebInfo -V -R '^d3d12_indirect_dispatch_count$' passed with validation on and off, no skips. With validation on, loader diagnostics confirmed VK_LAYER_KHRONOS_validation was inserted, synchronization validation was requested, and no validation errors were reported. Eight real WARP/Vulkan GPU readback comparisons cover 0, 1, max and above-max counts, offsets and GPU count overwrite. spirv-val --target-env vulkan1.2 passed for the generated fixture.

Negative control: compiled the synthetic fixture from parent 561b65a8 and substituted only its generated SPIR-V in the same build. CTest failed as expected: count 0 update 1: host 6/10, layer 0/0, expected 6/10. Restoring this PR fixture passed again. No game files.

Coordination note: #5792 is open with the same functional change; only one should land. CI was pending at review time. AI-assisted.

@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@ttd0x @KoertLichtendonk, comparing as the coordinator asked: this is the same one-line change as #5792 (D3D-594, opened 12:06 UTC, claimed in #5781). Both make cs_indirect_dispatch_count.comp read its root UAV from s[4]:s[5]. #5792 has an approving review (Kam471) and passing runs on Intel UHD 750 / 770, RTX 3060 / 4090 / 5060 Ti / 5070 Ti / 5080 / 5090, RX 9070 XT and the 9800X3D iGPU (RADV), each with the failing control on 561b65a8. Unless you see something #5792 misses, I'd suggest keeping #5792 and closing this one. AI-assisted (Claude Code).

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.

d3d12_indirect_dispatch_count fails on main since #4312: cs_indirect_dispatch_count.comp still reads its root UAV from s0:s1

4 participants