Repository navigation
Runtime: share reserved sparse buffers across queues and select sparse-capable families - #3652
Conversation
…rse-capable queues
0xTehuti
left a comment
There was a problem hiding this comment.
Tested 389f949b on NVIDIA GeForce RTX 2070 SUPER (TU104, Turing), driver 595.79, Windows 11 Pro x64, Vulkan 1.4.329, MSVC 19.44 (VS 2022 Community), Ninja 1.13.
1. GPU Queue & Sparse Replay Tests (PASS)
vk_queue_test.exe: PASS (exit 0). Queue family picker reported 7 layouts OK; copy -> direct and direct -> compute passed with 0 bad bytes on GCT (direct 0), T (copy 1), CT (compute 2).d3d12_sparse_queue_family_test.exe: PASS (exit 0):case=LAYER_MAP_DIRECT_COPY_COMPUTE: 0 mismatches / 65536, 0 unmapped nonzero.case=LAYER_MAP_COPY_COPY_COMPUTE: 0 mismatches / 65536, 0 unmapped nonzero.case=LAYER_MAP_COMPUTE_COPY_COMPUTE: 0 mismatches / 65536, 0 unmapped nonzero.LAYER_FINAL PASS.
- CTest
d3d12_sparse_queue_family: Passed (0.76s).
2. Defect in CTest wrapper check_sparse_queue_family.py
CTest test 76 (d3d12_sparse_queue_family_contract) fails with exit 1 on hosts without VK_LAYER_LUNARG_api_dump installed in the system layer registry:
- The docstring states: "If the API dump layer is absent the result skips (exit 77, CTest SKIP_RETURN_CODE)".
- However,
check_sparse_queue_family.pysetsenv['VK_INSTANCE_LAYERS'] = 'VK_LAYER_LUNARG_api_dump'. When this layer is absent,vkCreateInstancereturnsVK_ERROR_LAYER_NOT_PRESENTandcreate_vulkan_device_standaloneexits with code 2 (FAIL Leonida create_vulkan_device_standalone hr=0x80004005). - Because
run.returncode == 2(not 77), line 82 raisesAssertionError(f'Leonida GPU test failed exit={run.returncode}'), turning what should be a clean skip into a hard test failure in CTest. - Fix suggestion: In
check_sparse_queue_family.py, check if device initialization failed due to missing injected layer and return77so CTest properly skips when LunarG API dump is not present.
kacper-serewis
left a comment
There was a problem hiding this comment.
At 389f949 the trace checker rejects valid EXCLUSIVE common-family buffers and accepts CONCURRENT [88,99] on a synthetic device exposing families 0–2. Derive the active set and check the actual indices. Also include residencyNonResidentStrict in the queue fallback predicate at d3d12_vulkan_device.cpp:7531 to match initialization at line 4012. Otherwise sparse-disabled devices can lose dedicated queues. Seven supplied layouts and eight extra capability masks checked on CPU. AI-assisted.
|
Tested 389f949 on NVIDIA GeForce RTX 3070 (Ampere), driver 617.42, Windows 11 24H2 (26100), MSVC 19.44 RelWithDebInfo + Ninja: the GPU part passes, but the new
Why the contract test fails:
So Not checked: the CONCURRENT/EXCLUSIVE api_dump contract itself, since api_dump isn't installed here. No game files. AI-assisted (Claude). |
|
Tested
Code read of AI-assisted. |
|
Tested 389f949 (based on current
AI-assisted (Claude Code). No game files. |
|
Tested on Windows 11 (26200), NVIDIA GeForce RTX 5060 (Blackwell, 8 GB), driver 617.14, MSVC 14.44, Vulkan SDK 1.4.363.1 (with This machine has That is the checker as written. It doesn't address @kacper-serewis's point that the checker accepts out-of-range CONCURRENT indices and rejects valid EXCLUSIVE ones, since this device takes neither path.
AI-assisted check (Claude Code). |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested
( The AMD failure is not about the sparse logic. Running
With a copy of the script that does not set I did not check @kacper-serewis's two review points (the active-set check and |
D3D12 reserved sparse buffers are shared across DIRECT, COPY and COMPUTE queues. Fix VkBuffer sharingMode EXCLUSIVE without ownership transfers by applying existing concurrent sharing across active queue families; fall back to sparse-capable graphics family only when dedicated compute/copy lacks VK_QUEUE_SPARSE_BINDING_BIT. Synthetic regression: native WARP 3/3 legal mappings, RTX Vulkan layer 3/3 exact both old and new (no observed corrupt bytes or VUID); LunarG vkCreateBuffer API-dump old EXCLUSIVE count0 vs fixed CONCURRENT count3 indices 0,2,1 with deterministic exit1 baseline/exit0 fixed. Focused CTests 3/3 pass and queue picker 7 synthetic layouts pass. No full suite rerun; queue fallback is synthetic-only on hardware with missing sparse capability. Commit 389f949, based f847748, 6 files +363/-2. Ownership claimed first at #3574 (comment). Distinct from #2382 sparse images and #2951 wait-before-signal. AI assistance disclosure: original implementation and synthetic verification were AI-assisted; no proprietary game files, shaders, assets or executables included; no authentic game execution claimed.