Repository navigation
Runtime: fences and timing on the Vulkan device (D3D-30) - #423
ItsNotRexed merged 7 commits into
Conversation
- SetEventOnMultipleFenceCompletion, ALL and ANY: a null event is one vkWaitSemaphores (WAIT_ANY_BIT for ANY); with an event, each fence's existing wait thread counts down one shared waiter, so no new threads. - Queue GetClockCalibration: vkGetCalibratedTimestampsKHR (or the EXT alias) over the DEVICE and QueryPerformanceCounter domains when the device has the extension (the standalone device now enables it); otherwise a submitted vkCmdWriteTimestamp bracketed by QPC reads. - GetAdapterLuid from VkPhysicalDeviceIDProperties::deviceLUID. - GetCustomHeapProperties per the D3D12 docs' NUMA table, matching the UMA = FALSE the device reports. d3d12_fence_timing_test covers both calibration paths, the LUID against DXGI's adapter list and the heap answers against the host runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
539c114 to
25b8b0f
Compare
|
Tested 25b8b0f on NVIDIA GeForce RTX 3070 (driver 610.88), Windows 11 (build 26300), MSVC 14.44: pass
Synthetic fixtures only; AI-assisted testing (Claude Code). |
|
Tested 25b8b0f on an NVIDIA RTX 4090 (621.24) and an AMD Radeon iGPU (2.0.353), Windows 11 (build 26300), MSVC 14.44, Vulkan SDK 1.4.363.0, clean Ninja build of
(AI-assisted test run.) |
…timing-7ce86f # Conflicts: # docs/d3d12_vulkan.md # runtime/CMakeLists.txt # runtime/shims/d3d12_com.h # runtime/shims/d3d12_vulkan_device.cpp
|
Code review at |
SetEventOnMultipleFenceCompletion narrowed its UINT count to int for the ALL countdown, so a count past INT_MAX started negative, looked done and never set the event. The waiter now counts down a std::atomic<UINT> that stops at zero, so later ANY hits do not wrap. It moves to shims/d3d12_fence_waiter.h, and the new ctest d3d12_fence_waiter checks counts past INT_MAX, ALL, and hits past zero without a GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…timing-7ce86f # Conflicts: # runtime/shims/d3d12_com.cpp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @matheuskshn, good catch:
Re-tested on the RTX 4090 (621.14): ctest 30/30. |
|
Tested ca9a76b on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with
Implicit Vulkan layers (overlays) were turned off with an empty |
…timing-7ce86f # Conflicts: # runtime/shims/d3d12_com.cpp # runtime/shims/d3d12_vulkan_device.cpp
|
Thanks @quackottu for the RTX 5070 pass. Merged main 8df277f in, now b74c7f2. The only overlap was main's new Note: |
…timing-7ce86f # Conflicts: # runtime/shims/d3d12_com.cpp # runtime/shims/d3d12_vulkan_device.cpp
|
Tested #423 at ctest: 33/33 PASS with D3D-30 (fences and timing: SetEventOnMultipleFenceCompletion, GetClockCalibration, GetAdapterLuid, GetCustomHeapProperties) checks pass on this adapter. No validation errors from this PR. AI-assisted. |
D3D-30 from #313 (claimed in #156). Four small device and queue methods that were stubs:
SetEventOnMultipleFenceCompletion(ALL and ANY). A null event blocks in onevkWaitSemaphoresover the fences' timeline semaphores (VK_SEMAPHORE_WAIT_ANY_BITfor ANY). With an event, each fence's existing wait thread counts down one shared waiter (1 for ANY, the fence count for ALL), so no thread is added.SetEventOnCompletionnow uses the same waiter. Values already reached are counted before the call returns. Bad flags, a null array or a fence from elsewhere giveE_INVALIDARG.GetClockCalibration. When the device hasVK_KHR_calibrated_timestampsorVK_EXT_calibrated_timestampswith the DEVICE and QUERY_PERFORMANCE_COUNTER domains, it is onevkGetCalibratedTimestampsKHRcall. The standalone device now enables whichever extension the GPU has, andVulkanDeviceInfo::calibrated_timestampstells the device a caller enabled it. Without the extension, the queue goes idle, then submits avkCmdWriteTimestampand answers with the midpoint of the QPC reads around it. The GPU stamp is in device ticks (1e9 / timestampPeriodper second), the units Runtime: query heaps on Vulkan: occlusion, timestamps, pipeline statistics (D3D-15) #278'sGetTimestampFrequencyuses.GetAdapterLuid: fromVkPhysicalDeviceIDProperties::deviceLUID.GetCustomHeapProperties: the D3D12 docs' table for a NUMA adapter, consistent with theUMA = FALSEthatD3D12_FEATURE_ARCHITECTUREreports.CUSTOMand unknown types get an all-zero answer, logged.docs/d3d12_vulkan.mdsections 4.1 and 4.4 describe each answer and how it was checked.This doesn't overlap #306:
VulkanQueueandvulkan_backend.hare untouched.create_command_queuegains one defaulted parameter, andVulkanDeviceInfogains one field at the end. If #306 lands first, the rebase is a one-line call-site merge.Tested
New GPU test
runtime/test/d3d12_fence_timing_test.cpp, through the Xbox-ABI proxy:GetAdapterLuid:IDXGIFactory4::EnumAdapterByLuidfinds the RTX 4090.GetCustomHeapProperties: DEFAULT, UPLOAD and READBACK are byte-identical to the host D3D12 runtime's answers.Passes with and without
LEONIDA_VK_VALIDATION=1(no validation errors).d3d12_vulkan_device_teststill passes under validation.ctest: 18/18 on currentmain. The build is clean with/W4.Tested on an NVIDIA GeForce RTX 4090, driver 621.14, Windows 11 build 26200, MSVC 19.44, Vulkan SDK 1.4.363.0. No game files involved.
AI-assisted: written with Claude Code (Claude Opus 5.5). I reviewed and ran it.
🤖 Generated with Claude Code