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

Parakeet-Wheat commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested accfdb5 (on its base main de671352) 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.

@memorypressure

Copy link
Copy Markdown

Verified against main 3faac55: merges cleanly. A C++/D3D12 change this host cannot compile or run, but the skip protocol checks out statically (verified in the diff and CMakeLists): exit 77 matches the existing SKIP_RETURN_CODE convention for the test and its contract leg, the contract checker skips rather than fails on child exit 77 so the single-queue path cannot spuriously fail it, and three-queue machines take exactly the old code path. Real failures still surface since ok() throws on anything but E_OUTOFMEMORY. The Intel UHD 770 E_OUTOFMEMORY behaviour needs a hardware confirmation. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only review).

@Roberto0953

Copy link
Copy Markdown
Contributor

Independent check of this PR on a second Intel UHD 770 machine (AI-assisted; commands run locally, nothing from the game involved).

Tested: accfdb52 (this PR's head), target d3d12_sparse_queue_family_test only, MSVC 2022 BuildTools, RelWithDebInfo, Windows 11. Same machine, two GPUs, selected with VK_LOADER_DRIVERS_SELECT.

Device Before (main 3faac557) With this PR
Intel UHD 770 (*igvk*, driver 101.7088) exit 2: [rt] d3d12: no independent Vulkan queue available, FAIL CreateCommandQueue hr=0x8007000e exit 77: SINGLE_QUEUE: ... checking the DIRECT queue alone, RESULT LAYER_MAP_DIRECT_ONLY PASS mapped_mismatch=0/65536 unmapped_nonzero=0/65536, SKIP cross-queue cases: fewer than three independent Vulkan queues
NVIDIA RTX 3080 (*nv-vk64*) pass exit 0: all cross-queue cases pass (LAYER_MAP_COPY_COPY_COMPUTE, LAYER_MAP_COMPUTE_COPY_COMPUTE ..., LAYER_FINAL PASS, DEVICE_REMOVED_HRESULT=0x00000000)
no Vulkan driver (VK_DRIVER_FILES and VK_ICD_FILENAMES pointing at a file that does not exist) exit 2 still exit 2: [rt] d3d12: vkCreateInstance (Vulkan 1.3) failed, FAIL Leonida create_vulkan_device_standalone hr=0x80004005

So the PR does what it says on the UHD 770, and the direct-queue case it adds is byte exact there too.

One thing it does not cover, in case it is wanted here rather than in a follow-up: with no Vulkan device at all the test still fails where the other GPU tests of the same ctest run skip. In a full ctest of 3faac557 with no driver visible it was the only failure (91 passed, 70 skipped, 1 failed). The fatal is create_vulkan_device_standalone at runtime/test/d3d12_sparse_queue_family_test.cpp:160.

Commands:

cmake --build <build> --target d3d12_sparse_queue_family_test
set VK_LOADER_DRIVERS_SELECT=*igvk*   & d3d12_sparse_queue_family_test.exe & echo %errorlevel%
set VK_LOADER_DRIVERS_SELECT=*nv-vk64* & d3d12_sparse_queue_family_test.exe & echo %errorlevel%

@itsonlysimbo

Copy link
Copy Markdown
Contributor

Tested accfdb52 merged onto main af70fc78 (2 behind; merges cleanly) on RTX 4070, NVIDIA 621.14, Windows 11 (10.0.26300), MSVC 19.44, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363: pass.

  • d3d12_sparse_queue_family and d3d12_sparse_queue_family_contract pass. This card has the queues, so the run takes the test path, not the new skip; it shows the change does not turn a pass into a skip.
  • ctest: 167 passed, 9 skipped, 0 failed; run_gpu_tests.py: 170/217 passed, 47 skipped, 0 failed, same as main af70fc78.

AI-assisted (Claude Code).

@luisbaker

Copy link
Copy Markdown
Contributor

Tested accfdb52 merged with main 3faac557 on Intel(R) Graphics (Intel iGPU), driver 32.0.101.6737 (Vulkan 1.4.309), Windows 11 Pro 26340, MSVC 2022, Vulkan SDK 1.4.363: pass.

  • Full ctest -j 4: d3d12_sparse_queue_family now skips instead of failing. On main alone it fails with FAIL CreateCommandQueue hr=0x8007000e on this GPU.
  • No regression: the other 5 failures are the same as on main here.
  • d3d12_sparse_queue_family_contract still fails, with the test executable crashing (exit=3221225477, 0xC0000005), as on main. That one is TEST-1089 / check_sparse_queue_family: run api_dump and validation apart (TEST-1089) #4900, not this PR.

AI-assisted.

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.

9 participants