Repository navigation
Conversation
…kets (D3D-486) ~VulkanFence destroyed its timeline semaphore at once, though submissions made before (a queue Signal behind other work, a GPU Wait for it) may still signal or wait for it: VUID-vkDestroySemaphore-semaphore-05149. A queue Wait not yet attached to a batch, or a held Signal of the fence, would also be submitted later with the destroyed handle. - vulkan_backend.h: DeferredDeletionQueue::Kind::semaphore; ~VulkanFence calls remove_fence, then defers the semaphore (retired once every submission made before the release has completed). VulkanQueue::discard_waiting_on also forgets the semaphore: a Wait not yet attached counts as reached (as a released fence does for the CPU), a held Signal of it signals nothing; held batches waiting on it are still dropped and reported. - queue_holds.h: remove_fence asks every queue, not only when something is held (a pending Wait names the fence too). - d3d12_queue_handover_test: case on the layer and the host runtime, behind a ~300 ms GPU gate on the COPY queue: A a Signal and a DIRECT Wait in flight, B a Wait not yet attached, C a held Signal; each fence is released right away, readbacks exact. With the semaphore destroyed at once (origin/main behaviour) the layer gave VUID-vkDestroySemaphore-semaphore-05149 (A, B), VUID-VkSubmitInfo-pWaitSemaphores-parameter (B) and an access violation. - docs/d3d12_vulkan.md 4.4. RTX 3060 / 617.14, LEONIDA_VK_VALIDATION=1 with sync validation: 374 layer cases, 372 host, 0 messages. AI-assisted.
…(D3D-496) When an ID3D12Fence was released while a queue held a batch waiting on it, VulkanQueue::discard_waiting_on dropped the batch and printed "that work is dropped". The host runtime lets the queue go on: the batch runs and a Signal after it is reached (measured on an RTX 5060 host, and by @Exopus-0x65f7ad0 on an RTX 5060 Ti with the debug layer on). discard_waiting_on now takes only the released fence's wait off each held operation, as ItsNotRexed#4663 already does for a Wait not yet attached to a submission; remove_fence's pump_ready then releases the operation in queue order once its other waits are met. No batch is dropped. d3d12_queue_handover_test's "fence released while a batch waits" now checks that behaviour on the layer and on the host runtime: the held batch copies data to stage[1] and signals 101, and after the release the Signal is reached and stage[1] reads back exact. Without the change the layer drops the batch and the case fails.
Kam471
left a comment
There was a problem hiding this comment.
Built and ran d3d12_queue_handover_test at d7e534067 on Windows 11, RTX 5070 Ti: exit 0.
fence released while a batch waits: the batch ran and its Signal was reached(the new D3D-496 case 2)fences released while in use (gate of 265 copies): A Signal and Wait in flight, B Wait not yet attached, C held Signal: every readback exact- Vulkan layer 374 cases, every one exact; Host D3D12 373 cases, every one exact.
The change lets a queue that is waiting on a released fence continue (releasing the wait) instead of stalling, matching the host; the added scenario covers the batch finishing and signalling.
Merge check: clean with #4663 (exit 0), which is the natural pair; conflicts with #4681 (vulkan_backend.h), #4557 (vulkan_backend.h, handover test), #4570 (queue_holds.h) and #4577 (docs, handover test). git diff --check clean. No blocking issue.
|
Tested I built For the negative control, I used NVIDIA driver 32.0.16.2101. AMD driver 32.0.21043.5001. Vulkan validation was off. AI-assisted. |
|
Tested Stacking: as declared, the branch is #4663 (
No blocking issue. AI-assisted. |
|
Tested |
D3D-496, case 2. Claimed in the coordination issue as: #4683 (comment) (from @Exopus-0x65f7ad0's finding)
Depends on: #4663 (D3D-486, @requiemsnkrp). This branch is stacked on its head
0cc958d0. Only the last commit is this PR's.What and why
When an
ID3D12Fenceis released while a queue holds a batch that waits on it,remove_fence→VulkanQueue::discard_waiting_ondrops the batch ([rt] d3d12: a fence was released while a queue still held work waiting on it; that work is dropped). The host runtime lets the queue go on: the batch runs and theSignalafter it is reached. An app may release a fence right after using it (a queueWaittakes no COM reference), so dropped batches mean missing GPU work and signals that never arrive.The change
VulkanQueue::discard_waiting_ontakes only the released fence's wait (semaphore + value) off each held operation, instead of erasing the operation. Runtime: keep a released fence's semaphore until the GPU is done with it (D3D-486) #4663 already does this for aWaitnot yet attached to a submission.remove_fence'spump_ready()then releases the operation in queue order once its other waits are met. The semaphore is never waited on after the release, so Runtime: keep a released fence's semaphore until the GPU is done with it (D3D-486) #4663's deferred retirement stays valid.queue_holds.h/vulkan_backend.hand thedocs/d3d12_vulkan.mdedge-case sentence describe the new behaviour.d3d12_queue_handover_test, case "fence released while a batch waits", now runs on the layer and on the host runtime. The held batch copies the upload data tostage[1]and signals 101. The test checks the Signal is not reached before the release, that nothing is reported dropped, that afterRelease()the Signal reaches 101, and that a second submission readsstage[1]back exact.Tested
On NVIDIA GeForce RTX 5060, driver 621.01, Windows 11 23H2 22631.6199, MSVC 19.44, Vulkan SDK 1.4.363:
d3d12_queue_handover_test:Vulkan layer: 374 cases passed, every one exactandHost D3D12 (NVIDIA GeForce RTX 5060): 373 cases passed, every one exact, exit 0. The same withLEONIDA_VK_VALIDATION=1(no VUIDs). The host line confirms the host lets the queue go on.vulkan_backend.hchange, the new case fails on the layer:line 600: the batch waiting on the released fence was dropped.cteston this branch: no new failure. The 3 failures are the ones of Runtime: keep a released fence's semaphore until the GPU is done with it (D3D-486) #4663's base on this 23H2 host:d3d12_shader_cache(fixed on latermain),d3d12_vulkan_device(d3d12_vulkan_device_test: tell Windows 11 23H2's runtime apart by ID3D12Device11 (TEST-724 follow-up) #4667) andd3d12_typeless_rtv(d3d12_typeless_rtv_test: compare castable MSAA RTVs on hosts without relaxed format casting (WARP 22621) #4658).Case 1 of D3D-496 (a postponed CPU
Signallost in~Fence→cancel_fence_waits) is not in this PR. It builds on #4282 and will be a follow-up.No game files. AI-assisted.