Repository navigation
D3D-97 follow-up: retire submissions in completion order - #1654
Conversation
dcastell1
left a comment
There was a problem hiding this comment.
Built and ran it on this machine (Windows 11, MSVC 19.44, Ninja):
1/1 Test #1: retire_tickets ... Passed 0.05 sec
The structure is right: only the contiguous prefix advances, and queue_idle() marking entries rather than erasing them keeps the FIFO intact for the other queues. Two assumptions worth stating in the header, since the type cannot enforce them: tickets must be recorded in increasing order on the calling thread (a duplicate or a ticket going backwards leaves the prefix stuck forever), and queue_idle() must be called with the queue actually idle — otherwise an entry is retired before its semaphore value is signalled. If the callers already guarantee both, ignore me.
|
Follow-up for @dcastell1’s review: commit 73311ed documents both preconditions in |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. |
|
Re-ran |
|
Tested
AI-assisted (Claude Code). |
|
Tested 73311ed on NVIDIA GeForce RTX 3060 (driver 32.0.16.1714), Windows 11, MSVC 19.51, Windows SDK 10.0.26100: pass. Built AI-assisted (Claude). |
Claimed in the coordination issue as: #1548 (comment)
Depends on: #1404 (merged)
What and why
The separate Vulkan queues added by #1404 can complete in a different order from their host submissions. The old device-wide retirement timeline gave each submission a consecutive signal value; a later queue could signal its higher value first, making a deferred resource appear safe to destroy while an earlier queue still uses it. A subsequent lower signal could also violate Vulkan timeline ordering.
Each queue now signals only its own monotonic progress timeline. The device tracks accepted submissions in host order and retires only the contiguous prefix whose per-queue progress has completed. Queue destruction marks its submitted work complete after waiting idle, before its progress semaphore is destroyed. Deferred deletions take the submission lock while assigning their safe ticket so the deletion queue remains ordered.
A CPU-only regression test simulates queue 2 completing before queue 1 and verifies ticket 2 cannot retire ticket 1's resources. It also checks that a destroyed queue's semaphore is never queried.
Tested
Windows 11, NVIDIA GeForce RTX 3060 (driver 621.01), MSVC 19.44/Ninja, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1: built the new test and four relevant D3D12 test targets; CTest retire_tickets, d3d12_com, d3d12_queue_wait, d3d12_vulkan_device, d3d12_multithread: 5/5 passed. The CPU test forces reverse completion order; the GPU tests exercise normal hardware scheduling.
Checklist
Separate review concerns about the finite queue pool, staging handle reuse, and the timeout cleanup path remain outside this change.