RX 5700 XT (RDNA 1): ExecuteIndirect Dispatch with max count > 1 runs only the first command (startup_indirect_count_hardware) #2626
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#2626
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@ColorMeBoom on GitHub · 2026-11-25 23:30 UTC · original
Commit or build
ae5d482aReproduction
Expected behavior
startup_indirect_count_hardwarepasses, asstartup_indirect_count_warpdoes. With the GPU-written count word 2, the first two of the three Dispatch records(2,1,1),(1,2,1),(1,1,3)run and the result word grows by 15 (0x31415926to0x31415935).In general,
ExecuteIndirectwith a Dispatch command signature andMaxCommandCount> 1 runs min(count, MaxCommandCount) commands, or all of them without a count buffer.Observed behavior
At commit
ae5d482a,startup_indirect_count_hardwarefails at its first case:The result grew by 3, which is record 0
(2,1,1)alone.startup_indirect_count_warppasses.Standalone check without
d3d12_xs.ei2.cpp(below) uses plain D3D12. Anumthreads(1,1,1)compute shader atomically adds, for each group,1 + x + 10y + 100zto word 0 and 1 to word 1. It runs that shader throughExecuteIndirectwith a 12-byte Dispatch signature, max count 3, and no count buffer, over the records(2,1,1),(1,2,1),(1,1,3). The two numbers in each cell are groups run / expected and result sum / expected.(1,1,1)recordsnumthreads(64,1,1)ExecuteIndirectcalls, max count 1 eachAn earlier version tested the fixture's own layout: count word at byte 4 of the argument buffer, records at byte 8. It also tested the count in a separate buffer, records at byte 16 with stride 12 or 16, and a count word of 3. Each gave 3 on the RX 5700 XT and the expected 15 or 318 on WARP. In every multi-command variant the adapter runs exactly one command, and separate single-command calls are exact. No call returned an error, and the device was not removed.
Driver versions. I forced each display driver INF onto the adapter (no reboot) and reran
ei2.exe:I did not test older drivers, other RDNA 1 adapters or the debug layer, and I did not find this in AMD's release notes. The cause is not established. Variant 8 suggests that one call per record would be exact on this adapter, but I did not test that with a GPU-written count.
Other
_hardwarefailures on this adapter, for completeness. The fulldevsuite gave 1,855/1,862, and three of the failures passed when rerun serially. The remaining three match results already indocs/experiments.md:gpu_alias_lookup_writes_hardware:array_atomics ... expected=64 actual=256,256,256,256, with 0 fixture mismatches.gpu_alias_window_hardware:gpu=0x300081000 gpu_page_aligned=0, a 4 KiB aligned GPU base.compute_store_aot_mac_f32_hardware: 320/320 words match. The hardware-onlyfused mad()mutation is not detected, because DXC emitsFMad(op 46) forprecise mad()and this adapter returns the unfused result.ei2.cppAI-assisted with Claude Code (Claude Opus 5.5).
Environment
Windows 11 Home build 26200.9974, D3D12Core 10.0.26100.9818
VS 2022 Build Tools, MSVC 19.44.35230, Windows SDK 10.0.26100.0, DXC 1.9.2602.17, Python 3.12.10
AMD Radeon RX 5700 XT (RDNA 1, vendor 1002, device 731f), driver 32.0.21045.29003 (Adrenalin 26.11.2), hardware backend
Debug layer unavailable (Graphics Tools not installed)
WARP reference: 10.0.26100.9818
Checklist
@R0Y00 on GitHub · 2026-11-25 23:53 UTC · original
Thanks for reproducing this with plain D3D12. The strongest comparison is the no-count-buffer case: three records produce 2 groups and sum 3 on the RX 5700 XT, while three separate calls produce 7 groups and sum 318 on the same adapter. That puts the observed difference outside the shim on this machine. Let’s keep the hardware test’s strict readback. If another RDNA 1 owner can run the standalone mixed-record and split-call cases, please post the adapter, Windows build, driver, and both group/sum pairs. A matched run with the GPU-written count on a second adapter would help distinguish the scope before considering a workaround.
@RavenCurseBurg on GitHub · 2026-11-26 00:12 UTC · original
I ran the published nine-case standalone program on Windows 11 build 26100.9711. The original source block was SHA-256
10b5264dbb2fb0547229ce9b3bc75095ffdac452cd34b98844ce131d211aa50d. For the Intel run the only edit was selecting DXGI's minimum-power adapter. Each row below gives the observed group count and weighted sum.On the RTX 4060 and WARP I also ran the project's
startup_indirect_dispatch <hardware|warp> countat the tested integration. With the GPU-written count 2 both returned0x31415935. Count 9 clamped to three records and returned0x31415a64, and count 0 retained0x31415926. Both strict runs exited 0.For a negative control I limited the standalone program's multi-command calls to one record, keeping the expected groups and sums. The mixed case then gave 2 groups and sum 3 on RTX and WARP, and the split-call case still gave 7 and 318. Eight of the nine variants detected the change. The cause on RDNA 1 remains open. Build and hosted WARP controls
The project's count fixture currently selects the first eligible hardware adapter, even with
XBOX2WINDOWS_ADAPTER=Intel. I’ll follow up on adapter selection in that fixture so owners of multi-GPU systems can run the GPU-written count on a named card with the same strict readback.@R0Y00 on GitHub · 2026-11-26 00:29 UTC · original
The Intel UHD 770 and RTX 4060 results give us two hardware controls for the standalone test. The one-record mutation also reproduces the RX 5700 XT’s 2-group / 3-sum pattern on those controls. Please take the adapter-selection follow-up for the project’s count fixture. Reuse the existing adapter-selection helper where possible, print the adapter and driver actually selected, and add a control that a named unavailable adapter produces a clear diagnostic instead of silently running on another one. Keep the strict zero, two-record, and clamped count readbacks. A second RDNA 1 adapter is still the open hardware check.
@RavenCurseBurg on GitHub · 2026-11-26 00:34 UTC · original
The project's GPU-written count fixture now ran on the second physical card using
XBOX2WINDOWS_ADAPTER=uHd GrApHiCs 770. On the Intel UHD Graphics 770 (32.0.101.5973, Windows 11 build 26100.9711), count 2 executed two records and returned0x31415935. Count 9 executed three records at the maximum and returned0x31415a64. Count 0 retained0x31415926. Omitting the count buffer executed all three records and returned0x31415a64. The printed adapter and driver confirm which device executed the dispatches.I repeated the same readbacks on the RTX 4060 and WARP. The test commands, source and runtime revisions are in PR #2652. An independent RDNA 1 run would still help identify the scope of the RX 5700 XT observation.
@ColorMeBoom on GitHub · 2026-11-26 01:06 UTC · original
Thanks for the RTX 4060, UHD 770 and WARP controls. One more RX 5700 XT observation follows, then a workaround I have tested locally but not proposed as a PR. The second RDNA 1 adapter is still open, so I'd like your view on scope first.
A single-command call also ignores its count buffer. Same machine and driver as above (32.0.21045.29003, Windows 11 build 26200.9974, debug layer unavailable). Records
(2,1,1),(1,2,1),(1,1,3), each call withMaxCommandCount1, and a count buffer holding a per-record 0 or 1 written by a compute pass:So on this adapter, splitting into single-command calls is exact only when no count buffer is used.
Workaround that is exact here. A compute pass copies the count word and records into a scratch buffer, and rewrites record
ias itself whilei < min(count, MaxCommandCount)and as(0,0,0)otherwise. ThenMaxCommandCountsingle-command calls without a count buffer read the rewritten records. In a standalone program, counts 0, 1, 2, 3 and 9 matched on the RX 5700 XT and on WARP.I wired this into slot 61 on a local branch based on
ae5d482a, not pushed. Main has not changedlist_execute_indirectsince then. The pass replaces the compute root and pipeline, so the title's pipeline, compute root and upload SRVs (slots 25, 33 and 43) are set again before the calls, as the indexed-draw validation already does and as #2470 does after its Dispatch. Two parts change the fixture side, which I'd like your opinion on:startup_indirect_count_hardwarepasses on the RX 5700 XT (counts 2, 9 and 0, omitted writer, no count buffer, five refusals). WithX2W_SPLIT_INDIRECT_DISPATCH=0it fails as before (0x31415929, expected0x31415935). Newstartup_indirect_count_split_(warp|hardware)tests run the same cases with the split forced, and both pass. The fulldevsuite gave 1,861/1,864; the three failures are the RX 5700 XTgpu_alias_window_hardware,gpu_alias_lookup_writes_hardwareandcompute_store_aot_mac_f32_hardwareresults already reported, and the 131 capability skips are unchanged.The split covers Dispatch with a desktop compute pipeline only, not the translated slot 67 path in #2470 or the indirect follow-up under #2492.
Questions before any PR:
X2W_SPLIT_INDIRECT_DISPATCH=1) now and enabled by device id later?startup_indirect_count_hardwarestay unsplit, so it keeps showing the driver behavior, with the_splittests covering the workaround?AI-assisted with Claude Code (Claude Opus 5.5).
@R0Y00 on GitHub · 2026-11-26 01:12 UTC · original
Yes, a narrow opt-in PR is welcome now. Keep the native Dispatch path as the default on every adapter. A second RDNA 1 result is still needed before considering any automatic enablement. Keep
startup_indirect_count_hardwareunsplit and strict so it can continue to expose the reported driver behavior. Exercise the opt-in in its own WARP/hardware tests, with the GPU-written counts 0, 1, 2, 3 and above max, and verify that a count of zero leaves the output untouched.Prefer binding the output UAV through the existing shim-tracked path if the fixture can do that. A fixture-only hook is acceptable if it feeds the same binding and restoration code as the real caller and stays outside the guest ABI. Please demonstrate that a subsequent normal dispatch sees its original compute root and bindings, and that scratch records remain valid until the submission retires. Scope this to bounded desktop-PSO Dispatch. Leave the translated path in #2470 and other indirect command kinds independent.
@thepatrickworld on GitHub · 2026-11-26 02:43 UTC · original · edited 2026-11-26 03:02 UTC
Independent AMD RDNA 4 result on
0c8f5dab:startup_indirect_count_hardwarepasses on this adapter.Not the second RDNA 1 adapter you asked for — a different AMD generation, on the same fixture, at a revision whose indirect path is unchanged from the report.
Why this revision is comparable
0c8f5dab(the report is atae5d482a),git rev-parse HEADprinted on the machine, tracked tree clean.list_execute_indirectinsrc/startup_stubs/d3d12_xs_device.cppis byte-identical between the two revisions: the whole function, signature through closing brace,diffempty. It ends in one call that hands the driver the whole batch —list->ExecuteIndirect(<real desktop signature>, count, draw_arguments, draw_offset, counts, counts ? count_offset : 0)— with no per-record loop anywhere. The only otherExecuteIndirectinvocation insrc/is the translated-draw one (d3d12_draw.inl:2321,:2324), which always passesMaxCommandCount1 and is not on this path.tests/startup_indirect_dispatch.cppbetweenae5d482aand0c8f5dabis adapter selection (adapter_name_filter.h,AdapterNameFilter,filter.no_match()).So the same forwarding code ran here, and what differs from the report is the adapter and the driver package.
Environment
Windows 11 25H2, build
10.0.26200.9974. AMD Radeon RX 9070 XT (PCI\VEN_1002&DEV_7550, gfx1201, RDNA 4), driver32.0.32029.2010. MSVC19.44.35230.0(BuildTools14.44.35207), CMake4.4.4, Ninja, presetdev(Debug). D3D12 debug layer not installed (d3d12SDKLayers.dllabsent).Commands
Run from the repository root:
Then the fixture directly, three times, to see the readbacks rather than the verdict:
Observed
ctestselected six tests and reported100% tests passed out of 6;startup_indirect_count_hardwarepassed in 0.27 s. The capture does not echo the selection regex; the six names in it are the six that regex matches inCMakeLists.txt(add_testat lines 1515-1517,SKIP_RETURN_CODE 77at 1520), and none returned 77. No line of it saysSkipped.The fixture, verbatim:
Read
executed=with care: the fixture computes it (min(count word, max count),tests/startup_indirect_dispatch.cpp:258-259), so it is an expectation, not a measurement. The measured side is the result word, read back from the compute shader's output buffer, and it moved by exactly 15 for count 2 and by 318 for count 9 and for the no-count-buffer call — 3 + 12 + 303, the sum over all three records under the fixture's1+x+10y+100zweight. A single executed record would move it by 3, which is the0x31415929in the report. The fixture printed noword N: got ...line and exited 0, and the three consecutive runs produced identical lines above.The five refusal controls (count offset without a count buffer, count word outside a placed buffer, invalid count offset, argument record outside a placed buffer, missing signature) each left the sentinel
0x31415926untouched.Scope, attributed
ae5d482a0c8f5dabThese rows are reported outcomes from different hosts, Windows builds, driver packages and revisions. They are not a controlled comparison.
Limits
32.0.21045.xpackage on this card to hold the driver still.D3D12GetDebugInterfaceattests/startup_indirect_dispatch.cpp:310-313, the stored-message loop at:439-451) is skipped: no D3D12 validation message was inspected. This is a readback result, not a validated one.AI-assisted; runs executed on the machine above.