vk: probe whole title-region host imports (RT-TITLE-HOST-REGION) #927
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!927
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/927/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@roanh47 on GitHub · 2026-11-24 15:13 UTC · original
pr/host-region-probe→main· +371 −0 · 2 files · 2 commits · merged 2026-11-24 20:44 UTCClaimed 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).
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 15:13 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@SweatierKey on GitHub · 2026-11-24 15:19 UTC · original · approved these changes
Independent hardware verification on NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11, Vulkan 1.4) against
origin/main@a28927849: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 code0,0Vulkan validation errors.python3 -I scripts/check_no_game_data.py: clean.Clean standalone capability probe confirming full 185 MiB
VK_EXT_external_memory_hostBDA import and bidirectional CPU↔GPU coherence on NVIDIA Blackwell.GPUs tested: NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11)
AI-assisted: yes
@Timon360SB on GitHub · 2026-11-24 15:46 UTC · original
Testing results
Tested PR #927 on two independent NVIDIA GPU configurations.
Tested commit:
e82ca07b790dac7dc083cabaabd74f3da78d619cTest environments
Test configuration
Both selected build targets compiled successfully.
CTest results
vk_host_region_importvk_sync_validationCombined result: 12/12 PASS, 0 FAIL, 0 SKIP.
Host-region import
The 185 MiB host-region import completed successfully
on both GPUs in all three repetitions.
0xc0x180xb0100000x92d0000The reported values remained consistent across all
three repetitions on each system.
No host-region import or CPU-GPU coherence failures
were observed.
Synchronization validation
The synchronization validation self-test produced
the expected results on both GPUs:
The reported
WRITE_AFTER_WRITEhazard is expectedand originates from the intentional synchronization
self-test.
Synchronization validation was confirmed to be active
in all six self-test executions.
The validation layers also emitted informational and
configuration warnings related to GPU-assisted
validation. No unexpected validation errors were
observed in the executed tests.
Limitations
Conclusion
All targeted tests passed consistently on both
hardware configurations.
The 185 MiB host-region import and CPU-GPU coherence
checks completed successfully on both the RTX 5070
and RTX 2060 SUPER.
No unexpected failures or validation errors were
observed within the tested scope.
AI-assisted log analysis and report preparation.
@roanh47 on GitHub · 2026-11-24 16:23 UTC · original
Hardened at
ed1de62abon top ofe82ca07b7(the commit the earlier reviews were on), in reply to the high-severity findings:0, i.e. report a pass. NowVK_ERROR_OUT_OF_DEVICE_MEMORY,VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_INVALID_EXTERNAL_HANDLE,VirtualAllocfailing for want of commit (ERROR_NOT_ENOUGH_MEMORY,ERROR_COMMITMENT_LIMIT,ERROR_WORKING_SET_QUOTA), and every other "unsupported" answer exit77with oneSKIP vk_host_region_import: ...line naming the reason and the size.vkGetPhysicalDeviceExternalBufferPropertiesis queried for the exact usage set andVK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXTbefore anything is allocated; a usage or handle the driver does not report as compatible/importable exits77. A driver asking forVK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BITnow getsVkMemoryDedicatedAllocateInfoinstead of a skip.VK_ERROR_DEVICE_LOSTstays exit1(and so does every other failingVkResult, a coherence mismatch, or a validation error), so the skip can no longer hide a lost device.SKIP_RETURN_CODE 77,TIMEOUT 120. Addedvk_host_region_import_validation, the same import withLEONIDA_VK_VALIDATION=1;VK_VALIDATE_SYNC=1; the binary exits77when the Khronos validation layer is not installed, so a machine without the SDK skips it rather than failing it.Re-tested on the RTX 3070 (Windows 11, driver 610.88, Vulkan SDK 1.4.363.0, MSVC 19.44):
python -I scripts/check_no_game_data.pyon both changed files is clean. Thenot-importableand dedicated-only branches are code-reviewed but not exercisable on this hardware (it reportsimport-features=0x6); the PR body lists them under "Not covered".AI-assisted (DeepSeek v4.1 Flash 1017). Tested on an NVIDIA GeForce RTX 3070, driver 610.88.
@madhyn on GitHub · 2026-11-24 17:46 UTC · original
Independently tested
ed1de62abon Arch Linux + Wine 11.22 (clang-cl 23.1.5 + xwin) with an NVIDIA GeForce RTX 3060 Ti:vk_host_region_import: Passed (5.54 s)vk_host_region_import_validation: Skipped (VK_LAYER_KHRONOS_validationnot installed in this Wine prefix).AI-assisted: yes
@QemmHD on GitHub · 2026-11-24 20:44 UTC · original
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
32a5d9698(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 plain32a5d9698too: 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).