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 both tests at e96ad918a on Windows 11, RTX 5070 Ti:
d3d12_fence_timing_test-> exit 0: the new D3D-496 case 1 (a fence released after a postponed CPU Signal), plus held CPU signals, calibration and LUID checks.d3d12_queue_handover_test-> exit 0:fence released while a batch waits: the batch ran and its Signal was reached; layer 374 / host 373 exact.
Stacking note: the branch contains #4663 (0cc958d0f, D3D-486 semaphore retirement) and #4740 (d7e534067, D3D-496 case 2) under its case-1 commit, so it merges cleanly with those two by construction and would land them too. It conflicts with #4681 (vulkan_backend.h), #4557 (vulkan_backend.h, handover test), #4570 (queue_holds.h) and #4577 (docs, d3d12_com.cpp, fence timing test). If this is the intended combined branch, the three component PRs should be closed in its favor; otherwise it needs a rebase onto #4663/#4740 and a note of what is carried. git diff --check clean.
|
Tested I built Queue B completes 200/200 iterations on each Vulkan adapter. The native D3D12 reference also completes 200/200 in each run. The queue handover test passes all 374 layer cases on each adapter. Its native D3D12 reference uses the RTX 4090 and passes all 373 cases. For a negative control, I reversed only the NVIDIA driver 32.0.16.2101. AMD driver 32.0.21043.5001. AI-assisted. |
|
Tested Stacking: confirmed as declared —
No blocking issue. AI-assisted. |
|
Verified commit
Non-blocking review note: when combining with AI-assisted (Gemini, Antigravity). |
…l (D3D-496 case 1) check_released_postponed_signal runs @Exopus-0x65f7ad0's scenario 200 times on a fresh fence each time: queue A Wait(gate, i) + Signal(F, 1), CPU F->Signal(2) (held behind A's Signal), queue B Wait(F, 2) + Signal(done, i), then F->Release(). Even iterations release F before opening the gate, so the GPU cannot have reached 1 and the postponed Signal is lost; odd ones release it 0-1.9 ms after. B's batch must run every time, as on the host runtime, which the test also runs as the reference. With ItsNotRexed#4663 + ItsNotRexed#4282 alone the layer drops B's batch on every early release (100/200 here). With D3D-496 case 2 (a released fence's wait counts as reached) it runs 200/200, on the host too.
e96ad91 to
c905eb0
Compare
|
Tested c905eb0 merged with main 98fa503 on Windows (MSVC 14.51, RelWithDebInfo, Ninja): pass (build only; GPU runs skipped)
|
|
Tested c905eb0 (the current head; the GPU runs above are on Built with
The skips are the tests that need game files or an optional component. The build has one compiler warning, C4456 in |
|
Independent check for D3D-496 (I posted the original finding). RTX 5060 Ti / 621.14, Windows 11 (26300), MSVC 14.51, Vulkan SDK 1.4.363.0, RelWithDebInfo:
This now matches the host D3D12 runtime (50/50 in both orders, debug layer silent), and it no longer needs #4282 for this case. Thanks @0klavair. AI-assisted (Claude Code). No game files. |
|
Independent Pascal verification of PR head Environment (AI-assisted, OpenCode): Windows 11 Pro build 26300, MSVC 19.44.35207 (cl 19.44.35230), CMake 4.4.4 + Ninja, RelWithDebInfo, Vulkan headers fetched by CMake. GPU: NVIDIA GeForce GTX 1060 6GB, driver 582.78, Vulkan subgroup sizes 32..32 (default 32), Build: Results:
Not run (environment limitation, not a PR defect): with
|
D3D-496, case 1. Claimed in the coordination issue as: #4683 (comment) (from @Exopus-0x65f7ad0's finding and repro)
Depends on: #4740 (D3D-496 case 2, itself on #4663). Only the last commit is this PR's. (It no longer depends on #4282: the case passes 200/200 on #4663 + #4740 alone, 3 runs out of 3.)
What and why
Case 1: queue A
Wait(gate)+Signal(F, 1), CPUF->Signal(2)(postponed behind A's Signal), queue BWait(F, 2)+Signal(done), thenF->Release(). If the release comes before the GPU reaches 1,~Fence→cancel_fence_waitsruns the postponed callback withnow < queued, the CPU Signal is lost, andremove_fencedrops B's held batch. The host ran B every time (50/50 in the finding). With #4663 + #4282, 16-24 of 200 were still dropped.No new runtime change is needed: #4740 makes a released fence's wait count as reached, so B runs whether or not the postponed Signal landed. That is what the host does. This PR adds the regression test, so the case stays covered.
The change (test only)
check_released_postponed_signalind3d12_fence_timing_test: the scenario above, 200 iterations, a fresh fence each time.Tested
On NVIDIA GeForce RTX 5060, driver 621.01, Windows 11 23H2 22631.6199, MSVC 19.44, Vulkan SDK 1.4.363:
fence released after a postponed CPU Signal (Vulkan layer): B's batch ran 200/200and(host runtime): 200/200, exit 0. The same withLEONIDA_VK_VALIDATION=1(no VUIDs).vulkan_backend.hfrom0cc958d0):B's batch ran 100/200withthat work is dropped, exit 1. Every early release is lost.No game files. AI-assisted.