Repository navigation
vk: probe whole title-region host imports (RT-TITLE-HOST-REGION) - #927
Conversation
Add a Windows Vulkan test that imports one committed host allocation as a BDA buffer with VK_EXT_external_memory_host and verifies CPU/GPU coherence in both directions. The default 185 MiB case passes on RTX 3070; manual runs through 14 GiB also pass.
SweatierKey
left a comment
There was a problem hiding this comment.
Independent hardware verification on NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11, Vulkan 1.4) against origin/main@a28927849:
- Built
vk_host_region_import_test.exe(clang-cl+ xwin SDK 10.0.26100) and ranvk_host_region_import_test.exe 185natively on Windows 11 + RTX 5070 Ti:Exit codedevice: NVIDIA GeForce RTX 5070 Ti subgroup sizes: 32..32 (default 32), requirable in stages 0x3fff, subgroupSizeControl on, computeFullSubgroups on host-region import: size=185 MiB result=imported alignment=64 requirements=193986560 memoryTypeBits=0xc type=2 bda=0x7090000 cpu-gpu-coherence=ok0,0Vulkan validation errors. python3 -I scripts/check_no_game_data.py: clean.
Clean standalone capability probe confirming full 185 MiB VK_EXT_external_memory_host BDA import and bidirectional CPU↔GPU coherence on NVIDIA Blackwell.
GPUs tested: NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11)
AI-assisted: yes
Testing resultsTested PR #927 on two independent NVIDIA GPU configurations. Tested commit: Test environments
Test configuration
Both selected build targets compiled successfully. CTest results
Combined result: 12/12 PASS, 0 FAIL, 0 SKIP. Host-region importThe 185 MiB host-region import completed successfully
The reported values remained consistent across all No host-region import or CPU-GPU coherence failures Synchronization validationThe synchronization validation self-test produced
The reported Synchronization validation was confirmed to be active The validation layers also emitted informational and Limitations
ConclusionAll targeted tests passed consistently on both The 185 MiB host-region import and CPU-GPU coherence No unexpected failures or validation errors were AI-assisted log analysis and report preparation. |
Every capability result now exits 77 with one SKIP line: a usage or handle type the driver reports as not importable (the Vulkan 1.1 vkGetPhysicalDeviceExternalBufferProperties query, before anything is allocated), an import or bind the driver refuses with VK_ERROR_OUT_OF_DEVICE_MEMORY, VK_ERROR_OUT_OF_HOST_MEMORY or VK_ERROR_INVALID_EXTERNAL_HANDLE, and a VirtualAlloc that fails for want of commit. VK_ERROR_DEVICE_LOST and every other VkResult stay exit 1, so a lost device or a coherence mismatch still fails the test. Before, an allocation refusal exited 0, which read as a pass. The copy whose destination the CPU compares now ends with the same transfer -> host barrier the fill path already had: without it the copy's writes are not made available to the host read. VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT is honoured with VkMemoryDedicatedAllocateInfo, so the probe follows the driver instead of skipping a device that requires it. runtime/CMakeLists.txt adds vk_host_region_import_validation, the same 185 MiB import under VK_LAYER_KHRONOS_validation and synchronization validation; the binary skips it when the layer is not installed, so a machine without the SDK does not fail it. The default case is unchanged: 185 MiB, 77 skip code, 120 s timeout.
|
Hardened at
Re-tested on the RTX 3070 (Windows 11, driver 610.88, Vulkan SDK 1.4.363.0, MSVC 19.44):
AI-assisted (DeepSeek v4.1 Flash 1017). Tested on an NVIDIA GeForce RTX 3070, driver 610.88. |
|
Independently tested
AI-assisted: yes |
Merging. **Why merged:** RT-4444-TARGET: where the device can't use a 4444 format as a colour attachment (NVIDIA), a B4G4R4A4 render target becomes an RGBA8 image. Its T#s keep the 4_4_4_4 format, and PSO RTV formats follow the image. Before this, the render target couldn't be created at all (size UINT64_MAX). sodove (5070 Ti) and SweatierKey approved. **Why it's good:** The new d3d12_b4g4r4a4_target really runs here (not skipped): "B4G4R4A4_UNORM ... using RGBA8", OK, 0 validation errors. b5g5r5a1_uav, srgb_uav and vulkan_device also pass. **Follow-up, not a blocker:** sodove measured that the RGBA8 fallback stores clears at 8-bit precision instead of quantising to 4 bits (0/1920 texels matched WARP's 4-bit result), and buffer-footprint copies from it move 4-byte texels (documented in the code). Quantising on clear and store would close that gap. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d96 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d96 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
Merging. **Why merged:** VK-UAV-CLEAR-PACK16: B5G6R5, B5G5R5A1 and B4G4R4A4 join the UAV-clear layout table, with conversion checks and an exhaustive 65,536-word round trip. Timon360SB (2060S and 5070, 60/60) and SweatierKey approved. The current head b67109e is a content-identical rebase of the reviewed one. **Why it's good:** uav_clear, short_uav_clear, b5g5r5a1_uav and replay_uav_clear_offset all pass both plain and under validation. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d96 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d96 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
|
Merging. Why merged: RT-TITLE-HOST-REGION: a test-only probe that imports a 185 MiB host region as a BDA buffer through VK_EXT_external_memory_host and checks coherence both ways. A machine that can't import exits 77 (skip). No runtime source changes. Timon360SB, madhyn (3060 Ti/Wine) and SweatierKey approved. Why it's good: vk_host_region_import and its _validation variant: "185 MiB imported ... cpu-gpu-coherence=ok", 0 validation errors. Nit for a follow-up: the _validation test sets VK_VALIDATE_SYNC=1, which nothing in the tree reads; if sync validation is the goal, the Khronos layer setting is spelled differently, so that variant probably runs core validation only. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d96 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d96 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5). |
Merging. **Why merged:** TEST-INDIRECT-RT-ARENA: d3d12_indirect_rt_test replaces a nested std::max with an initializer-list std::max to work around an MSVC 19.52 miscompile. It's 6 lines. sodove passed both revisions, and the current head is a content-identical rebase. **Why it's good:** indirect_rt and indirect_rt_upload_sysmem: PASS with 0 validation errors, and the RayQuery got hit=1 here under validation. Timon360SB's hit=0 on a 5070 with GPU-assisted validation shows up on the base too, so it isn't this PR. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d96 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d96 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
Merging. **Why merged:** RT-INPUT-SCRIPT-LENGTH: the shim's env() reader now handles values of any length (64 characters or more used to read as unset). The PR also adds the LEONIDA_INPUT_SCRIPT keyboard-pad scheduler (`button@seconds`, 300 ms presses), documented in docs/gameinput.md. That's a second topic, but the body says so, and both parts were reviewed. sodove checked 14/14 runs across lengths, with the control failing 12/12, and kawaii-shakal's harness follow-ups were addressed. **Why it's good:** gameinput_host, gameinput and the new gameinput_script pass; with validation, gameinput_script passes and logs "8 accepted / 11 rejected". The parsing is bounded (strtod with end-pointer and finiteness checks) and reads only its own env var. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d96 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d96 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
vk_host_region_import_test (#927) returns kSkip (constexpr int kSkip = 77) after its SKIP prints. The whole-test skip check compared the token itself with "77", so it reported kSkip and fails on main. A name now counts by its constexpr int value in the same source; an unknown name is still reported.
Merging. **Why merged:** main has been red on `tests/test_ctest_registration.py::test_whole_test_skips_return_the_skip_code` since #927. I merged #927, so this one's on me. It returns `kSkip` (`constexpr int kSkip = 77;`), and the checker compared the token itself with `"77"`. This PR resolves a named code through its `constexpr int` in the same source, so `return kSkip;` counts as 77. A genuinely wrong value (`kSkip = 0`) or an unknown name is still reported, and the new test covers all three cases. titoreinaldo also checked the logic against compiled fixtures on Linux. **Why it's good:** test-only, 20 lines. On Windows 11, `tests/test_ctest_registration.py` gives 1 failed / 3 passed on main and 5 passed with this PR. The repo-consistency set with it merged gives 573 passed / 5 skipped / 0 failed. There's no change to any runtime code or to what the checker rejects. I'm also adding `test_ctest_registration.py` to the checks we run before each merge, so this kind of break gets caught before it lands, not after. AI-assisted (Claude Code, Claude Opus 5.5).
Claimed in coordination issue #14 as
RT-TITLE-HOST-REGION(probe portion).What and why
The retail frame is black because the title writes vertices, descriptors and constants into memory that the Vulkan GPU-address arena does not read. The planned fix imports one committed title host region as the arena and rebases title addresses by subtraction.
This PR adds the capability gate for that path: one contiguous committed host allocation is imported as a buffer-device-addressable Vulkan buffer with
VK_EXT_external_memory_host, then checked in both directions:The default CTest case imports 185 MiB, the measured title placeholder size. A successful import must pass both coherence checks; a machine that cannot import reports a skip, not a pass and not a failure.
Exit codes
077(SKIP_RETURN_CODE)VK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE), has no commit room for the region, or there is no Vulkan 1.3 device withVK_EXT_external_memory_hostand buffer device addresses. Each skip prints oneSKIP vk_host_region_import: ...line that says which.1VK_ERROR_DEVICE_LOST, any other failingVkResult, a broken driver answer, or a validation error.Capability is checked before anything is allocated, with the Vulkan 1.1
vkGetPhysicalDeviceExternalBufferPropertiesquery for the exact usage set andVK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT.VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BITis honoured withVkMemoryDedicatedAllocateInfo, so a device that requires a dedicated allocation is probed instead of skipped.The copy whose destination the CPU compares ends with a
TRANSFER→HOSTmemory barrier, as the fill path already did.Tested
Windows 11, MSVC 19.44.35230 (14.44), NVIDIA GeForce RTX 3070, driver 610.88, Vulkan SDK 1.4.363.0.
The validation variant runs the same binary with
LEONIDA_VK_VALIDATION=1andVK_VALIDATE_SYNC=1; it exits 77 (not 1) whereVK_LAYER_KHRONOS_validationis not installed, so a machine without the SDK skips it instead of failing it.Manual run of the 185 MiB default case, exit
0, zero validation errors:The same with
LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1printsdevice: NVIDIA GeForce RTX 3070 (validation on), the same import line, and exits0with no validation errors.vk_sync_validationreports its expected hazard on this machine, so the layer and synchronization validation were active.Other sizes, same binary:
python -I scripts/check_no_game_data.py runtime/test/vk_host_region_import_test.cpp runtime/CMakeLists.txtis clean.Not covered
result=not-importablebranch is not exercised here: every device available to me reports the usage set importable. It is a three-field query (compatibleHandleTypes,externalMemoryFeatures) against the value the driver returns, and the skip it prints is identical in form to the one exercised by the allocation refusals above.VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BITpath is not exercised either: the RTX 3070 reportsimport-features=0x6(importable, protected), so no dedicated allocation was requested.No game data is included. The test needs only a Vulkan GPU with
VK_EXT_external_memory_hostand buffer device addresses.AI-assisted (DeepSeek v4.1 Flash 1017).