d3d12: test bundle ExecuteIndirect(DISPATCH) and fix the stale bundle note (D3D-BUNDLE-EXECUTE-INDIRECT) #2575

Merged
MoonEyes merged 6 commits from upstream-pr/2575 into main 2026-11-29 12:44:14 +00:00
MoonEyes commented 2026-11-28 14:54:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:54:31Z.


Claimed in the coordination issue as: D3D-BUNDLE-EXECUTE-INDIRECT (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7240691025)

Item: D3D-BUNDLE-EXECUTE-INDIRECT

What and why

Doc fix and regression test, no shim code change. ExecuteIndirect in a bundle is already deferred on main
(ba626820e): a single DRAW, DRAW_INDEXED, DISPATCH or DISPATCH_MESH operation with no count buffer plays at each
ExecuteBundle with the parent's state at that call. Only DRAW/DRAW_INDEXED had a GPU test, and
docs/d3d12_vulkan.md (bundles) still listed it as "Not deferred yet". A test failing on main is therefore not
possible; the new test instead fails when the bundle branch of ExecuteIndirect is disabled.

  • d3d12_indirect_dispatch_count_test --bundle (ctest d3d12_bundle_indirect_dispatch): a fixed-count DISPATCH
    recorded in a bundle, executed twice from a direct list with a different parent root UAV each time, then a direct
    Dispatch. The layer, WARP and the default adapter all give 6/10 7/11 1/1, with and without the bundle setting the
    parent's root signature first. A count buffer or a root-constant signature fails the bundle's Close with
    E_INVALIDARG on both host adapters, as on the layer.
  • Docs: the bundle note now describes the deferred path and the measurement; the ExecuteIndirect section points to
    the new test.

Tested

On the branch merged with current main: the new test, d3d12_bundle_test (default, --indirect-bundle-layer,
--indirect-bundle-warp), d3d12_bundle_forbidden_test and d3d12_indirect_dispatch_count_test pass. With the
bundle branch of ExecuteIndirect disabled, the new test and --indirect-bundle-layer fail.
check_no_game_data.py is clean on the three files.

GPUs tested: NVIDIA GeForce RTX 4060, driver 610.88, Windows 11 10.0.26300.9974; WARP on the same machine.

AI-assisted: yes (Claude Code, Claude Opus 5.5)

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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5541374204 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T14:54:31Z. --- Claimed in the coordination issue as: D3D-BUNDLE-EXECUTE-INDIRECT (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7240691025) Item: D3D-BUNDLE-EXECUTE-INDIRECT ### What and why Doc fix and regression test, no shim code change. `ExecuteIndirect` in a bundle is already deferred on main (ba626820e): a single DRAW, DRAW_INDEXED, DISPATCH or DISPATCH_MESH operation with no count buffer plays at each `ExecuteBundle` with the parent's state at that call. Only DRAW/DRAW_INDEXED had a GPU test, and `docs/d3d12_vulkan.md` (bundles) still listed it as "Not deferred yet". A test failing on main is therefore not possible; the new test instead fails when the bundle branch of `ExecuteIndirect` is disabled. - `d3d12_indirect_dispatch_count_test --bundle` (ctest `d3d12_bundle_indirect_dispatch`): a fixed-count DISPATCH recorded in a bundle, executed twice from a direct list with a different parent root UAV each time, then a direct `Dispatch`. The layer, WARP and the default adapter all give 6/10 7/11 1/1, with and without the bundle setting the parent's root signature first. A count buffer or a root-constant signature fails the bundle's `Close` with `E_INVALIDARG` on both host adapters, as on the layer. - Docs: the bundle note now describes the deferred path and the measurement; the `ExecuteIndirect` section points to the new test. ### Tested On the branch merged with current main: the new test, `d3d12_bundle_test` (default, `--indirect-bundle-layer`, `--indirect-bundle-warp`), `d3d12_bundle_forbidden_test` and `d3d12_indirect_dispatch_count_test` pass. With the bundle branch of `ExecuteIndirect` disabled, the new test and `--indirect-bundle-layer` fail. `check_no_game_data.py` is clean on the three files. GPUs tested: NVIDIA GeForce RTX 4060, driver 610.88, Windows 11 10.0.26300.9974; WARP on the same machine. AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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](https://claude.com/claude-code)
lixonik commented 2026-11-28 15:34:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T15:34:59Z.

Code review location: runtime/test/d3d12_indirect_dispatch_count_test.cpp; line 259

@@ -164,6 +164,173 @@ std::array<UINT, 2> expected(UINT count, bool update, UINT second_count = 3) {
     return result;
 }
 
+// --bundle: a fixed-count DISPATCH ExecuteIndirect recorded in a bundle and executed twice by a direct list. The
+// bundle starts with the compute pipeline it was created with and has no root signature or root UAV of its own; the
+// parent binds the root UAV at slot 0 for the first ExecuteBundle and at slot 1 for the second, then dispatches one
+// group directly at slot 2. Each slot holds the shader's two counters (8 bytes, 64 bytes apart), so a slot shows
+// which root arguments the indirect records ran with: three records of 1, 2 and 3 groups give 6/10 in slots 0 and
+// 1, and the direct Dispatch(1, 1, 1) gives 1/1 in slot 2 (the bundle's pipeline stays on the parent, the parent's
+// root signature and arguments stay as they were). `same_root`: the bundle sets the parent's root signature before the call,
+// which keeps the parent's root arguments (docs/d3d12_vulkan.md, bundles).
+constexpr UINT kSlot = 64;  // bytes between the slots' counters
+using BundleResult = std::array<UINT, 6>;
+
+bool run_bundle(ID3D12Device* dev, const std::vector<std::uint8_t>& shader, bool same_root, BundleResult& result,
+                bool shim) {
+    Ref<ID3D12RootSignature> root;
+    D3D12_ROOT_PARAMETER param{};
+    param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
+    param.Descriptor = {0, 0};
+    param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+    D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{};
+    root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
+    root_desc.Desc_1_0 = {1, &param, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE};
+    const auto serialized = serialize_root_signature(root_desc);
+    if (serialized.empty() ||
+        FAILED(dev->CreateRootSignature(0, serialized.data(), serialized.size(), IID_PPV_ARGS(&root.p))))
+        return false;
+    D3D12_COMPUTE_PIPELINE_STATE_DESC desc{};
+    desc.pRootSignature = root.p;
+    desc.CS = {shader.data(), shader.size()};
+    Ref<ID3D12PipelineState> pso;
+    if (FAILED(dev->CreateComputePipelineState(&desc, IID_PPV_ARGS(&pso.p)))) return false;
+    const D3D12_INDIRECT_ARGUMENT_DESC argument{D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH};
+    const D3D12_COMMAND_SIGNATURE_DESC signature_desc{kStride, 1, &argument, 0};
+    Ref<ID3D12CommandSignature> signature;
+    if (FAILED(dev->CreateCommandSignature(&signature_desc, nullptr, IID_PPV_ARGS(&signature.p)))) return false;
+    const D3D12_HEAP_PROPERTIES upload_heap{D3D12_HEAP_TYPE_UPLOAD};
+    const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT};
+    const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK};
+    Ref<ID3D12Resource> source, args, output, readback;
+    const auto create = [&](Ref<ID3D12Resource>& dest, D3D12_HEAP_PROPERTIES heap, D3D12_RESOURCE_STATES state,
+                            D3D12_RESOURCE_FLAGS flags) {
+        const auto buffer = buffer_desc(512, flags);
+        return SUCCEEDED(dev->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, state, nullptr,
+                                                      IID_PPV_ARGS(&dest.p)));
+    };
+    if (!create(source, upload_heap, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_FLAG_NONE) ||
+        !create(args, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE) ||
+        !create(output, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) ||
+        !create(readback, readback_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE))
+        return false;
+    std::array<UINT, 128> input{};  // bytes 256..511 stay zero: the output's initial value
+    for (UINT i = 0; i < kMaximum; ++i) {
+        const UINT base = (kArgsOffset + i * kStride) / 4;
+        input[base] = i + 1;
+        input[base + 1] = input[base + 2] = 1;
+        input[base + 3] = 0xa5a5a5a5;  // padding: must be ignored
+        input[base + 4] = 0x5a5a5a5a;
+    }
+    void* mapped = nullptr;
+    if (FAILED(source->Map(0, nullptr, &mapped)) || !mapped) return false;
+    std::memcpy(mapped, input.data(), sizeof(input));
+    source->Unmap(0, nullptr);
+
+    const D3D12_COMMAND_QUEUE_DESC queue_desc{D3D12_COMMAND_LIST_TYPE_DIRECT};
+    Ref<ID3D12CommandQueue> queue;
+    Ref<ID3D12CommandAllocator> allocator, bundle_allocator;
+    Ref<ID3D12GraphicsCommandList> list, bundle;
+    Ref<ID3D12Fence> fence;
+    if (FAILED(dev->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))) ||
+        FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))) ||
+        FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&bundle_allocator.p))) ||
+        FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_BUNDLE, bundle_allocator.p, pso.p,
+                                      IID_PPV_ARGS(&bundle.p))) ||
+        FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr,
+                                      IID_PPV_ARGS(&list.p))) ||
+        FAILED(dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p))))
+        return false;
+    if (same_root) bundle->SetComputeRootSignature(root.p);
+    bundle->ExecuteIndirect(signature.p, kMaximum, args.p, kArgsOffset, nullptr, 0);
+    if (FAILED(bundle->Close())) return false;
+
+    list->CopyBufferRegion(args.p, kArgsOffset, source.p, kArgsOffset, kMaximum * kStride);
+    list->CopyBufferRegion(output.p, 0, source.p, 256, 3 * kSlot);
+    const D3D12_RESOURCE_BARRIER ready[] = {
+        transition(args.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT),
+        transition(output.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS)};
+    list->ResourceBarrier(2, ready);
+    list->SetComputeRootSignature(root.p);
+    const D3D12_GPU_VIRTUAL_ADDRESS va = output->GetGPUVirtualAddress();
+    list->SetComputeRootUnorderedAccessView(0, va);
+    list->ExecuteBundle(bundle.p);
+    list->SetComputeRootUnorderedAccessView(0, va + kSlot);
+    list->ExecuteBundle(bundle.p);
+    list->SetComputeRootUnorderedAccessView(0, va + 2 * kSlot);

The test description says the parent's UAV remains bound after ExecuteBundle. This explicit rebind makes the existing readback unable to detect losing that argument. I added a UAV barrier and a direct dispatch immediately after the second ExecuteBundle, before changing the UAV. The resulting 6/10 7/11 1/1 passed on the Vulkan layer, WARP and native D3D12 in both same_root modes. Could the fixture keep that extra readback check?

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4727691721 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#discussion_r4727691721). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T15:34:59Z. **Code review location:** `runtime/test/d3d12_indirect_dispatch_count_test.cpp`; line 259 ~~~~diff @@ -164,6 +164,173 @@ std::array<UINT, 2> expected(UINT count, bool update, UINT second_count = 3) { return result; } +// --bundle: a fixed-count DISPATCH ExecuteIndirect recorded in a bundle and executed twice by a direct list. The +// bundle starts with the compute pipeline it was created with and has no root signature or root UAV of its own; the +// parent binds the root UAV at slot 0 for the first ExecuteBundle and at slot 1 for the second, then dispatches one +// group directly at slot 2. Each slot holds the shader's two counters (8 bytes, 64 bytes apart), so a slot shows +// which root arguments the indirect records ran with: three records of 1, 2 and 3 groups give 6/10 in slots 0 and +// 1, and the direct Dispatch(1, 1, 1) gives 1/1 in slot 2 (the bundle's pipeline stays on the parent, the parent's +// root signature and arguments stay as they were). `same_root`: the bundle sets the parent's root signature before the call, +// which keeps the parent's root arguments (docs/d3d12_vulkan.md, bundles). +constexpr UINT kSlot = 64; // bytes between the slots' counters +using BundleResult = std::array<UINT, 6>; + +bool run_bundle(ID3D12Device* dev, const std::vector<std::uint8_t>& shader, bool same_root, BundleResult& result, + bool shim) { + Ref<ID3D12RootSignature> root; + D3D12_ROOT_PARAMETER param{}; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + param.Descriptor = {0, 0}; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{}; + root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0; + root_desc.Desc_1_0 = {1, &param, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE}; + const auto serialized = serialize_root_signature(root_desc); + if (serialized.empty() || + FAILED(dev->CreateRootSignature(0, serialized.data(), serialized.size(), IID_PPV_ARGS(&root.p)))) + return false; + D3D12_COMPUTE_PIPELINE_STATE_DESC desc{}; + desc.pRootSignature = root.p; + desc.CS = {shader.data(), shader.size()}; + Ref<ID3D12PipelineState> pso; + if (FAILED(dev->CreateComputePipelineState(&desc, IID_PPV_ARGS(&pso.p)))) return false; + const D3D12_INDIRECT_ARGUMENT_DESC argument{D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH}; + const D3D12_COMMAND_SIGNATURE_DESC signature_desc{kStride, 1, &argument, 0}; + Ref<ID3D12CommandSignature> signature; + if (FAILED(dev->CreateCommandSignature(&signature_desc, nullptr, IID_PPV_ARGS(&signature.p)))) return false; + const D3D12_HEAP_PROPERTIES upload_heap{D3D12_HEAP_TYPE_UPLOAD}; + const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT}; + const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK}; + Ref<ID3D12Resource> source, args, output, readback; + const auto create = [&](Ref<ID3D12Resource>& dest, D3D12_HEAP_PROPERTIES heap, D3D12_RESOURCE_STATES state, + D3D12_RESOURCE_FLAGS flags) { + const auto buffer = buffer_desc(512, flags); + return SUCCEEDED(dev->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, state, nullptr, + IID_PPV_ARGS(&dest.p))); + }; + if (!create(source, upload_heap, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_FLAG_NONE) || + !create(args, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE) || + !create(output, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) || + !create(readback, readback_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE)) + return false; + std::array<UINT, 128> input{}; // bytes 256..511 stay zero: the output's initial value + for (UINT i = 0; i < kMaximum; ++i) { + const UINT base = (kArgsOffset + i * kStride) / 4; + input[base] = i + 1; + input[base + 1] = input[base + 2] = 1; + input[base + 3] = 0xa5a5a5a5; // padding: must be ignored + input[base + 4] = 0x5a5a5a5a; + } + void* mapped = nullptr; + if (FAILED(source->Map(0, nullptr, &mapped)) || !mapped) return false; + std::memcpy(mapped, input.data(), sizeof(input)); + source->Unmap(0, nullptr); + + const D3D12_COMMAND_QUEUE_DESC queue_desc{D3D12_COMMAND_LIST_TYPE_DIRECT}; + Ref<ID3D12CommandQueue> queue; + Ref<ID3D12CommandAllocator> allocator, bundle_allocator; + Ref<ID3D12GraphicsCommandList> list, bundle; + Ref<ID3D12Fence> fence; + if (FAILED(dev->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))) || + FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))) || + FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&bundle_allocator.p))) || + FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_BUNDLE, bundle_allocator.p, pso.p, + IID_PPV_ARGS(&bundle.p))) || + FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr, + IID_PPV_ARGS(&list.p))) || + FAILED(dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p)))) + return false; + if (same_root) bundle->SetComputeRootSignature(root.p); + bundle->ExecuteIndirect(signature.p, kMaximum, args.p, kArgsOffset, nullptr, 0); + if (FAILED(bundle->Close())) return false; + + list->CopyBufferRegion(args.p, kArgsOffset, source.p, kArgsOffset, kMaximum * kStride); + list->CopyBufferRegion(output.p, 0, source.p, 256, 3 * kSlot); + const D3D12_RESOURCE_BARRIER ready[] = { + transition(args.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT), + transition(output.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}; + list->ResourceBarrier(2, ready); + list->SetComputeRootSignature(root.p); + const D3D12_GPU_VIRTUAL_ADDRESS va = output->GetGPUVirtualAddress(); + list->SetComputeRootUnorderedAccessView(0, va); + list->ExecuteBundle(bundle.p); + list->SetComputeRootUnorderedAccessView(0, va + kSlot); + list->ExecuteBundle(bundle.p); + list->SetComputeRootUnorderedAccessView(0, va + 2 * kSlot); ~~~~ --- The test description says the parent's UAV remains bound after `ExecuteBundle`. This explicit rebind makes the existing readback unable to detect losing that argument. I added a UAV barrier and a direct dispatch immediately after the second `ExecuteBundle`, before changing the UAV. The resulting `6/10 7/11 1/1` passed on the Vulkan layer, WARP and native D3D12 in both `same_root` modes. Could the fixture keep that extra readback check?
lixonik commented 2026-11-28 15:34:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T15:34:59Z.

Review: COMMENTED


Tested 860eea035 merged locally with main c1ecf04edc on Windows 11, MSVC 19.44, RTX 5070 (610.88). d3d12_bundle_indirect_dispatch, d3d12_indirect_dispatch_count and d3d12_indirect_group_budget passed. WARP, native D3D12 and the Vulkan layer agreed on both bundle variants and refused both invalid signatures with E_INVALIDARG.

I also ran the direct-dispatch retention check described inline. The extra case passed on all three paths.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098760640 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#pullrequestreview-6098760640). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T15:34:59Z. **Review:** COMMENTED --- Tested `860eea035` merged locally with `main` `c1ecf04edc` on Windows 11, MSVC 19.44, RTX 5070 (610.88). `d3d12_bundle_indirect_dispatch`, `d3d12_indirect_dispatch_count` and `d3d12_indirect_group_budget` passed. WARP, native D3D12 and the Vulkan layer agreed on both bundle variants and refused both invalid signatures with `E_INVALIDARG`. I also ran the direct-dispatch retention check described inline. The extra case passed on all three paths. AI-assisted.
MoonEyes commented 2026-11-28 19:45:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T19:45:37Z.

Code review location: runtime/test/d3d12_indirect_dispatch_count_test.cpp; line 259

@@ -164,6 +164,173 @@ std::array<UINT, 2> expected(UINT count, bool update, UINT second_count = 3) {
     return result;
 }
 
+// --bundle: a fixed-count DISPATCH ExecuteIndirect recorded in a bundle and executed twice by a direct list. The
+// bundle starts with the compute pipeline it was created with and has no root signature or root UAV of its own; the
+// parent binds the root UAV at slot 0 for the first ExecuteBundle and at slot 1 for the second, then dispatches one
+// group directly at slot 2. Each slot holds the shader's two counters (8 bytes, 64 bytes apart), so a slot shows
+// which root arguments the indirect records ran with: three records of 1, 2 and 3 groups give 6/10 in slots 0 and
+// 1, and the direct Dispatch(1, 1, 1) gives 1/1 in slot 2 (the bundle's pipeline stays on the parent, the parent's
+// root signature and arguments stay as they were). `same_root`: the bundle sets the parent's root signature before the call,
+// which keeps the parent's root arguments (docs/d3d12_vulkan.md, bundles).
+constexpr UINT kSlot = 64;  // bytes between the slots' counters
+using BundleResult = std::array<UINT, 6>;
+
+bool run_bundle(ID3D12Device* dev, const std::vector<std::uint8_t>& shader, bool same_root, BundleResult& result,
+                bool shim) {
+    Ref<ID3D12RootSignature> root;
+    D3D12_ROOT_PARAMETER param{};
+    param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
+    param.Descriptor = {0, 0};
+    param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+    D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{};
+    root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0;
+    root_desc.Desc_1_0 = {1, &param, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE};
+    const auto serialized = serialize_root_signature(root_desc);
+    if (serialized.empty() ||
+        FAILED(dev->CreateRootSignature(0, serialized.data(), serialized.size(), IID_PPV_ARGS(&root.p))))
+        return false;
+    D3D12_COMPUTE_PIPELINE_STATE_DESC desc{};
+    desc.pRootSignature = root.p;
+    desc.CS = {shader.data(), shader.size()};
+    Ref<ID3D12PipelineState> pso;
+    if (FAILED(dev->CreateComputePipelineState(&desc, IID_PPV_ARGS(&pso.p)))) return false;
+    const D3D12_INDIRECT_ARGUMENT_DESC argument{D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH};
+    const D3D12_COMMAND_SIGNATURE_DESC signature_desc{kStride, 1, &argument, 0};
+    Ref<ID3D12CommandSignature> signature;
+    if (FAILED(dev->CreateCommandSignature(&signature_desc, nullptr, IID_PPV_ARGS(&signature.p)))) return false;
+    const D3D12_HEAP_PROPERTIES upload_heap{D3D12_HEAP_TYPE_UPLOAD};
+    const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT};
+    const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK};
+    Ref<ID3D12Resource> source, args, output, readback;
+    const auto create = [&](Ref<ID3D12Resource>& dest, D3D12_HEAP_PROPERTIES heap, D3D12_RESOURCE_STATES state,
+                            D3D12_RESOURCE_FLAGS flags) {
+        const auto buffer = buffer_desc(512, flags);
+        return SUCCEEDED(dev->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, state, nullptr,
+                                                      IID_PPV_ARGS(&dest.p)));
+    };
+    if (!create(source, upload_heap, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_FLAG_NONE) ||
+        !create(args, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE) ||
+        !create(output, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) ||
+        !create(readback, readback_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE))
+        return false;
+    std::array<UINT, 128> input{};  // bytes 256..511 stay zero: the output's initial value
+    for (UINT i = 0; i < kMaximum; ++i) {
+        const UINT base = (kArgsOffset + i * kStride) / 4;
+        input[base] = i + 1;
+        input[base + 1] = input[base + 2] = 1;
+        input[base + 3] = 0xa5a5a5a5;  // padding: must be ignored
+        input[base + 4] = 0x5a5a5a5a;
+    }
+    void* mapped = nullptr;
+    if (FAILED(source->Map(0, nullptr, &mapped)) || !mapped) return false;
+    std::memcpy(mapped, input.data(), sizeof(input));
+    source->Unmap(0, nullptr);
+
+    const D3D12_COMMAND_QUEUE_DESC queue_desc{D3D12_COMMAND_LIST_TYPE_DIRECT};
+    Ref<ID3D12CommandQueue> queue;
+    Ref<ID3D12CommandAllocator> allocator, bundle_allocator;
+    Ref<ID3D12GraphicsCommandList> list, bundle;
+    Ref<ID3D12Fence> fence;
+    if (FAILED(dev->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))) ||
+        FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))) ||
+        FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&bundle_allocator.p))) ||
+        FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_BUNDLE, bundle_allocator.p, pso.p,
+                                      IID_PPV_ARGS(&bundle.p))) ||
+        FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr,
+                                      IID_PPV_ARGS(&list.p))) ||
+        FAILED(dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p))))
+        return false;
+    if (same_root) bundle->SetComputeRootSignature(root.p);
+    bundle->ExecuteIndirect(signature.p, kMaximum, args.p, kArgsOffset, nullptr, 0);
+    if (FAILED(bundle->Close())) return false;
+
+    list->CopyBufferRegion(args.p, kArgsOffset, source.p, kArgsOffset, kMaximum * kStride);
+    list->CopyBufferRegion(output.p, 0, source.p, 256, 3 * kSlot);
+    const D3D12_RESOURCE_BARRIER ready[] = {
+        transition(args.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT),
+        transition(output.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS)};
+    list->ResourceBarrier(2, ready);
+    list->SetComputeRootSignature(root.p);
+    const D3D12_GPU_VIRTUAL_ADDRESS va = output->GetGPUVirtualAddress();
+    list->SetComputeRootUnorderedAccessView(0, va);
+    list->ExecuteBundle(bundle.p);
+    list->SetComputeRootUnorderedAccessView(0, va + kSlot);
+    list->ExecuteBundle(bundle.p);
+    list->SetComputeRootUnorderedAccessView(0, va + 2 * kSlot);

Added in b5447692f (UAV barrier and a direct Dispatch(1, 1, 1) right after the second ExecuteBundle, before any rebind): 6/10 7/11 1/1 on the layer, WARP and native D3D12 (RTX 4060, 610.88) in both same_root cases, merged with current main in 3c108a339. Thanks. AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4728548193 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#discussion_r4728548193). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T19:45:37Z. **Code review location:** `runtime/test/d3d12_indirect_dispatch_count_test.cpp`; line 259 ~~~~diff @@ -164,6 +164,173 @@ std::array<UINT, 2> expected(UINT count, bool update, UINT second_count = 3) { return result; } +// --bundle: a fixed-count DISPATCH ExecuteIndirect recorded in a bundle and executed twice by a direct list. The +// bundle starts with the compute pipeline it was created with and has no root signature or root UAV of its own; the +// parent binds the root UAV at slot 0 for the first ExecuteBundle and at slot 1 for the second, then dispatches one +// group directly at slot 2. Each slot holds the shader's two counters (8 bytes, 64 bytes apart), so a slot shows +// which root arguments the indirect records ran with: three records of 1, 2 and 3 groups give 6/10 in slots 0 and +// 1, and the direct Dispatch(1, 1, 1) gives 1/1 in slot 2 (the bundle's pipeline stays on the parent, the parent's +// root signature and arguments stay as they were). `same_root`: the bundle sets the parent's root signature before the call, +// which keeps the parent's root arguments (docs/d3d12_vulkan.md, bundles). +constexpr UINT kSlot = 64; // bytes between the slots' counters +using BundleResult = std::array<UINT, 6>; + +bool run_bundle(ID3D12Device* dev, const std::vector<std::uint8_t>& shader, bool same_root, BundleResult& result, + bool shim) { + Ref<ID3D12RootSignature> root; + D3D12_ROOT_PARAMETER param{}; + param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + param.Descriptor = {0, 0}; + param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{}; + root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0; + root_desc.Desc_1_0 = {1, &param, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE}; + const auto serialized = serialize_root_signature(root_desc); + if (serialized.empty() || + FAILED(dev->CreateRootSignature(0, serialized.data(), serialized.size(), IID_PPV_ARGS(&root.p)))) + return false; + D3D12_COMPUTE_PIPELINE_STATE_DESC desc{}; + desc.pRootSignature = root.p; + desc.CS = {shader.data(), shader.size()}; + Ref<ID3D12PipelineState> pso; + if (FAILED(dev->CreateComputePipelineState(&desc, IID_PPV_ARGS(&pso.p)))) return false; + const D3D12_INDIRECT_ARGUMENT_DESC argument{D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH}; + const D3D12_COMMAND_SIGNATURE_DESC signature_desc{kStride, 1, &argument, 0}; + Ref<ID3D12CommandSignature> signature; + if (FAILED(dev->CreateCommandSignature(&signature_desc, nullptr, IID_PPV_ARGS(&signature.p)))) return false; + const D3D12_HEAP_PROPERTIES upload_heap{D3D12_HEAP_TYPE_UPLOAD}; + const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT}; + const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK}; + Ref<ID3D12Resource> source, args, output, readback; + const auto create = [&](Ref<ID3D12Resource>& dest, D3D12_HEAP_PROPERTIES heap, D3D12_RESOURCE_STATES state, + D3D12_RESOURCE_FLAGS flags) { + const auto buffer = buffer_desc(512, flags); + return SUCCEEDED(dev->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, state, nullptr, + IID_PPV_ARGS(&dest.p))); + }; + if (!create(source, upload_heap, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_FLAG_NONE) || + !create(args, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE) || + !create(output, default_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) || + !create(readback, readback_heap, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_FLAG_NONE)) + return false; + std::array<UINT, 128> input{}; // bytes 256..511 stay zero: the output's initial value + for (UINT i = 0; i < kMaximum; ++i) { + const UINT base = (kArgsOffset + i * kStride) / 4; + input[base] = i + 1; + input[base + 1] = input[base + 2] = 1; + input[base + 3] = 0xa5a5a5a5; // padding: must be ignored + input[base + 4] = 0x5a5a5a5a; + } + void* mapped = nullptr; + if (FAILED(source->Map(0, nullptr, &mapped)) || !mapped) return false; + std::memcpy(mapped, input.data(), sizeof(input)); + source->Unmap(0, nullptr); + + const D3D12_COMMAND_QUEUE_DESC queue_desc{D3D12_COMMAND_LIST_TYPE_DIRECT}; + Ref<ID3D12CommandQueue> queue; + Ref<ID3D12CommandAllocator> allocator, bundle_allocator; + Ref<ID3D12GraphicsCommandList> list, bundle; + Ref<ID3D12Fence> fence; + if (FAILED(dev->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))) || + FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))) || + FAILED(dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&bundle_allocator.p))) || + FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_BUNDLE, bundle_allocator.p, pso.p, + IID_PPV_ARGS(&bundle.p))) || + FAILED(dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr, + IID_PPV_ARGS(&list.p))) || + FAILED(dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p)))) + return false; + if (same_root) bundle->SetComputeRootSignature(root.p); + bundle->ExecuteIndirect(signature.p, kMaximum, args.p, kArgsOffset, nullptr, 0); + if (FAILED(bundle->Close())) return false; + + list->CopyBufferRegion(args.p, kArgsOffset, source.p, kArgsOffset, kMaximum * kStride); + list->CopyBufferRegion(output.p, 0, source.p, 256, 3 * kSlot); + const D3D12_RESOURCE_BARRIER ready[] = { + transition(args.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT), + transition(output.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}; + list->ResourceBarrier(2, ready); + list->SetComputeRootSignature(root.p); + const D3D12_GPU_VIRTUAL_ADDRESS va = output->GetGPUVirtualAddress(); + list->SetComputeRootUnorderedAccessView(0, va); + list->ExecuteBundle(bundle.p); + list->SetComputeRootUnorderedAccessView(0, va + kSlot); + list->ExecuteBundle(bundle.p); + list->SetComputeRootUnorderedAccessView(0, va + 2 * kSlot); ~~~~ --- Added in b5447692f (UAV barrier and a direct `Dispatch(1, 1, 1)` right after the second `ExecuteBundle`, before any rebind): 6/10 7/11 1/1 on the layer, WARP and native D3D12 (RTX 4060, 610.88) in both `same_root` cases, merged with current main in 3c108a339. Thanks. AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.
lixonik commented 2026-11-28 20:02:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T20:02:20Z.

Review: APPROVED


Re-reviewed 3c108a339 (including b5447692f and the main merge) and verified on RTX 5070 with Khronos validation enabled.

Code audit:

  • runtime/test/d3d12_indirect_dispatch_count_test.cpp, docs/d3d12_vulkan.md: adding the UAV barrier and direct Dispatch(1, 1, 1) immediately after the second ExecuteBundle without rebinding cleanly proves the parent's root UAV survives the bundle (6/10 7/11 1/1 in both same_root modes across the Vulkan layer, WARP, and native D3D12).

Verification at 3c108a339 (Windows 11, MSVC 19.44, Ninja Release, LEONIDA_VK_VALIDATION=1):

  • Built d3d12_indirect_dispatch_count_test.
  • ctest -R '^(d3d12_bundle_indirect_dispatch|d3d12_indirect_dispatch_count|d3d12_indirect_group_budget)$': 3/3 passed (0 validation errors).
  • python -I scripts/check_no_game_data.py: passed.

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6099874303 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#pullrequestreview-6099874303). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T20:02:20Z. **Review:** APPROVED --- Re-reviewed `3c108a339` (including `b5447692f` and the `main` merge) and verified on RTX 5070 with Khronos validation enabled. Code audit: - `runtime/test/d3d12_indirect_dispatch_count_test.cpp`, `docs/d3d12_vulkan.md`: adding the UAV barrier and direct `Dispatch(1, 1, 1)` immediately after the second `ExecuteBundle` without rebinding cleanly proves the parent's root UAV survives the bundle (`6/10 7/11 1/1` in both `same_root` modes across the Vulkan layer, WARP, and native D3D12). Verification at `3c108a339` (Windows 11, MSVC 19.44, Ninja Release, `LEONIDA_VK_VALIDATION=1`): - Built `d3d12_indirect_dispatch_count_test`. - `ctest -R '^(d3d12_bundle_indirect_dispatch|d3d12_indirect_dispatch_count|d3d12_indirect_group_budget)$'`: **3/3 passed** (0 validation errors). - `python -I scripts/check_no_game_data.py`: passed. GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, `VK_LAYER_KHRONOS_validation` 1.4.363). AI-assisted (Antigravity, Gemini).
MoonEyes commented 2026-11-28 20:02:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:02:45Z.


@DadaCap could you review this one when you have a moment? It merges cleanly with main. The red checks are the three tests that fail on main 5cb45921e too, already claimed: test_valu_cvt_f16_int16_mods (translator f16), test_the_loader_gets_the_stack_reserve_cmake_gives_it (loader stack) and test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive (path dedup). None of them touches this diff. The ERROR: lines in those logs come from tests that pass.

AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7244994100 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#issuecomment-7244994100). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T20:02:45Z. --- @DadaCap could you review this one when you have a moment? It merges cleanly with `main`. The red checks are the three tests that fail on `main` 5cb45921e too, already claimed: `test_valu_cvt_f16_int16_mods` (translator f16), `test_the_loader_gets_the_stack_reserve_cmake_gives_it` (loader stack) and `test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive` (path dedup). None of them touches this diff. The `ERROR:` lines in those logs come from tests that pass. AI-assisted (Claude Code, Claude Opus 5.5), posted for MoonEyes.
zmasi commented 2026-11-28 20:50:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:50:49Z.


Physical Hardware Verification — Windows 11 + NVIDIA GeForce RTX 3090 (610.88, Khronos Validation 1.4.363.1) + WARP

Verified head commit 3c108a33959e82a143f7a6c055f0c20f876c9842 cleanly merged (no-commit) onto origin/main (1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3; git merge-tree --write-tree rc=0, and also conflict-free with #2582).

Red -> Green Verification

  • Red (origin/main 1bc055e6c2): CTest d3d12_bundle_indirect_dispatch does not exist (ctest -R "^d3d12_bundle_indirect_dispatch$" finds 0 tests), and passing --bundle to d3d12_indirect_dispatch_count_test on origin/main is ignored without checking argc or running any bundle test.
  • Green (origin/main + 3c108a3395, built with MSVC 19.44, LEONIDA_VK_VALIDATION=1):
    • d3d12_indirect_dispatch_count_test --bundle:
      • WARP: bundle ExecuteIndirect Close with a count buffer 0x80070057, with a root constant 0x80070057
      • the default adapter: bundle ExecuteIndirect Close with a count buffer 0x80070057, with a root constant 0x80070057 (NVIDIA GeForce RTX 3090 native D3D12)
      • device: NVIDIA GeForce RTX 3090 (validation on)
      • bundle ExecuteIndirect(DISPATCH): layer and 2 host adapter(s) gave 6/10 7/11 1/1 in both cases; count buffer and root constant refused (0 Khronos Vulkan validation errors across same_root = false and same_root = true).
    • ctest -C Release -R "^(d3d12_bundle_indirect_dispatch|d3d12_indirect_dispatch_count|d3d12_indirect_group_budget)$" --output-on-failure -j 4: 3/3 passed.
    • python -I tests/test_docs_encoding.py (1/1), python -I tests/test_docs_links.py (17/17), python -I tests/test_docs_env_vars.py (5/5), and python -I scripts/check_no_game_data.py docs/d3d12_vulkan.md runtime/CMakeLists.txt runtime/test/d3d12_indirect_dispatch_count_test.cpp (0 issues) all pass.

Code Review Notes

  • Calling Dispatch(1, 1, 1) immediately after the second ExecuteBundle behind a UAV barrier without rebinding SetComputeRootUnorderedAccessView verifies that the parent direct list's root signature and root UAV survive bundle replay (7/11 in slot 1, 1/1 in slot 2), while bundle_refusals checks Close() (E_INVALIDARG) without submitting the rejected bundle. No blockers found.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245584727 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#issuecomment-7245584727). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T20:50:49Z. --- ### Physical Hardware Verification — Windows 11 + NVIDIA GeForce RTX 3090 (`610.88`, Khronos Validation `1.4.363.1`) + WARP Verified head commit `3c108a33959e82a143f7a6c055f0c20f876c9842` cleanly merged (no-commit) onto `origin/main` (`1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3`; `git merge-tree --write-tree` `rc=0`, and also conflict-free with `#2582`). #### Red -> Green Verification - **Red (`origin/main` `1bc055e6c2`)**: CTest `d3d12_bundle_indirect_dispatch` does not exist (`ctest -R "^d3d12_bundle_indirect_dispatch$"` finds `0` tests), and passing `--bundle` to `d3d12_indirect_dispatch_count_test` on `origin/main` is ignored without checking `argc` or running any bundle test. - **Green (`origin/main` + `3c108a3395`, built with MSVC `19.44`, `LEONIDA_VK_VALIDATION=1`)**: - `d3d12_indirect_dispatch_count_test --bundle`: - `WARP: bundle ExecuteIndirect Close with a count buffer 0x80070057, with a root constant 0x80070057` - `the default adapter: bundle ExecuteIndirect Close with a count buffer 0x80070057, with a root constant 0x80070057` (NVIDIA GeForce RTX 3090 native D3D12) - `device: NVIDIA GeForce RTX 3090 (validation on)` - `bundle ExecuteIndirect(DISPATCH): layer and 2 host adapter(s) gave 6/10 7/11 1/1 in both cases; count buffer and root constant refused` (`0` Khronos Vulkan validation errors across `same_root = false` and `same_root = true`). - `ctest -C Release -R "^(d3d12_bundle_indirect_dispatch|d3d12_indirect_dispatch_count|d3d12_indirect_group_budget)$" --output-on-failure -j 4`: **3/3 passed**. - `python -I tests/test_docs_encoding.py` (`1/1`), `python -I tests/test_docs_links.py` (`17/17`), `python -I tests/test_docs_env_vars.py` (`5/5`), and `python -I scripts/check_no_game_data.py docs/d3d12_vulkan.md runtime/CMakeLists.txt runtime/test/d3d12_indirect_dispatch_count_test.cpp` (`0` issues) all pass. #### Code Review Notes - Calling `Dispatch(1, 1, 1)` immediately after the second `ExecuteBundle` behind a UAV barrier without rebinding `SetComputeRootUnorderedAccessView` verifies that the parent direct list's root signature and root UAV survive bundle replay (`7/11` in slot 1, `1/1` in slot 2), while `bundle_refusals` checks `Close()` (`E_INVALIDARG`) without submitting the rejected bundle. No blockers found. AI-assisted.
TheGeogeo commented 2026-11-28 21:29:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T21:29:40Z.


Re-checked on main c8bf0e7b6 (head unchanged, 3c108a339). GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300:

  • Green: d3d12_bundle_indirect_dispatch and d3d12_indirect_dispatch_count pass on the merge.
  • Red: with the bundle branch of ExecuteIndirect cut in runtime/shims/d3d12_com.cpp, it fails again with layer same_root=0: 0/0 0/0 0/0, expected 6/10 7/11 1/1.
  • No regression: of the 245 other tests in the 141 relinked executables, only xbox_present fails, as on plain main.
  • LINK: gta6rt.exe linked without ws2_32.lib gives main's 26 unresolved Rust-std symbols, nothing new. Its imports are identical to main's.

Tested 3c108a339 merged (no commit) with main aa918e5d9. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300, plus WARP.

  • Green: d3d12_bundle_indirect_dispatch (--bundle) and d3d12_indirect_dispatch_count pass. The layer, WARP and the default adapter give 6/10 7/11 1/1 in both cases. The count-buffer and root-constant bundles fail Close with 0x80070057 on both host adapters.
  • Red: with the bundle branch of ExecuteIndirect cut in runtime/shims/d3d12_com.cpp (if (false && type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE)), --bundle fails: layer same_root=0: 0/0 0/0 0/0, expected 6/10 7/11 1/1.
  • check_no_game_data.py is clean on the three files.
  • Only the test target was built. I did not run the full ctest: the change is this test's source, its CMake registration and docs.

Nit: the description still says 6/10 6/10 1/1. Since b5447692f the test expects 6/10 7/11 1/1.

No blocker from my side. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246058492 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#issuecomment-7246058492). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T21:29:40Z. --- **Re-checked on `main` `c8bf0e7b6`** (head unchanged, `3c108a339`). GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300: - Green: `d3d12_bundle_indirect_dispatch` and `d3d12_indirect_dispatch_count` pass on the merge. - Red: with the bundle branch of `ExecuteIndirect` cut in `runtime/shims/d3d12_com.cpp`, it fails again with `layer same_root=0: 0/0 0/0 0/0, expected 6/10 7/11 1/1`. - No regression: of the 245 other tests in the 141 relinked executables, only `xbox_present` fails, as on plain `main`. - LINK: `gta6rt.exe` linked without `ws2_32.lib` gives `main`'s 26 unresolved Rust-std symbols, nothing new. Its imports are identical to `main`'s. --- Tested `3c108a339` merged (no commit) with `main` `aa918e5d9`. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300, plus WARP. - Green: `d3d12_bundle_indirect_dispatch` (`--bundle`) and `d3d12_indirect_dispatch_count` pass. The layer, WARP and the default adapter give 6/10 7/11 1/1 in both cases. The count-buffer and root-constant bundles fail `Close` with `0x80070057` on both host adapters. - Red: with the bundle branch of `ExecuteIndirect` cut in `runtime/shims/d3d12_com.cpp` (`if (false && type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE)`), `--bundle` fails: `layer same_root=0: 0/0 0/0 0/0, expected 6/10 7/11 1/1`. - `check_no_game_data.py` is clean on the three files. - Only the test target was built. I did not run the full ctest: the change is this test's source, its CMake registration and docs. Nit: the description still says 6/10 6/10 1/1. Since `b5447692f` the test expects 6/10 7/11 1/1. No blocker from my side. AI-assisted (Claude Code).
timbot103 commented 2026-11-29 01:07:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T01:07:45Z.

Review: COMMENTED


Static audit of 3c108a339 against 48bae6cad. The two bundle calls and the direct follow-up cover the parent root UAV and bundle PSO behavior.

In run_bundle, the upload ends after the third record, so an extra indirect dispatch can read a zero-group fourth record and leave the counters unchanged. Could you upload a fourth valid record such as (4, 1, 1) while still passing MaxCommandCount = 3? The expected counters can stay the same.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6100844653 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#pullrequestreview-6100844653). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T01:07:45Z. **Review:** COMMENTED --- Static audit of `3c108a339` against `48bae6cad`. The two bundle calls and the direct follow-up cover the parent root UAV and bundle PSO behavior. In `run_bundle`, the upload ends after the third record, so an extra indirect dispatch can read a zero-group fourth record and leave the counters unchanged. Could you upload a fourth valid record such as `(4, 1, 1)` while still passing `MaxCommandCount = 3`? The expected counters can stay the same. AI-assisted.
merzleckeier commented 2026-11-29 11:45:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T11:45:40Z.


Linux GPU check and fourth-record control for the review above. With f58143876 merged on 8fb974878, I ran d3d12_bundle_indirect_dispatch, d3d12_indirect_dispatch_count, and d3d12_indirect_group_budget under Wine 11.22 on CachyOS. All three passed on the Radeon 610M (RADV Mesa 26.3.1) and on the RTX 4070 SUPER (NVIDIA 620.73.04). The bundle checks used the Vulkan layer and included both same_root variants and both E_INVALIDARG cases. No game files.

I tested the suggested fourth record in a local fixture-only copy. I initialized and copied four records and kept MaxCommandCount=3. Both GPUs still read back 6/10 7/11 1/1 in both variants. In the same binary, changing only MaxCommandCount to 4 made same_root=0 fail on both GPUs with 10/20 11/21 1/1. The fourth record makes an extra execution observable without changing the expected values.

Khronos validation 1.4.363.1 was loaded by the Linux Vulkan loader. The one host-layer VUID across these runs was the same device-creation extension dependency (01387, VK_EXT_external_memory_dma_buf) seen in the separate #2184 runs. AI-assisted with OpenAI Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7255331726 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2575#issuecomment-7255331726). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T11:45:40Z. --- Linux GPU check and fourth-record control for the review above. With `f58143876` merged on `8fb974878`, I ran `d3d12_bundle_indirect_dispatch`, `d3d12_indirect_dispatch_count`, and `d3d12_indirect_group_budget` under Wine 11.22 on CachyOS. All three passed on the Radeon 610M (RADV Mesa 26.3.1) and on the RTX 4070 SUPER (NVIDIA 620.73.04). The bundle checks used the Vulkan layer and included both `same_root` variants and both `E_INVALIDARG` cases. No game files. I tested [the suggested fourth record](https://github.com/ProjectLeonida/mandy/pull/2575#pullrequestreview-6100844653) in a local fixture-only copy. I initialized and copied four records and kept `MaxCommandCount=3`. Both GPUs still read back `6/10 7/11 1/1` in both variants. In the same binary, changing only `MaxCommandCount` to 4 made `same_root=0` fail on both GPUs with `10/20 11/21 1/1`. The fourth record makes an extra execution observable without changing the expected values. Khronos validation 1.4.363.1 was loaded by the Linux Vulkan loader. The one host-layer VUID across these runs was the same device-creation extension dependency (`01387`, `VK_EXT_external_memory_dma_buf`) seen [in the separate #2184 runs](https://github.com/ProjectLeonida/mandy/pull/2184#issuecomment-7255265458). AI-assisted with OpenAI Codex (GPT-6).
Sign in to join this conversation.
No reviewers
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
ProjectLeonida/mandy!2575
No description provided.