You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
d3d12: validate objects[] and fence in MakeResident, Evict, EnqueueMakeResident - #7317
Validates objects[] entries and fence ownership in MakeResident, Evict, SetResidencyPriority, and EnqueueMakeResident in runtime/shims/d3d12_vulkan_device.cpp:
owns_child / validate_residency_objects:
Verifies objects[i] != nullptr and that every entry's GetDevice(IID_IUnknown) matches this device's canonical IUnknown identity (works both standalone and behind the Xbox-ABI DeviceProxy).
Returns E_INVALIDARG on null array, null entry, foreign-device object, or non-owned COM object (never faulting).
Also validates device ownership in SetResidencyPriority.
EnqueueMakeResident:
Validates flags (only D3D12_RESIDENCY_FLAG_NONE / D3D12_RESIDENCY_FLAG_DENY_OVERBUDGET), objects[], and (when non-null) that fence belongs to this device and implements ID3D12Fence before calling Signal(value).
Never signals the fence on any error path.
Live Windows 11 D3D12 Oracle Results (WARP & NVIDIA GeForce RTX 5090)
MakeResident / Evict with count == 0, objects == nullptr: S_OK on both WARP and RTX 5090.
MakeResident / Evict with count > 0 and null array, null entry, or dummy COM object: host faults (0xc0000005); foreign-device object (cross-adapter) faults on RTX 5090 and removes the device (DXGI_ERROR_INTERNAL_ERROR) on WARP. Layer returns E_INVALIDARG.
SetResidencyPriority with foreign-device object: E_INVALIDARG on both WARP and RTX 5090.
EnqueueMakeResident with valid count == 0, objects == nullptr + valid fence: S_OK and signals fence on both WARP and RTX 5090.
EnqueueMakeResident with invalid flags (0x2), foreign-device fence, or dummy COM fence: E_INVALIDARG and fence is not signaled on both WARP and RTX 5090.
EnqueueMakeResident with null array, null entry, or dummy COM object: host faults without signaling the fence; layer returns E_INVALIDARG without signaling the fence.
d3d12_residency: PASSED (107 values from 62 steps compared with live host D3D12, 0 mismatches + exhaustive layer validation assertions for null/foreign/dummy objects and fences; FAIL_REGULAR_EXPRESSION "Validation Error;VUID-" added in runtime/CMakeLists.txt).
d3d12_vulkan_device: all residency assertions (lines 5680-5712) passed with 0 VUIDs (pre-existing unrelated failure on RTX 5090 at line 6564 CreateReservedResource2/GetResourceTilingtiles == 1).
Independent Windows + GPU test of 3494d64d0: pass.
Setup: Windows 11 x64, MSVC 19.44.35220 (RelWithDebInfo, Windows SDK 10.0.26100.0), NVIDIA GeForce RTX 3080 (driver 32.0.16.2124 / 621.24), Vulkan SDK 1.4.363.1, no game files.
d3d12_residency_test.exe: residency: 107 values from 62 steps compared with the host (11 more not compared), 0 mismatches -> d3d12_residency_test: OK (exit 0).
Tested 3494d64d0 on Windows 11, AMD Radeon RX 7800 XT (RDNA3, driver 32.0.32029.2010), MSVC 2022 RelWithDebInfo, CMake 4.4.4, Vulkan SDK 1.4.363.0; merged alone onto main042c5f378, full ctest -j8; synthetic, no game files: pass. 255/260, no new failures; d3d12_residency passes. The 5 failures main itself has on this card (vk_queue_query_sync, d3d12_vulkan_device, d3d12_texture_tiles, d3d12_indirect_dispatch_count, d3d12_pipeline_library_host, see #166) fail the same way with and without this PR. AI-assisted (Claude Code).
Tested 3494d64d0 on AMD Radeon RX 7800 XT (RDNA3), Windows 11, MSVC 2022 RelWithDebInfo: pass. Full ctest without game files: 255/259; the 4 failures (d3d12_vulkan_device, d3d12_texture_tiles, d3d12_indirect_dispatch_count, d3d12_pipeline_library_host) fail the same way on clean main on this adapter. (AI-assisted run.)
Tested 3494d64d0 on AMD Radeon RX 9070 XT (RDNA4), AMD Windows driver 32.0.32029.2010, Windows 11 Pro build 26300: pass. Built with clang-cl 23.1.6 + lld-link against an xwin splat (MSVC 14.44, SDK 10.0.26100), RelWithDebInfo, Vulkan-Headers 1.4.369; synthetic, no game files.
d3d12_residency: passes, 107 values from 62 steps compared with the host (11 more not compared), 0 mismatches against AMD's own D3D12 driver.
Tested 3494d64d0 merged alone on main dde82f27e on AMD Radeon RX 6700 XT (RDNA2, gfx1031), AMD 26.9.1 (Vulkan 1.4.315), Windows 11 IoT Enterprise LTSC 2024 (26100), MSVC 14.51 + Ninja, RelWithDebInfo, Vulkan headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON, no game files: pass, no regressions.
The PR's tests pass: d3d12_residency
Full ctest: no test fails with this PR that doesn't also fail on main alone.
On main alone, on this GPU, the full ctest fails these: d3d12_vulkan_device, d3d12_texture_tiles and d3d12_pipeline_library_host (each has an open fix PR), d3d12_depth_resolve (from #6610, fixed by #7905), and vk_queue_query_sync, which is flaky on main here (line 468: progress_loss_ok, 5 of 10 serial runs fail; also seen in #8426).
Ran the full ctest --test-dir runtime/build -j 6 with the PR merged alone and compared the failures with main alone. AI-assisted (Claude Code).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claim: #7049 (comment)
Summary
Validates
objects[]entries andfenceownership inMakeResident,Evict,SetResidencyPriority, andEnqueueMakeResidentinruntime/shims/d3d12_vulkan_device.cpp:owns_child/validate_residency_objects:objects[i] != nullptrand that every entry'sGetDevice(IID_IUnknown)matches this device's canonicalIUnknownidentity (works both standalone and behind the Xbox-ABIDeviceProxy).E_INVALIDARGon null array, null entry, foreign-device object, or non-owned COM object (never faulting).SetResidencyPriority.EnqueueMakeResident:flags(onlyD3D12_RESIDENCY_FLAG_NONE/D3D12_RESIDENCY_FLAG_DENY_OVERBUDGET),objects[], and (when non-null) thatfencebelongs to this device and implementsID3D12Fencebefore callingSignal(value).Live Windows 11 D3D12 Oracle Results (WARP & NVIDIA GeForce RTX 5090)
MakeResident/Evictwithcount == 0, objects == nullptr:S_OKon both WARP and RTX 5090.MakeResident/Evictwithcount > 0and null array, null entry, or dummy COM object: host faults (0xc0000005); foreign-device object (cross-adapter) faults on RTX 5090 and removes the device (DXGI_ERROR_INTERNAL_ERROR) on WARP. Layer returnsE_INVALIDARG.SetResidencyPrioritywith foreign-device object:E_INVALIDARGon both WARP and RTX 5090.EnqueueMakeResidentwith validcount == 0, objects == nullptr+ valid fence:S_OKand signals fence on both WARP and RTX 5090.EnqueueMakeResidentwith invalid flags (0x2), foreign-device fence, or dummy COM fence:E_INVALIDARGand fence is not signaled on both WARP and RTX 5090.EnqueueMakeResidentwith null array, null entry, or dummy COM object: host faults without signaling the fence; layer returnsE_INVALIDARGwithout signaling the fence.Tests (NVIDIA GeForce RTX 5090,
LEONIDA_VK_VALIDATION=1, 0 VUIDs)d3d12_residency: PASSED (107 values from 62 steps compared with live host D3D12, 0 mismatches + exhaustive layer validation assertions for null/foreign/dummy objects and fences;FAIL_REGULAR_EXPRESSION "Validation Error;VUID-"added inruntime/CMakeLists.txt).d3d12_com: PASSED (0 VUIDs).xs_proxy_mock,queue_proxy,allocator_proxy: PASSED (3/3, 0 VUIDs).d3d12_vulkan_device: all residency assertions (lines 5680-5712) passed with 0 VUIDs (pre-existing unrelated failure on RTX 5090 at line 6564CreateReservedResource2/GetResourceTilingtiles == 1).AI-assisted (Gemini 4 Neon).