RX 5700 XT (RDNA 1): ExecuteIndirect Dispatch with max count > 1 runs only the first command (startup_indirect_count_hardware) #2618

Open
opened 2026-11-25 23:30:41 +00:00 by ColorMeBoom · 7 comments
ColorMeBoom commented 2026-11-25 23:30:41 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ColorMeBoom on 2026-11-25T23:30:41Z.


Commit or build

ae5d482a

Reproduction

cmake --preset dev
cmake --build --preset dev --target startup_indirect_dispatch
ctest --preset dev --no-tests=error -R '^startup_indirect_count_hardware$' -V

# Standalone D3D12 program, no project code (source under Observed behavior)
cl /EHsc /O2 /std:c++17 ei2.cpp
.\ei2.exe        # high-performance adapter
.\ei2.exe warp   # WARP reference

Expected behavior

startup_indirect_count_hardware passes, as startup_indirect_count_warp does. 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 (0x31415926 to 0x31415935).

In general, ExecuteIndirect with a Dispatch command signature and MaxCommandCount > 1 runs min(count, MaxCommandCount) commands, or all of them without a count buffer.

Observed behavior

At commit ae5d482a, startup_indirect_count_hardware fails at its first case:

adapter: AMD Radeon RX 5700 XT, debug layer unavailable
driver: 32.0.21045.29003
GPU writer: count word=2, executed=2, result=0x31415929 (expected 0x31415935)
word 11: got 0x31415929, expected 0x31415935

The result grew by 3, which is record 0 (2,1,1) alone. startup_indirect_count_warp passes.

Standalone check without d3d12_xs. ei2.cpp (below) uses plain D3D12. A numthreads(1,1,1) compute shader atomically adds, for each group, 1 + x + 10y + 100z to word 0 and 1 to word 1. It runs that shader through ExecuteIndirect with 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.

Variant RX 5700 XT WARP 10.0.26100.9818
1 three mixed records, direct queue, root UAV 2/7, 3/318 7/7, 318/318
2 three (1,1,1) records 1/3, 1/3 ok
3 records of 64 groups each 64/192, 2080/223968 ok
4 compute queue 2/7, 3/318 ok
5 UAV through a descriptor table 2/7, 3/318 ok
6 numthreads(64,1,1) 2/7, 3/318 ok
7 arguments read straight from an UPLOAD heap 2/7, 3/318 ok
8 three ExecuteIndirect calls, max count 1 each 7/7, 318/318 ok
9 max count 4 (one zero record extra) 2/7, 3/318 ok

An 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:

Adrenalin Driver Result
26.11.2 32.0.21045.29003 only the first command (8/9 variants fail)
26.10.1 32.0.21045.16010 same
25.9.1 32.0.21025.10016 same
24.12.1 32.0.12033.1030 same
23.12.1 31.0.23013.1023 same

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 _hardware failures on this adapter, for completeness. The full dev suite gave 1,855/1,862, and three of the failures passed when rerun serially. The remaining three match results already in docs/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-only fused mad() mutation is not detected, because DXC emits FMad (op 46) for precise mad() and this adapter returns the unfused result.
ei2.cpp
// Variant sweep: which conditions make ExecuteIndirect(Dispatch) run only its first command?
#include <d3d12.h>
#include <dxgi1_6.h>
#include <d3dcompiler.h>
#include <wrl/client.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#pragma comment(lib, "d3d12.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")
using Microsoft::WRL::ComPtr;
#define CK(x) do { HRESULT h_ = (x); if (FAILED(h_)) { std::printf("FAIL %s 0x%08x\n", #x, (unsigned)h_); std::exit(1); } } while (0)

// Each group atomically adds 1 + x + 10y + 100z to word 0 and 1 to word 1, so the readback shows
// how many groups ran and which records they came from.
static const char* kAtomic = R"(
RWByteAddressBuffer o : register(u0);
[numthreads(1,1,1)] void main(uint3 g : SV_GroupID) { uint p; o.InterlockedAdd(0, 1 + g.x + 10*g.y + 100*g.z, p); o.InterlockedAdd(4, 1, p); }
)";
static const char* kTable = R"(
RWByteAddressBuffer o : register(u0);
[numthreads(1,1,1)] void main(uint3 g : SV_GroupID) { uint p; o.InterlockedAdd(0, 1 + g.x + 10*g.y + 100*g.z, p); o.InterlockedAdd(4, 1, p); }
)";
static const char* kWide = R"(
RWByteAddressBuffer o : register(u0);
[numthreads(64,1,1)] void main(uint3 g : SV_GroupID, uint t : SV_GroupIndex) { uint p; if (t == 0) { o.InterlockedAdd(0, 1 + g.x + 10*g.y + 100*g.z, p); o.InterlockedAdd(4, 1, p); } }
)";

ComPtr<ID3D12Device> dev;
ComPtr<ID3D12Resource> buffer(D3D12_HEAP_TYPE type, UINT64 bytes, D3D12_RESOURCE_STATES state, bool uav)
{
    D3D12_HEAP_PROPERTIES hp{type};
    D3D12_RESOURCE_DESC d{D3D12_RESOURCE_DIMENSION_BUFFER, 0, bytes, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0},
                          D3D12_TEXTURE_LAYOUT_ROW_MAJOR, uav ? D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS : D3D12_RESOURCE_FLAG_NONE};
    ComPtr<ID3D12Resource> r;
    CK(dev->CreateCommittedResource(&hp, D3D12_HEAP_FLAG_NONE, &d, state, nullptr, IID_PPV_ARGS(&r)));
    return r;
}
ComPtr<ID3D12PipelineState> make_pso(ID3D12RootSignature* root, const char* src)
{
    ComPtr<ID3DBlob> cs, e;
    CK(D3DCompile(src, std::strlen(src), nullptr, nullptr, nullptr, "main", "cs_5_0", 0, 0, &cs, &e));
    D3D12_COMPUTE_PIPELINE_STATE_DESC pd{}; pd.pRootSignature = root; pd.CS = {cs->GetBufferPointer(), cs->GetBufferSize()};
    ComPtr<ID3D12PipelineState> p; CK(dev->CreateComputePipelineState(&pd, IID_PPV_ARGS(&p))); return p;
}

struct Opt { const char* name; std::vector<UINT> recs; UINT maxCount; bool compute; bool table; bool wide; bool split; bool upload_args; };

int main(int argc, char** argv)
{
    const bool warp = argc > 1 && !std::strcmp(argv[1], "warp");
    ComPtr<IDXGIFactory6> fac; CK(CreateDXGIFactory1(IID_PPV_ARGS(&fac)));
    ComPtr<IDXGIAdapter1> ad;
    if (warp) CK(fac->EnumWarpAdapter(IID_PPV_ARGS(&ad)));
    else CK(fac->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&ad)));
    DXGI_ADAPTER_DESC1 dd; ad->GetDesc1(&dd); std::printf("adapter: %ls\n", dd.Description);
    CK(D3D12CreateDevice(ad.Get(), D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&dev)));

    D3D12_ROOT_PARAMETER rp{}; rp.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
    D3D12_ROOT_SIGNATURE_DESC rd{1, &rp}; ComPtr<ID3DBlob> s, e; ComPtr<ID3D12RootSignature> rootUav, rootTable;
    CK(D3D12SerializeRootSignature(&rd, D3D_ROOT_SIGNATURE_VERSION_1, &s, &e));
    CK(dev->CreateRootSignature(0, s->GetBufferPointer(), s->GetBufferSize(), IID_PPV_ARGS(&rootUav)));
    D3D12_DESCRIPTOR_RANGE range{D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, 0};
    D3D12_ROOT_PARAMETER tp{}; tp.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; tp.DescriptorTable = {1, &range};
    rd.pParameters = &tp; CK(D3D12SerializeRootSignature(&rd, D3D_ROOT_SIGNATURE_VERSION_1, &s, &e));
    CK(dev->CreateRootSignature(0, s->GetBufferPointer(), s->GetBufferSize(), IID_PPV_ARGS(&rootTable)));
    auto psoUav = make_pso(rootUav.Get(), kAtomic), psoTable = make_pso(rootTable.Get(), kTable), psoWide = make_pso(rootUav.Get(), kWide);
    D3D12_INDIRECT_ARGUMENT_DESC arg{D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH};
    D3D12_COMMAND_SIGNATURE_DESC sd{12, 1, &arg}; ComPtr<ID3D12CommandSignature> sig; CK(dev->CreateCommandSignature(&sd, nullptr, IID_PPV_ARGS(&sig)));
    D3D12_DESCRIPTOR_HEAP_DESC hd{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 1, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE};
    ComPtr<ID3D12DescriptorHeap> heap; CK(dev->CreateDescriptorHeap(&hd, IID_PPV_ARGS(&heap)));

    const std::vector<UINT> mixed = {2,1,1, 1,2,1, 1,1,3};
    const std::vector<UINT> ones = {1,1,1, 1,1,1, 1,1,1};
    const std::vector<UINT> big = {64,1,1, 1,64,1, 1,1,64};
    Opt opts[] = {
        {"1 mixed records, direct queue, root UAV",          mixed, 3, false, false, false, false, false},
        {"2 three (1,1,1) records",                          ones,  3, false, false, false, false, false},
        {"3 large records (64 groups each)",                 big,   3, false, false, false, false, false},
        {"4 compute queue",                                  mixed, 3, true,  false, false, false, false},
        {"5 UAV through descriptor table",                   mixed, 3, false, true,  false, false, false},
        {"6 64-thread groups",                               mixed, 3, false, false, true,  false, false},
        {"7 args read straight from UPLOAD heap",            mixed, 3, false, false, false, false, true},
        {"8 three separate ExecuteIndirect calls, max 1",    mixed, 3, false, false, false, true,  false},
        {"9 maxCount 4 (one zero record extra)",             mixed, 4, false, false, false, false, false},
    };
    for (auto& o : opts) {
        D3D12_COMMAND_LIST_TYPE type = o.compute ? D3D12_COMMAND_LIST_TYPE_COMPUTE : D3D12_COMMAND_LIST_TYPE_DIRECT;
        D3D12_COMMAND_QUEUE_DESC qd{type}; ComPtr<ID3D12CommandQueue> q; CK(dev->CreateCommandQueue(&qd, IID_PPV_ARGS(&q)));
        std::vector<UINT> words = o.recs; words.resize(3 * o.maxCount, 0);
        const UINT64 bytes = words.size() * 4;
        auto upload = buffer(D3D12_HEAP_TYPE_UPLOAD, bytes, D3D12_RESOURCE_STATE_GENERIC_READ, false);
        void* m; CK(upload->Map(0, nullptr, &m)); std::memcpy(m, words.data(), bytes); upload->Unmap(0, nullptr);
        auto args = buffer(D3D12_HEAP_TYPE_DEFAULT, bytes, D3D12_RESOURCE_STATE_COPY_DEST, false);
        auto out = buffer(D3D12_HEAP_TYPE_DEFAULT, 256, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, true);
        auto rb = buffer(D3D12_HEAP_TYPE_READBACK, 256, D3D12_RESOURCE_STATE_COPY_DEST, false);
        ComPtr<ID3D12CommandAllocator> a; CK(dev->CreateCommandAllocator(type, IID_PPV_ARGS(&a)));
        ID3D12PipelineState* pso = o.table ? psoTable.Get() : o.wide ? psoWide.Get() : psoUav.Get();
        ComPtr<ID3D12GraphicsCommandList> l; CK(dev->CreateCommandList(0, type, a.Get(), pso, IID_PPV_ARGS(&l)));
        ID3D12Resource* src = args.Get();
        if (o.upload_args) src = upload.Get();
        else {
            l->CopyBufferRegion(args.Get(), 0, upload.Get(), 0, bytes);
            D3D12_RESOURCE_BARRIER b{}; b.Transition = {args.Get(), D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT};
            l->ResourceBarrier(1, &b);
        }
        if (o.table) {
            D3D12_UNORDERED_ACCESS_VIEW_DESC u{DXGI_FORMAT_R32_TYPELESS, D3D12_UAV_DIMENSION_BUFFER};
            u.Buffer.NumElements = 64; u.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_RAW;
            dev->CreateUnorderedAccessView(out.Get(), nullptr, &u, heap->GetCPUDescriptorHandleForHeapStart());
            ID3D12DescriptorHeap* hs[]{heap.Get()}; l->SetDescriptorHeaps(1, hs);
            l->SetComputeRootSignature(rootTable.Get());
            l->SetComputeRootDescriptorTable(0, heap->GetGPUDescriptorHandleForHeapStart());
        } else {
            l->SetComputeRootSignature(rootUav.Get());
            l->SetComputeRootUnorderedAccessView(0, out->GetGPUVirtualAddress());
        }
        if (o.split) for (UINT i = 0; i < 3; ++i) l->ExecuteIndirect(sig.Get(), 1, src, i * 12, nullptr, 0);
        else l->ExecuteIndirect(sig.Get(), o.maxCount, src, 0, nullptr, 0);
        D3D12_RESOURCE_BARRIER c{}; c.Transition = {out.Get(), D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE};
        l->ResourceBarrier(1, &c);
        l->CopyBufferRegion(rb.Get(), 0, out.Get(), 0, 8);
        CK(l->Close());
        ID3D12CommandList* ls[]{l.Get()}; q->ExecuteCommandLists(1, ls);
        ComPtr<ID3D12Fence> f; CK(dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&f)));
        CK(q->Signal(f.Get(), 1)); CK(f->SetEventOnCompletion(1, nullptr)); CK(dev->GetDeviceRemovedReason());
        UINT v[2]; CK(rb->Map(0, nullptr, &m)); std::memcpy(v, m, 8); rb->Unmap(0, nullptr);
        // expected sum and group count over all records
        UINT es = 0, eg = 0;
        for (size_t r = 0; r + 2 < words.size(); r += 3)
            for (UINT z = 0; z < words[r+2]; ++z) for (UINT y = 0; y < words[r+1]; ++y) for (UINT x = 0; x < words[r]; ++x) { es += 1 + x + 10*y + 100*z; ++eg; }
        std::printf("%-50s groups %5u/%5u  sum %7u/%7u  %s\n", o.name, v[1], eg, v[0], es, (v[0] == es && v[1] == eg) ? "ok" : "MISMATCH");
    }
}

AI-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

  • I reproduced this on a source-built input.
  • I did not include game files, dumps, distribution links or credentials.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6615923863 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-25T23:30:41Z. --- ### Commit or build ae5d482a ### Reproduction ```shell cmake --preset dev cmake --build --preset dev --target startup_indirect_dispatch ctest --preset dev --no-tests=error -R '^startup_indirect_count_hardware$' -V # Standalone D3D12 program, no project code (source under Observed behavior) cl /EHsc /O2 /std:c++17 ei2.cpp .\ei2.exe # high-performance adapter .\ei2.exe warp # WARP reference ``` ### Expected behavior `startup_indirect_count_hardware` passes, as `startup_indirect_count_warp` does. 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 (`0x31415926` to `0x31415935`). In general, `ExecuteIndirect` with a Dispatch command signature and `MaxCommandCount` > 1 runs min(count, MaxCommandCount) commands, or all of them without a count buffer. ### Observed behavior At commit `ae5d482a`, `startup_indirect_count_hardware` fails at its first case: ``` adapter: AMD Radeon RX 5700 XT, debug layer unavailable driver: 32.0.21045.29003 GPU writer: count word=2, executed=2, result=0x31415929 (expected 0x31415935) word 11: got 0x31415929, expected 0x31415935 ``` The result grew by 3, which is record 0 `(2,1,1)` alone. `startup_indirect_count_warp` passes. **Standalone check without `d3d12_xs`.** `ei2.cpp` (below) uses plain D3D12. A `numthreads(1,1,1)` compute shader atomically adds, for each group, `1 + x + 10y + 100z` to word 0 and 1 to word 1. It runs that shader through `ExecuteIndirect` with 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. | Variant | RX 5700 XT | WARP 10.0.26100.9818 | |---|---|---| | 1 three mixed records, direct queue, root UAV | 2/7, 3/318 | 7/7, 318/318 | | 2 three `(1,1,1)` records | 1/3, 1/3 | ok | | 3 records of 64 groups each | 64/192, 2080/223968 | ok | | 4 compute queue | 2/7, 3/318 | ok | | 5 UAV through a descriptor table | 2/7, 3/318 | ok | | 6 `numthreads(64,1,1)` | 2/7, 3/318 | ok | | 7 arguments read straight from an UPLOAD heap | 2/7, 3/318 | ok | | 8 **three `ExecuteIndirect` calls, max count 1 each** | **7/7, 318/318** | ok | | 9 max count 4 (one zero record extra) | 2/7, 3/318 | ok | An 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`: | Adrenalin | Driver | Result | |---|---|---| | 26.11.2 | 32.0.21045.29003 | only the first command (8/9 variants fail) | | 26.10.1 | 32.0.21045.16010 | same | | 25.9.1 | 32.0.21025.10016 | same | | 24.12.1 | 32.0.12033.1030 | same | | 23.12.1 | 31.0.23013.1023 | same | 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 `_hardware` failures on this adapter, for completeness.** The full `dev` suite gave 1,855/1,862, and three of the failures passed when rerun serially. The remaining three match results already in `docs/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-only `fused mad()` mutation is not detected, because DXC emits `FMad` (op 46) for `precise mad()` and this adapter returns the unfused result. <details> <summary><code>ei2.cpp</code></summary> ```cpp // Variant sweep: which conditions make ExecuteIndirect(Dispatch) run only its first command? #include <d3d12.h> #include <dxgi1_6.h> #include <d3dcompiler.h> #include <wrl/client.h> #include <cstdio> #include <cstring> #include <cstdlib> #include <vector> #pragma comment(lib, "d3d12.lib") #pragma comment(lib, "dxgi.lib") #pragma comment(lib, "d3dcompiler.lib") using Microsoft::WRL::ComPtr; #define CK(x) do { HRESULT h_ = (x); if (FAILED(h_)) { std::printf("FAIL %s 0x%08x\n", #x, (unsigned)h_); std::exit(1); } } while (0) // Each group atomically adds 1 + x + 10y + 100z to word 0 and 1 to word 1, so the readback shows // how many groups ran and which records they came from. static const char* kAtomic = R"( RWByteAddressBuffer o : register(u0); [numthreads(1,1,1)] void main(uint3 g : SV_GroupID) { uint p; o.InterlockedAdd(0, 1 + g.x + 10*g.y + 100*g.z, p); o.InterlockedAdd(4, 1, p); } )"; static const char* kTable = R"( RWByteAddressBuffer o : register(u0); [numthreads(1,1,1)] void main(uint3 g : SV_GroupID) { uint p; o.InterlockedAdd(0, 1 + g.x + 10*g.y + 100*g.z, p); o.InterlockedAdd(4, 1, p); } )"; static const char* kWide = R"( RWByteAddressBuffer o : register(u0); [numthreads(64,1,1)] void main(uint3 g : SV_GroupID, uint t : SV_GroupIndex) { uint p; if (t == 0) { o.InterlockedAdd(0, 1 + g.x + 10*g.y + 100*g.z, p); o.InterlockedAdd(4, 1, p); } } )"; ComPtr<ID3D12Device> dev; ComPtr<ID3D12Resource> buffer(D3D12_HEAP_TYPE type, UINT64 bytes, D3D12_RESOURCE_STATES state, bool uav) { D3D12_HEAP_PROPERTIES hp{type}; D3D12_RESOURCE_DESC d{D3D12_RESOURCE_DIMENSION_BUFFER, 0, bytes, 1, 1, 1, DXGI_FORMAT_UNKNOWN, {1, 0}, D3D12_TEXTURE_LAYOUT_ROW_MAJOR, uav ? D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS : D3D12_RESOURCE_FLAG_NONE}; ComPtr<ID3D12Resource> r; CK(dev->CreateCommittedResource(&hp, D3D12_HEAP_FLAG_NONE, &d, state, nullptr, IID_PPV_ARGS(&r))); return r; } ComPtr<ID3D12PipelineState> make_pso(ID3D12RootSignature* root, const char* src) { ComPtr<ID3DBlob> cs, e; CK(D3DCompile(src, std::strlen(src), nullptr, nullptr, nullptr, "main", "cs_5_0", 0, 0, &cs, &e)); D3D12_COMPUTE_PIPELINE_STATE_DESC pd{}; pd.pRootSignature = root; pd.CS = {cs->GetBufferPointer(), cs->GetBufferSize()}; ComPtr<ID3D12PipelineState> p; CK(dev->CreateComputePipelineState(&pd, IID_PPV_ARGS(&p))); return p; } struct Opt { const char* name; std::vector<UINT> recs; UINT maxCount; bool compute; bool table; bool wide; bool split; bool upload_args; }; int main(int argc, char** argv) { const bool warp = argc > 1 && !std::strcmp(argv[1], "warp"); ComPtr<IDXGIFactory6> fac; CK(CreateDXGIFactory1(IID_PPV_ARGS(&fac))); ComPtr<IDXGIAdapter1> ad; if (warp) CK(fac->EnumWarpAdapter(IID_PPV_ARGS(&ad))); else CK(fac->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&ad))); DXGI_ADAPTER_DESC1 dd; ad->GetDesc1(&dd); std::printf("adapter: %ls\n", dd.Description); CK(D3D12CreateDevice(ad.Get(), D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&dev))); D3D12_ROOT_PARAMETER rp{}; rp.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; D3D12_ROOT_SIGNATURE_DESC rd{1, &rp}; ComPtr<ID3DBlob> s, e; ComPtr<ID3D12RootSignature> rootUav, rootTable; CK(D3D12SerializeRootSignature(&rd, D3D_ROOT_SIGNATURE_VERSION_1, &s, &e)); CK(dev->CreateRootSignature(0, s->GetBufferPointer(), s->GetBufferSize(), IID_PPV_ARGS(&rootUav))); D3D12_DESCRIPTOR_RANGE range{D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 0, 0, 0}; D3D12_ROOT_PARAMETER tp{}; tp.ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; tp.DescriptorTable = {1, &range}; rd.pParameters = &tp; CK(D3D12SerializeRootSignature(&rd, D3D_ROOT_SIGNATURE_VERSION_1, &s, &e)); CK(dev->CreateRootSignature(0, s->GetBufferPointer(), s->GetBufferSize(), IID_PPV_ARGS(&rootTable))); auto psoUav = make_pso(rootUav.Get(), kAtomic), psoTable = make_pso(rootTable.Get(), kTable), psoWide = make_pso(rootUav.Get(), kWide); D3D12_INDIRECT_ARGUMENT_DESC arg{D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH}; D3D12_COMMAND_SIGNATURE_DESC sd{12, 1, &arg}; ComPtr<ID3D12CommandSignature> sig; CK(dev->CreateCommandSignature(&sd, nullptr, IID_PPV_ARGS(&sig))); D3D12_DESCRIPTOR_HEAP_DESC hd{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 1, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE}; ComPtr<ID3D12DescriptorHeap> heap; CK(dev->CreateDescriptorHeap(&hd, IID_PPV_ARGS(&heap))); const std::vector<UINT> mixed = {2,1,1, 1,2,1, 1,1,3}; const std::vector<UINT> ones = {1,1,1, 1,1,1, 1,1,1}; const std::vector<UINT> big = {64,1,1, 1,64,1, 1,1,64}; Opt opts[] = { {"1 mixed records, direct queue, root UAV", mixed, 3, false, false, false, false, false}, {"2 three (1,1,1) records", ones, 3, false, false, false, false, false}, {"3 large records (64 groups each)", big, 3, false, false, false, false, false}, {"4 compute queue", mixed, 3, true, false, false, false, false}, {"5 UAV through descriptor table", mixed, 3, false, true, false, false, false}, {"6 64-thread groups", mixed, 3, false, false, true, false, false}, {"7 args read straight from UPLOAD heap", mixed, 3, false, false, false, false, true}, {"8 three separate ExecuteIndirect calls, max 1", mixed, 3, false, false, false, true, false}, {"9 maxCount 4 (one zero record extra)", mixed, 4, false, false, false, false, false}, }; for (auto& o : opts) { D3D12_COMMAND_LIST_TYPE type = o.compute ? D3D12_COMMAND_LIST_TYPE_COMPUTE : D3D12_COMMAND_LIST_TYPE_DIRECT; D3D12_COMMAND_QUEUE_DESC qd{type}; ComPtr<ID3D12CommandQueue> q; CK(dev->CreateCommandQueue(&qd, IID_PPV_ARGS(&q))); std::vector<UINT> words = o.recs; words.resize(3 * o.maxCount, 0); const UINT64 bytes = words.size() * 4; auto upload = buffer(D3D12_HEAP_TYPE_UPLOAD, bytes, D3D12_RESOURCE_STATE_GENERIC_READ, false); void* m; CK(upload->Map(0, nullptr, &m)); std::memcpy(m, words.data(), bytes); upload->Unmap(0, nullptr); auto args = buffer(D3D12_HEAP_TYPE_DEFAULT, bytes, D3D12_RESOURCE_STATE_COPY_DEST, false); auto out = buffer(D3D12_HEAP_TYPE_DEFAULT, 256, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, true); auto rb = buffer(D3D12_HEAP_TYPE_READBACK, 256, D3D12_RESOURCE_STATE_COPY_DEST, false); ComPtr<ID3D12CommandAllocator> a; CK(dev->CreateCommandAllocator(type, IID_PPV_ARGS(&a))); ID3D12PipelineState* pso = o.table ? psoTable.Get() : o.wide ? psoWide.Get() : psoUav.Get(); ComPtr<ID3D12GraphicsCommandList> l; CK(dev->CreateCommandList(0, type, a.Get(), pso, IID_PPV_ARGS(&l))); ID3D12Resource* src = args.Get(); if (o.upload_args) src = upload.Get(); else { l->CopyBufferRegion(args.Get(), 0, upload.Get(), 0, bytes); D3D12_RESOURCE_BARRIER b{}; b.Transition = {args.Get(), D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT}; l->ResourceBarrier(1, &b); } if (o.table) { D3D12_UNORDERED_ACCESS_VIEW_DESC u{DXGI_FORMAT_R32_TYPELESS, D3D12_UAV_DIMENSION_BUFFER}; u.Buffer.NumElements = 64; u.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_RAW; dev->CreateUnorderedAccessView(out.Get(), nullptr, &u, heap->GetCPUDescriptorHandleForHeapStart()); ID3D12DescriptorHeap* hs[]{heap.Get()}; l->SetDescriptorHeaps(1, hs); l->SetComputeRootSignature(rootTable.Get()); l->SetComputeRootDescriptorTable(0, heap->GetGPUDescriptorHandleForHeapStart()); } else { l->SetComputeRootSignature(rootUav.Get()); l->SetComputeRootUnorderedAccessView(0, out->GetGPUVirtualAddress()); } if (o.split) for (UINT i = 0; i < 3; ++i) l->ExecuteIndirect(sig.Get(), 1, src, i * 12, nullptr, 0); else l->ExecuteIndirect(sig.Get(), o.maxCount, src, 0, nullptr, 0); D3D12_RESOURCE_BARRIER c{}; c.Transition = {out.Get(), D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE}; l->ResourceBarrier(1, &c); l->CopyBufferRegion(rb.Get(), 0, out.Get(), 0, 8); CK(l->Close()); ID3D12CommandList* ls[]{l.Get()}; q->ExecuteCommandLists(1, ls); ComPtr<ID3D12Fence> f; CK(dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&f))); CK(q->Signal(f.Get(), 1)); CK(f->SetEventOnCompletion(1, nullptr)); CK(dev->GetDeviceRemovedReason()); UINT v[2]; CK(rb->Map(0, nullptr, &m)); std::memcpy(v, m, 8); rb->Unmap(0, nullptr); // expected sum and group count over all records UINT es = 0, eg = 0; for (size_t r = 0; r + 2 < words.size(); r += 3) for (UINT z = 0; z < words[r+2]; ++z) for (UINT y = 0; y < words[r+1]; ++y) for (UINT x = 0; x < words[r]; ++x) { es += 1 + x + 10*y + 100*z; ++eg; } std::printf("%-50s groups %5u/%5u sum %7u/%7u %s\n", o.name, v[1], eg, v[0], es, (v[0] == es && v[1] == eg) ? "ok" : "MISMATCH"); } } ``` </details> AI-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 - [x] I reproduced this on a source-built input. - [x] I did not include game files, dumps, distribution links or credentials.
R0Y00 commented 2026-11-26 00:01:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T23:53:39Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7178176972 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7178176972). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T23:53:39Z. --- 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 commented 2026-11-26 01:02:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T00:12:35Z.


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.

Adapter Driver One call with three mixed records Three single-record calls All nine variants
GeForce RTX 4060 32.0.15.9579 7 groups, 318 7 groups, 318 9/9 matched
Intel UHD Graphics 770 32.0.101.5973 7 groups, 318 7 groups, 318 9/9 matched
Microsoft WARP 10.0.26100.9711 7 groups, 318 7 groups, 318 9/9 matched

On the RTX 4060 and WARP I also ran the project's startup_indirect_dispatch <hardware|warp> count at the tested integration. With the GPU-written count 2 both returned 0x31415935. Count 9 clamped to three records and returned 0x31415a64, and count 0 retained 0x31415926. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7178514351 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7178514351). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T00:12:35Z. --- 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. | Adapter | Driver | One call with three mixed records | Three single-record calls | All nine variants | | --- | --- | --- | --- | --- | | GeForce RTX 4060 | 32.0.15.9579 | 7 groups, 318 | 7 groups, 318 | 9/9 matched | | Intel UHD Graphics 770 | 32.0.101.5973 | 7 groups, 318 | 7 groups, 318 | 9/9 matched | | Microsoft WARP | 10.0.26100.9711 | 7 groups, 318 | 7 groups, 318 | 9/9 matched | On the RTX 4060 and WARP I also ran the project's `startup_indirect_dispatch <hardware|warp> count` at the [tested integration](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45723259230). With the GPU-written count 2 both returned `0x31415935`. Count 9 clamped to three records and returned `0x31415a64`, and count 0 retained `0x31415926`. 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](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45724513435) 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 commented 2026-11-26 01:02:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T00:29:14Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7178807523 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7178807523). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T00:29:14Z. --- 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 commented 2026-11-26 01:02:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-26T00:34:50Z.


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 returned 0x31415935. Count 9 executed three records at the maximum and returned 0x31415a64. Count 0 retained 0x31415926. Omitting the count buffer executed all three records and returned 0x31415a64. 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7178903308 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7178903308). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-26T00:34:50Z. --- 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 returned `0x31415935`. Count 9 executed three records at the maximum and returned `0x31415a64`. Count 0 retained `0x31415926`. Omitting the count buffer executed all three records and returned `0x31415a64`. 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](https://github.com/R0Y00/Xbox2Windows/pull/2652). An independent RDNA 1 run would still help identify the scope of the RX 5700 XT observation.
ColorMeBoom commented 2026-11-26 02:05:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ColorMeBoom on 2026-11-26T01:06:17Z.


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 with MaxCommandCount 1, and a count buffer holding a per-record 0 or 1 written by a compute pass:

Count word Expected sum RX 5700 XT WARP 10.0.26100.9818
0 0 318 0
1 3 318 3
2 15 318 15
3 318 318 318

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 i as itself while i < min(count, MaxCommandCount) and as (0,0,0) otherwise. Then MaxCommandCount single-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 changed list_execute_indirect since 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:

  • The fixture binds its result UAV on the desktop list directly. The split invalidates that binding, so the count test kept its sentinel until the fixture bound it through a small test-only export that the shim restores. Without that change the fixture would need another binding route.
  • With the split on, startup_indirect_count_hardware passes on the RX 5700 XT (counts 2, 9 and 0, omitted writer, no count buffer, five refusals). With X2W_SPLIT_INDIRECT_DISPATCH=0 it fails as before (0x31415929, expected 0x31415935). New startup_indirect_count_split_(warp|hardware) tests run the same cases with the split forced, and both pass. The full dev suite gave 1,861/1,864; the three failures are the RX 5700 XT gpu_alias_window_hardware, gpu_alias_lookup_writes_hardware and compute_store_aot_mac_f32_hardware results 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:

  1. Should a workaround wait for a second RDNA 1 adapter, or would you accept it opt-in (X2W_SPLIT_INDIRECT_DISPATCH=1) now and enabled by device id later?
  2. To keep the hardware test's strict readback, should startup_indirect_count_hardware stay unsplit, so it keeps showing the driver behavior, with the _split tests covering the workaround?
  3. Is a fixture-only export for the result UAV acceptable, or would you prefer the fixture bind its output another way?

AI-assisted with Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7179435800 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7179435800). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-26T01:06:17Z. --- 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 with `MaxCommandCount` 1, and a count buffer holding a per-record 0 or 1 written by a compute pass: | Count word | Expected sum | RX 5700 XT | WARP 10.0.26100.9818 | |---|---|---|---| | 0 | 0 | 318 | 0 | | 1 | 3 | 318 | 3 | | 2 | 15 | 318 | 15 | | 3 | 318 | 318 | 318 | 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 `i` as itself while `i < min(count, MaxCommandCount)` and as `(0,0,0)` otherwise. Then `MaxCommandCount` single-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 changed `list_execute_indirect` since 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: - The fixture binds its result UAV on the desktop list directly. The split invalidates that binding, so the count test kept its sentinel until the fixture bound it through a small test-only export that the shim restores. Without that change the fixture would need another binding route. - With the split on, `startup_indirect_count_hardware` passes on the RX 5700 XT (counts 2, 9 and 0, omitted writer, no count buffer, five refusals). With `X2W_SPLIT_INDIRECT_DISPATCH=0` it fails as before (`0x31415929`, expected `0x31415935`). New `startup_indirect_count_split_(warp|hardware)` tests run the same cases with the split forced, and both pass. The full `dev` suite gave 1,861/1,864; the three failures are the RX 5700 XT `gpu_alias_window_hardware`, `gpu_alias_lookup_writes_hardware` and `compute_store_aot_mac_f32_hardware` results 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:** 1. Should a workaround wait for a second RDNA 1 adapter, or would you accept it opt-in (`X2W_SPLIT_INDIRECT_DISPATCH=1`) now and enabled by device id later? 2. To keep the hardware test's strict readback, should `startup_indirect_count_hardware` stay unsplit, so it keeps showing the driver behavior, with the `_split` tests covering the workaround? 3. Is a fixture-only export for the result UAV acceptable, or would you prefer the fixture bind its output another way? AI-assisted with Claude Code (Claude Opus 5.5).
R0Y00 commented 2026-11-26 02:05:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T01:12:09Z.


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_hardware unsplit 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7179534826 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7179534826). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T01:12:09Z. --- 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_hardware` unsplit 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 commented 2026-11-26 03:03:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T02:43:15Z.


Independent AMD RDNA 4 result on 0c8f5dab: startup_indirect_count_hardware passes 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

  • Measured 0c8f5dab (the report is at ae5d482a), git rev-parse HEAD printed on the machine, tracked tree clean.
  • list_execute_indirect in src/startup_stubs/d3d12_xs_device.cpp is byte-identical between the two revisions: the whole function, signature through closing brace, diff empty. 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 other ExecuteIndirect invocation in src/ is the translated-draw one (d3d12_draw.inl:2321, :2324), which always passes MaxCommandCount 1 and is not on this path.
  • The only difference in tests/startup_indirect_dispatch.cpp between ae5d482a and 0c8f5dab is 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), driver 32.0.32029.2010. MSVC 19.44.35230.0 (BuildTools 14.44.35207), CMake 4.4.4, Ninja, preset dev (Debug). D3D12 debug layer not installed (d3d12SDKLayers.dll absent).

Commands

Run from the repository root:

cmake --preset dev -DINTAKE_PYTHON=...\pe-env\Scripts\python.exe
cmake --build --preset dev --target d3d12_xs_shim startup_indirect_dispatch
ctest --preset dev --no-tests=error -R "^startup_indirect_(count|dispatch|root_constants)_(hardware|warp)$" -V

Then the fixture directly, three times, to see the readbacks rather than the verdict:

out\build\dev\startup_indirect_dispatch.exe hardware count

Observed

ctest selected six tests and reported 100% tests passed out of 6; startup_indirect_count_hardware passed in 0.27 s. The capture does not echo the selection regex; the six names in it are the six that regex matches in CMakeLists.txt (add_test at lines 1515-1517, SKIP_RETURN_CODE 77 at 1520), and none returned 77. No line of it says Skipped.

The fixture, verbatim:

adapter: AMD Radeon RX 9070 XT, debug layer unavailable
driver: 32.0.32029.2010
GPU writer: count word=2, executed=2, result=0x31415935 (expected 0x31415935)
GPU writer: count word=9, executed=3, result=0x31415a64 (expected 0x31415a64)
GPU writer: count word=0, executed=0, result=0x31415926 (expected 0x31415926)
omitted writer: count word=0, executed=0, result=0x31415926 (expected 0x31415926)
no count buffer: count word=0, executed=3, result=0x31415a64 (expected 0x31415a64)

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's 1+x+10y+100z weight. A single executed record would move it by 3, which is the 0x31415929 in the report. The fixture printed no word 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 0x31415926 untouched.

Scope, attributed

Adapter Arch Revision Drivers What ran Outcome From
RX 5700 XT RDNA 1 ae5d482a 5 packages swept fixture + standalone fixture fails its first case; 8 of 9 standalone variants fail @ColorMeBoom
RX 9070 XT RDNA 4 0c8f5dab 1 fixture five accepted readbacks and five refusal controls exact this run
UHD 770, RTX 4060, WARP — PR #2652 1 each fixture + standalone fixture readbacks exact; standalone 9/9 @RavenCurseBurg

These rows are reported outcomes from different hosts, Windows builds, driver packages and revisions. They are not a controlled comparison.

Limits

  • One adapter, one driver package, one Windows build, Debug configuration. This adds an AMD adapter/driver pair in which the fixture passes; it does not answer the RDNA 1 question, which still needs a second RDNA 1 card.
  • It does not separate "RDNA 4 is not affected" from "this driver package is not affected": the architecture and the driver package differ from the report at the same time, and I cannot install a 32.0.21045.x package on this card to hold the driver still.
  • No debug layer, so the fixture's validation block (D3D12GetDebugInterface at tests/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.
  • I did not run the nine-variant standalone program, and I did not mutate the fixture. Three runs of one binary at one revision.

AI-assisted; runs executed on the machine above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181058627 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2626#issuecomment-7181058627). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-26T02:43:15Z. --- **Independent AMD RDNA 4 result on `0c8f5dab`: `startup_indirect_count_hardware` passes 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 - Measured `0c8f5dab` (the report is at `ae5d482a`), `git rev-parse HEAD` printed on the machine, tracked tree clean. - `list_execute_indirect` in `src/startup_stubs/d3d12_xs_device.cpp` is **byte-identical** between the two revisions: the whole function, signature through closing brace, `diff` empty. 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 other `ExecuteIndirect` invocation in `src/` is the translated-draw one (`d3d12_draw.inl:2321`, `:2324`), which always passes `MaxCommandCount` 1 and is not on this path. - The only difference in `tests/startup_indirect_dispatch.cpp` between `ae5d482a` and `0c8f5dab` is 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), driver `32.0.32029.2010`. MSVC `19.44.35230.0` (BuildTools `14.44.35207`), CMake `4.4.4`, Ninja, preset `dev` (**Debug**). D3D12 debug layer not installed (`d3d12SDKLayers.dll` absent). ### Commands Run from the repository root: ```text cmake --preset dev -DINTAKE_PYTHON=...\pe-env\Scripts\python.exe cmake --build --preset dev --target d3d12_xs_shim startup_indirect_dispatch ctest --preset dev --no-tests=error -R "^startup_indirect_(count|dispatch|root_constants)_(hardware|warp)$" -V ``` Then the fixture directly, three times, to see the readbacks rather than the verdict: ```text out\build\dev\startup_indirect_dispatch.exe hardware count ``` ### Observed `ctest` selected six tests and reported `100% tests passed out of 6`; `startup_indirect_count_hardware` passed in 0.27 s. The capture does not echo the selection regex; the six names in it are the six that regex matches in `CMakeLists.txt` (`add_test` at lines 1515-1517, `SKIP_RETURN_CODE 77` at 1520), and none returned 77. No line of it says `Skipped`. The fixture, verbatim: ```text adapter: AMD Radeon RX 9070 XT, debug layer unavailable driver: 32.0.32029.2010 GPU writer: count word=2, executed=2, result=0x31415935 (expected 0x31415935) GPU writer: count word=9, executed=3, result=0x31415a64 (expected 0x31415a64) GPU writer: count word=0, executed=0, result=0x31415926 (expected 0x31415926) omitted writer: count word=0, executed=0, result=0x31415926 (expected 0x31415926) no count buffer: count word=0, executed=3, result=0x31415a64 (expected 0x31415a64) ``` **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's `1+x+10y+100z` weight. A single executed record would move it by 3, which is the `0x31415929` in the report. The fixture printed no `word 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 `0x31415926` untouched. ### Scope, attributed | Adapter | Arch | Revision | Drivers | What ran | Outcome | From | |---|---|---|---|---|---|---| | RX 5700 XT | RDNA 1 | `ae5d482a` | 5 packages swept | fixture + standalone | fixture fails its first case; 8 of 9 standalone variants fail | @ColorMeBoom | | RX 9070 XT | RDNA 4 | `0c8f5dab` | 1 | fixture | five accepted readbacks and five refusal controls exact | this run | | UHD 770, RTX 4060, WARP | — | PR #2652 | 1 each | fixture + standalone | fixture readbacks exact; standalone 9/9 | @RavenCurseBurg | These rows are reported outcomes from different hosts, Windows builds, driver packages and revisions. They are not a controlled comparison. ### Limits - One adapter, one driver package, one Windows build, Debug configuration. This adds an AMD adapter/driver pair in which the fixture passes; it does not answer the RDNA 1 question, which still needs a second RDNA 1 card. - It does not separate "RDNA 4 is not affected" from "this driver package is not affected": the architecture and the driver package differ from the report at the same time, and I cannot install a `32.0.21045.x` package on this card to hold the driver still. - No debug layer, so the fixture's validation block (`D3D12GetDebugInterface` at `tests/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. - I did not run the nine-variant standalone program, and I did not mutate the fixture. Three runs of one binary at one revision. _AI-assisted; runs executed on the machine above._
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#2618
No description provided.