Repository navigation
D3D-97: give live D3D12 queues distinct Vulkan queues - #1404
Conversation
Explain cross-queue Wait-before-Signal progress and the caller-owned legacy limitation. AI-assisted (Codex).
Build a synthetic Wait-before-Signal test. AI-assisted (Codex).
Give each live standalone D3D12 queue its own graphics-family VkQueue so cross-queue Wait-before-Signal can progress. Preserve legacy caller-owned devices. AI-assisted (Codex).
Exercise copy/compute and direct/direct waits with synthetic fences on Vulkan. AI-assisted (Codex).
Keep the published diff limited to the new regression-test target. AI-assisted (Codex).
Keep the published diff limited to queue leasing. AI-assisted (Codex).
whattheflop
left a comment
There was a problem hiding this comment.
Independent AI-assisted review of exact head bed399b7b615b4406c0ac118556e64b11b6b9e8a (Codex). D3D-97 is kovaaper's existing claim.
Native Windows preflight. Windows 11 Pro build 26200 on Ryzen 7 9800X3D. The stock d3d12_queue_wait_test target built in RelWithDebInfo with CMake 4.4.4, MSVC 19.38.33145, Ninja 1.13.2 and Vulkan SDK 1.4.363.0. CTest enumerated one focused test. Two isolated vulkaninfo inventories and two validation-enabled summaries completed, with one VK_DRIVER_FILES manifest and one physical device per process. The loader confirmed Khronos validation 1.4.363 was loaded in both summaries.
| Adapter | Driver | Vulkan API | First graphics family | Queue count / head's requested count |
|---|---|---|---|---|
| Radeon(TM) Graphics (9800X3D iGPU) | AMD 25.10.30.02 (32.0.21030.2001) | 1.4.315 | 0 | 8 / 8 |
| GeForce RTX 3080 | NVIDIA 616.64 (32.0.16.1664) | 1.4.351 | 0 | 16 / 16 |
Both GPUs report the four required device features and have capacity for all four live queues. Stock execution counts were 0 pass, 0 skip, 0 fail (0 launches). Independent progress and same-device lease reuse remain unverified on hardware.
Submission ordering. VulkanQueue::submit signals the same device-wide retirement timeline from every queue. The mutex serializes host submission and ticket assignment. Once queues have separate handles those tickets can execute out of order. In the stock sequence, the batch with the higher retirement ticket can signal it before the batch waiting on that producer signals its lower ticket. Vulkan requires every signal to exceed the timeline value at execution, and a higher completed ticket cannot establish that smaller tickets have retired. Vulkan VkSubmitInfo valid usage.
Timeout cleanup. The test uses a 3 s wait per event and a 20 s CTest timeout. Its fallback signals the gates at 1, which the fence shim drops after a queue has claimed 2, including if that queue submission fails after the claim. wait_for closes the event even on timeout while the dispatcher can still hold the handle. The fences also go out of scope before the queues idle. I stopped at build and inventory because the test's timeout path does not establish safe cleanup.
|
Code review of
Clean implementation and solid test coverage. AI-assisted. |
|
Tested
1. The pool is finite, and exhausting it fails queue creation. The pool is
Would it work to fall back to sharing a handle (today's behaviour) with a one-time log once the pool is exhausted, rather than failing? That's for a title that creates more queues than the family has, or a driver that exposes very few. 2. Staging shares handle 0 with the first D3D12 queue. The staging path only runs without The lease's lifetime itself looks right to me, as @MIGHTYLUV also found. AI-assisted (Claude Code). |
|
Tested bed399b on Windows 11 (native, MSVC 17.14, Vulkan SDK 1.4.363), NVIDIA RTX 3070 Ti Laptop (621.14),
One robustness point from the code read: every lease comes from Related: The CI failure on this PR is |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. |
|
Follow-up validation after the merge: I rebuilt |
Claimed in the coordination issue as: D3D-97 — #634 (comment)
What and why
A Wait submitted to the shared Vulkan queue can block a Signal from another D3D12 queue behind it. The standalone device now requests up to 16 handles from its graphics-capable queue family and leases a distinct handle to each live copy, compute or direct queue. The lease is returned after the queue is idle; exhausting the pool returns E_OUTOFMEMORY rather than silently sharing a handle. A synthetic test exercises copy/compute and direct/direct Wait-before-Signal ordering.
Caller-owned Vulkan devices with only the legacy
queuefield keep their existing single-queue behavior; they can supplycommand_queuesto opt into separate handles. Dedicated compute/transfer families remain follow-up work because resources need queue-family ownership transfers. Related: #306. No game files or shaders.Tested
LEONIDA_VK_VALIDATION=1with Vulkan SDK 1.4.363.0 validation layer.d3d12_queue_wait_test,d3d12_com_testandd3d12_vulkan_device_test: passed.d3d12_com_test,ctest -R "^(d3d12_queue_wait|d3d12_vulkan_device|d3d12_com)$" --output-on-failure: 3/3 passed. The earlier line 209 failure did not reproduce after the rebuild; no source change was needed for that test.git diff --checkpassed.Checklist