d3d12: ExecuteIndirect accepts the argument ranges newer D3D12 runtimes accept (D3D-EXECIND-RANGE-CARRY) #1066
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1066
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1066/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@klikso on GitHub · 2026-11-24 17:39 UTC · original
klikso:carry/d3d-execind-range→main· +63 −26 · 3 files · 1 commits · merged 2026-11-24 20:31 UTCClaimed in the coordination issue as: D3D-EXECIND-RANGE-CARRY
Fixes: #504
What and why
d3d12_execute_indirect_validationis red onmainon current Windows 11: the layer refuses fiveExecuteIndirectcalls that live WARP and the hardware driver both accept (#504, reported from seven machines today). #337 by @natterman12 fixed it and was verified independently on six hosts (RTX 5070 Ti, 4060 Ti, 5070, 2060 SUPER, Radeon 660M, and Linux replay on an RTX 3060), but its author closed it on 24 November along with his other open pull requests, so nothing open carries the fix.This is that one commit,
7f96cff90, cherry-picked onto currentmainwith its author kept. No change of mine is in it; the cherry-pick applied without conflicts.(max_count - 1) * stride + record_size, and checks no range at a zero count, in recording (d3d12_com.cpp) and in replay (vulkan_replay.h).@natterman12: this is your work. If you reopen #337 or want this branch, say so and I will close this.
The alternative is draft #306 (old PR 10041), which keeps the layer strict and relaxes the test only. Only one of the two should land.
Tested
Windows 11 26200.9974, D3D12Core and
d3d10warp.dll10.0.26100.9818, MSVC 14.44.35207 with Ninja,RelWithDebInfo, Windows SDK 10.0.26100.0, Vulkan 1.4.357. Built and run at base32950551e; the four commitsmaingained since do not touchruntime/.main32950551ectest -j 6d3d12_execute_indirect_validationOn
mainthe five failing rows are the ones in #504, eachlayer=0 warp=1 hw=1 expected=0: the two aligned offsets past the buffer atmax=0, and the three padded-stride exact fits (240+20,220+40,244+20in a 256-byte buffer). The two new overrun rows (244+16>256,224+20+16>256) are refused by the layer, WARP and the hardware alike.python -I scripts/check_no_game_data.pyon the three changed files: no hits.git diff --check: clean.GPUs tested: NVIDIA GeForce RTX 3060 Ti (Ampere), driver 621.14, Windows 11 26200
AI-assisted: yes (Claude Code; built, run and measured on the machine above)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed: n/a (no translator rule).🤖 Generated with Claude Code
@KernelSmoker on GitHub · 2026-11-24 17:42 UTC · original · approved these changes
Reviewed the range change on head
10f7fc21c7. The checked formula, (max_count - 1) * stride + record_size, matches the bytes consumed by the final indirect record; zero count performs no Vulkan dispatch iterations. The Vulkan replay uses the same final-record range, with alignment retained for zero-count offsets. The added overrun rows distinguish cases where the record itself exceeds the resource. The PR merges cleanly onto current main; no-game-data and diff checks pass; an independent boundary arithmetic check passed 8/8. This Linux host cannot run the Windows D3D12/WARP/hardware integration test; those results are PR-author-reported and not counted as locally reproduced.@Miici0 on GitHub · 2026-11-24 20:04 UTC · original
Tested on a 7th host: NVIDIA GeForce RTX 4070 SUPER (Ada), driver 621.24, Windows 11 build 26300.9974, Windows SDK 10.0.28000.0, Vulkan SDK 1.4.363.1, MSVC 19.42 with Ninja, RelWithDebInfo. Built and ran at
10f7fc21c(this branch).ctest -R d3d12_execute_indirect_validation: 51 parity cases, 0 failures - matches the numbers in the PR description exactly.No game files needed. AI-assisted (Claude Code).
@Gefik23 on GitHub · 2026-11-24 20:28 UTC · original
Tested
10f7fc21con NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200 (d3d12core.dll 10.0.26100.7309), native Windows: pass.This is a 26100-based d3d12core rather than 26300, and it already has the relaxed behaviour: on main @
6293c1cthe test failed the same five cases (arg_offset=260 >width (max=0 no-op), arg_offset=U64MAX-3 aligned (max=0 no-op), draw stride=20 off=240 max=1, draw stride=20 off=220 max=2, dispatch stride=20 off=244 max=1), with WARP and HW both returning S_OK. So the fix is needed on stock Windows 11, not only 26300+.Built at this head with
scripts\build_runtime.ps1(MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0).ctest -R ^d3d12_execute_indirect_validation$ -V: passed, "51 parity cases (WARP=live, HW=NVIDIA GeForce RTX 4060), positive GPU dispatch ok, 0 validation errors, 0 failures".ctest -C RelWithDebInfo: 297/297 passed (game-data tests skipped, LEONIDA_GAME_DIR unset).AI-assisted (Claude Code ran the build and tests). No game files.
@adrianmjim on GitHub · 2026-11-24 20:31 UTC · original
Tested
10f7fc21capplied onto main23c459644on an AMD Radeon RX 7900 XT: d3d12_execute_indirect_validation fails on main (5 failures) and passes with this PR, 4/4 runs. No new failures in the full ctest run.Hardware/software: AMD Radeon RX 7900 XT (RDNA3), AMD driver 32.0.32029.2010 (Adrenalin 26.11.2), Windows 11 build 26300, D3D12Core.dll and d3d10warp.dll 10.0.26100.9818, VS 2022 (x64, RelWithDebInfo), Vulkan SDK 1.4.363.0. No game files.
Build:
Targeted test:
23c45964410f7fc21cLEONIDA_VK_VALIDATION=1On main the five failures are the five rows this PR marks
host_varies, eachlayer=0 warp=1 hw=1 expected=0. With the PR, the layer accepts them, and this host agrees on all of them:The AMD hardware path answers the same as WARP on every row of the table, including the two new overrun rows (
244+16>256,224+20+16>256), which the layer, WARP and the 7900 XT all refuse. So the wider rule is what D3D12Core 10.0.26100.9818 does on AMD too, not only on NVIDIA.Full ctest, run once on each build:
The only difference is d3d12_execute_indirect_validation going from failed to passed. The other four fail on main on this machine too and are unrelated (d3d12_clear: #787; d3d12_pipeline_library_host: #533, merged after this base; d3d12_texture_tiles: #964).
I also read the change before running it. I found no problem with the range rule itself: recording and replay use the same bound,
(max_count - 1) * stride + record_sizecannot wrap with 32-bit count and stride widened to 64 bits, and it matches the Vulkan indirect VUIDs. Three comments claim more than the code does. None of them blocks this PR:dispatch20at 244): the comment says a rule that let Vulkan read past the buffer would show up as a validation error. It cannot here.vkCmdDispatchIndirecttakes no stride, so Vulkan only sees244 + 12 <= size, the same check as the existingdispatch12call. Also,argsis a DEFAULT buffer placed in the arena (d3d12_vulkan_device.cpp,create_buffer:binding.buffer = device_.arena.buffer,binding.buffer_offset = arena_offset_), so validation checks against the whole arena VkBuffer, not the 256-byte resource. Only the layer's ownindirect_rangecheck againstbinding.sizeguards the resource bounds.max=0call at offset 260: it never reaches replay.CommandList::execute_indirectreturns beforeappendwhenmax_countis 0 (command_list.h:878), so it exercises recording only.vulkan_replay.h, themax_count == 0branch ("reads nothing and needs no range"): that only holds because the shim never sends a zero count. A zero-count counted dispatch built directly would makeprepare_counted_dispatchreturn false (vulkan_indirect_dispatch_count.h:65,!max_count), and the list would fail as unsupported. Rejecting a zero count in replay, or skipping it at emit, would make the comment true.Not tested: NVIDIA, Intel, other AMD drivers, Wine/Proton.
@aslan2142 on GitHub · 2026-11-24 20:31 UTC · original
Merged. This was compared with the test-only alternative (#306 / #749), and it is the better fix because it changes the layer itself:
(max_count-1)*stride + record_sizeand skip the range check at a zero count. That is the same bound Vulkan's indirect draws use, and what current D3D12 runtimes accept.10f7fc21c(51 parity cases, 0 failures). The portable replay tests pass locally on Linux, and it merges cleanly.AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).