Skip to content

d3d12_sparse_queue_family: skip, not fail, on GPUs without three independent Vulkan queues - #4841

Open
kapitche wants to merge 1 commit into
ItsNotRexed:mainfrom
kapitche:kap-sparseq-skip
Open

kapitche wants to merge 1 commit into
ItsNotRexed:mainfrom
kapitche:kap-sparseq-skip

Conversation

@kapitche

Copy link
Copy Markdown
Contributor

What broke: on the Intel UHD 770, d3d12_sparse_queue_family failed (exit 2) while d3d12_queue_wait skipped, on the same condition. The layer gives each live D3D12 queue its own VkQueue and returns E_OUTOFMEMORY ("no independent Vulkan queue available") when none is left. The test treated that as an error in CreateCommandQueue for COPY/COMPUTE. Repro: set VK_LOADER_DRIVERS_DISABLE=*nv*, set LEONIDA_VK_DEVICE=Intel, ctest -R d3d12_sparse_queue_family.

This is a missing hardware capability, not a runtime bug: the sparse path itself works on one queue (UpdateTileMappings + copy + readback on the DIRECT queue is byte exact on the Intel). Only the cross-queue cases need three queues.

Fix: only E_OUTOFMEMORY from creating the COPY or COMPUTE queue counts as "capability absent". The test then still runs the reserved-buffer mapping on the DIRECT queue alone (LAYER_MAP_DIRECT_ONLY), and exits 77 (SKIP_RETURN_CODE is already 77 in runtime/CMakeLists.txt). Any other error still fails. The 3-queue path is unchanged.

Tested (Windows, MSVC, RelWithDebInfo, built at 98fa503):

  • Intel UHD 770 (device line printed): before, Failed; after, Skipped, with RESULT LAYER_MAP_DIRECT_ONLY PASS mapped_mismatch=0/65536 unmapped_nonzero=0/65536.
  • RTX 4080 SUPER: before and after identical, Passed, all three LAYER_MAP cases PASS, LAYER_FINAL PASS.
  • d3d12_sparse_queue_family_contract skips on both here (no api_dump layer), unchanged.

Negative control: upstream/main test file on Intel = Failed; with this change = Skipped.

AI-assisted.

…kan queues than the test needs

The layer gives each live D3D12 queue its own VkQueue and answers E_OUTOFMEMORY when none is left
(Intel UHD 770 has too few). The test threw on that and exited 2. Now only E_OUTOFMEMORY on the COPY
or COMPUTE queue is treated as a missing capability: the test still checks the byte-exact reserved-buffer
mapping on the DIRECT queue alone, then exits 77 like d3d12_queue_wait.
@gertify

gertify commented Nov 23, 2026

Copy link
Copy Markdown

Tested accfdb5 on Intel UHD 770 (driver 32.0.101.7088), Windows 11, MSVC 19.44, Vulkan SDK 1.4.357, LEONIDA_VK_VALIDATION=1: the fix works here. With this PR d3d12_sparse_queue_family exits 77 and ctest reports it Skipped ("SKIP cross-queue cases: fewer than three independent Vulkan queues", after LAYER_MAP_DIRECT_ONLY PASS mapped_mismatch=0/65536); on the merge base 98fa503 the same test fails on this GPU. d3d12_sparse_queue_family_contract fails with exit 3221225477 (0xC0000005) both with this PR and on 98fa503, so that crash is not from this change. AI-assisted.

@ray3242

ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Positive control on a GPU that does have three independent queue families — the new skip path must not make this test silently disappear. Head accfdb52, based on current main 98fa503f, built as-is.

Environment (AI-assisted, OpenCode): Windows 11 Pro 26300, MSVC 19.44.35230, CMake 4.4.4 + Ninja, RelWithDebInfo. GPU: NVIDIA GeForce GTX 1060 6GB, driver 582.78, subgroup sizes 32..32, no Resizable BAR. No game data, keys or decryption.

Result: d3d12_sparse_queue_family_test.exe -> exit 0, the test ran rather than skipped:

case=LAYER_MAP_DIRECT_COPY_COMPUTE reserved_tiles=2 mapping_queue=0   PASS 0/65536 mismatch
case=LAYER_MAP_COPY_COPY_COMPUTE    reserved_tiles=2 mapping_queue=3   PASS 0/65536 mismatch
case=LAYER_MAP_COMPUTE_COPY_COMPUTE reserved_tiles=2 mapping_queue=2   PASS 0/65536 mismatch
DEVICE_REMOVED_HRESULT=0x00000000
LAYER_FINAL PASS

All three mapping cases used distinct direct/copy/compute queues and passed with zero mismatched or nonzero-unmapped tiles.

ctest -R d3d12_sparse_queue_family --output-on-failure: 1 passed, 1 skipped (d3d12_sparse_queue_family_contract), 100% — the contract variant skips here because the Khronos/api_dump layers are not installed on this box (the same environment limitation noted on #4756), not because of the PR.

So on a 3-family GPU the new early-skip logic leaves behaviour unchanged. Depends on: none; verification only.

@Parakeet-Wheat

Copy link
Copy Markdown
Contributor

Tested accfdb5 (on its base main 98fa503f) on an RTX 3070 (610.88, Windows 11 26300, MSVC VS 2022, Vulkan SDK 1.4.363 layers), with the validation layer: pass. Full ctest is 174/174. On this GPU the layer gets dedicated COPY and COMPUTE queues, so d3d12_sparse_queue_family_test takes the unchanged 3-queue path: all three LAYER_MAP_* cases PASS (mapped_mismatch=0/65536), LAYER_FINAL PASS, exit 0, 0 validation errors. The build warnings (C4456 / C4996 in d3d12_vulkan_device_test.cpp and the xgameruntime tests) are all in files this PR doesn't touch.

To reach the new path on NVIDIA, I made a temporary local change to d3d12_vulkan_device.cpp, not pushed: one VkQueue in the graphics family (std::min(1u, ...)) and no dedicated compute or copy family. That is the UHD 770 situation: the COPY queue gets no independent Vulkan queue available / E_OUTOFMEMORY.

Test file Layer Result
this PR one queue exit 77, SINGLE_QUEUE, RESULT LAYER_MAP_DIRECT_ONLY PASS mapped_mismatch=0/65536 unmapped_nonzero=0/65536, ctest Skipped, 0 validation errors
main (control) one queue exit 2, FAIL CreateCommandQueue hr=0x8007000e, ctest Failed; the failure reported in the description
this PR unchanged 3-queue path as above, Passed

E_OUTOFMEMORY from CreateCommandQueue comes only from that slot-exhaustion branch; create_command_queue returns E_FAIL when it fails. So the new skip can't hide a real queue-creation failure. Any other error still fails, as the description says.

AI-assisted (Claude Code).

@scp682 scp682 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested d3d12_sparse_queue_family before and after this change (de671352 → accfdb52) on Windows 11 24H2 (26100.3476), MSVC 19.44.35227, RelWithDebInfo. Both builds used the same runtime and toolchain. I explicitly selected each Vulkan device.

GPU / driver Base de671352 PR accfdb52
Intel Graphics (Core Ultra 9 275HX, 8086:7d67) / 101.8132 Failed, exit 2 (CreateCommandQueue returned 0x8007000e) CTest Skipped, executable exit 77. LAYER_MAP_DIRECT_ONLY passed with mapped_mismatch=0/65536 and unmapped_nonzero=0/65536.
NVIDIA RTX 5070 Ti Laptop / 596.36 Passed, exit 0 Passed, exit 0. All three DIRECT/COPY/COMPUTE mapping cases had zero mismatches and zero nonzero unmapped bytes in both builds.

The API dump contract test skipped in all four runs because the required Vulkan SDK layers were unavailable. I used the repository's synthetic fixtures. AI-assisted test execution and reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants