vk: probe whole title-region host imports (RT-TITLE-HOST-REGION) #927

Manually merged
github merged 2 commits from gh-pr/927/head into gh-pr/927/base 2026-11-26 09:28:43 +00:00
Owner

@⁠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 UTC

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:

  • CPU writes are read by the GPU through a buffer copy;
  • GPU fills are visible to the CPU.

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

Code Meaning
0 The region imported and both directions matched.
77 (SKIP_RETURN_CODE) This machine cannot import: the driver reports the usage or the handle type as not importable, refuses the host pointer or the import (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 with VK_EXT_external_memory_host and buffer device addresses. Each skip prints one SKIP vk_host_region_import: ... line that says which.
1 The probe contradicts itself: a coherence mismatch, VK_ERROR_DEVICE_LOST, any other failing VkResult, a broken driver answer, or a validation error.

Capability is checked before anything is allocated, with the Vulkan 1.1 vkGetPhysicalDeviceExternalBufferProperties query for the exact usage set and VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT. VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT is honoured with VkMemoryDedicatedAllocateInfo, so a device that requires a dedicated allocation is probed instead of skipped.

The copy whose destination the CPU compares ends with a TRANSFER → HOST memory 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.

ctest -R "^vk_host_region_import" --output-on-failure
1/2 Test #147: vk_host_region_import ..............   Passed    0.21 sec
2/2 Test #148: vk_host_region_import_validation ...   Passed    0.24 sec
100% tests passed out of 2

The validation variant runs the same binary with LEONIDA_VK_VALIDATION=1 and VK_VALIDATE_SYNC=1; it exits 77 (not 1) where VK_LAYER_KHRONOS_validation is 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:

device: NVIDIA GeForce RTX 3070
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=0x18 type=3 dedicated=no bda=0x6ff0000 handleTypes=0x80 import-features=0x6 cpu-gpu-coherence=ok

The same with LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1 prints device: NVIDIA GeForce RTX 3070 (validation on), the same import line, and exits 0 with no validation errors. vk_sync_validation reports its expected hazard on this machine, so the layer and synchronization validation were active.

Other sizes, same binary:

4096 MiB    imported, cpu-gpu-coherence=ok                       exit 0
65536 MiB   SKIP ... result=import-refused vkResult=-2           exit 77
65536 MiB   SKIP ... result=host-allocation-refused win32=1455   exit 77
0 MiB       host-region import: invalid region size              exit 1

python -I scripts/check_no_game_data.py runtime/test/vk_host_region_import_test.cpp runtime/CMakeLists.txt is clean.

Not covered

  • The result=not-importable branch 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.
  • The VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT path is not exercised either: the RTX 3070 reports import-features=0x6 (importable, protected), so no dedicated allocation was requested.
  • Synchronization validation tracks device accesses only, so the missing host barrier of the previous revision could not have been reported by it; the barrier is added because the Vulkan memory model requires it for the CPU read that follows.
  • Only the 185 MiB region runs in CTest; larger sizes are a manual check.

No game data is included. The test needs only a Vulkan GPU with VK_EXT_external_memory_host and buffer device addresses.

AI-assisted (DeepSeek v4.1 Flash 1017).

**@⁠roanh47** on GitHub · 2026-11-24 15:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927) `pr/host-region-probe` → `main` · +371 −0 · 2 files · 2 commits · merged 2026-11-24 20:44 UTC 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: - CPU writes are read by the GPU through a buffer copy; - GPU fills are visible to the CPU. 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 | Code | Meaning | |---|---| | `0` | The region imported and both directions matched. | | `77` (`SKIP_RETURN_CODE`) | This machine cannot import: the driver reports the usage or the handle type as not importable, refuses the host pointer or the import (`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 with `VK_EXT_external_memory_host` and buffer device addresses. Each skip prints one `SKIP vk_host_region_import: ...` line that says which. | | `1` | The probe contradicts itself: a coherence mismatch, `VK_ERROR_DEVICE_LOST`, any other failing `VkResult`, a broken driver answer, or a validation error. | Capability is checked before anything is allocated, with the Vulkan 1.1 `vkGetPhysicalDeviceExternalBufferProperties` query for the exact usage set and `VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT`. `VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT` is honoured with `VkMemoryDedicatedAllocateInfo`, so a device that requires a dedicated allocation is probed instead of skipped. The copy whose destination the CPU compares ends with a `TRANSFER` → `HOST` memory 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. ```text ctest -R "^vk_host_region_import" --output-on-failure 1/2 Test #147: vk_host_region_import .............. Passed 0.21 sec 2/2 Test #148: vk_host_region_import_validation ... Passed 0.24 sec 100% tests passed out of 2 ``` The validation variant runs the same binary with `LEONIDA_VK_VALIDATION=1` and `VK_VALIDATE_SYNC=1`; it exits 77 (not 1) where `VK_LAYER_KHRONOS_validation` is 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: ```text device: NVIDIA GeForce RTX 3070 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=0x18 type=3 dedicated=no bda=0x6ff0000 handleTypes=0x80 import-features=0x6 cpu-gpu-coherence=ok ``` The same with `LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1` prints `device: NVIDIA GeForce RTX 3070 (validation on)`, the same import line, and exits `0` with no validation errors. `vk_sync_validation` reports its expected hazard on this machine, so the layer and synchronization validation were active. Other sizes, same binary: ```text 4096 MiB imported, cpu-gpu-coherence=ok exit 0 65536 MiB SKIP ... result=import-refused vkResult=-2 exit 77 65536 MiB SKIP ... result=host-allocation-refused win32=1455 exit 77 0 MiB host-region import: invalid region size exit 1 ``` `python -I scripts/check_no_game_data.py runtime/test/vk_host_region_import_test.cpp runtime/CMakeLists.txt` is clean. ### Not covered - The `result=not-importable` branch 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. - The `VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT` path is not exercised either: the RTX 3070 reports `import-features=0x6` (importable, protected), so no dedicated allocation was requested. - Synchronization validation tracks device accesses only, so the missing host barrier of the previous revision could not have been reported by it; the barrier is added because the Vulkan memory model requires it for the CPU read that follows. - Only the 185 MiB region runs in CTest; larger sizes are a manual check. No game data is included. The test needs only a Vulkan GPU with `VK_EXT_external_memory_host` and buffer device addresses. AI-assisted (DeepSeek v4.1 Flash 1017).
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.
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:28:41 +00:00
github manually merged commit ed1de62abb into gh-pr/927/base 2026-11-26 09:28:43 +00:00
Author
Owner

@⁠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.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-24 15:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927#pullrequestreview-6041934483) · **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.
Author
Owner

@⁠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:

  • Built vk_host_region_import_test.exe (clang-cl + xwin SDK 10.0.26100) and ran vk_host_region_import_test.exe 185 natively on Windows 11 + RTX 5070 Ti:
    device: 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=ok
    
    Exit code 0, 0 Vulkan 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

**@⁠SweatierKey** on GitHub · 2026-11-24 15:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927#pullrequestreview-6042042701) · **approved these changes** 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 ran `vk_host_region_import_test.exe 185` natively on Windows 11 + RTX 5070 Ti: ``` device: 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=ok ``` Exit code `0`, `0` Vulkan 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
Author
Owner

@⁠Timon360SB on GitHub · 2026-11-24 15:46 UTC · original

Testing results

Tested PR #927 on two independent NVIDIA GPU configurations.

Tested commit: e82ca07b790dac7dc083cabaabd74f3da78d619c

Test environments

Component System 1 System 2
CPU AMD Ryzen 7 7800X3D AMD Ryzen 5 3600X
GPU NVIDIA GeForce RTX 5070 NVIDIA GeForce RTX 2060 SUPER
VRAM 12 GB 8 GB
RAM 32 GB 16 GB
GPU driver 621.14 621.14
OS Windows 11 Pro (26200) Windows 11 Pro (28000)
Vulkan SDK 1.4.363.0 1.4.363.0

Test configuration

  • Build configuration: RelWithDebInfo
  • Build generator: Ninja Multi-Config
  • Vulkan validation: enabled
  • GPU-assisted validation: enabled
  • Synchronization validation: enabled
  • Repetitions: 3 per system

Both selected build targets compiled successfully.

CTest results

Test RTX 5070 RTX 2060 SUPER
vk_host_region_import 3/3 PASS 3/3 PASS
vk_sync_validation 3/3 PASS 3/3 PASS
Total 6/6 PASS 6/6 PASS

Combined 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.

Property RTX 5070 RTX 2060 SUPER
Region size 185 MiB 185 MiB
Import result imported imported
Alignment 64 bytes 64 bytes
Memory requirements 193986560 bytes 193986560 bytes
Memory type bits 0xc 0x18
Selected memory type 2 3
Buffer device address 0xb010000 0x92d0000
CPU-GPU coherence OK OK

The 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:

Scenario RTX 5070 RTX 2060 SUPER
Without a barrier 1 validation error 1 validation error
With a barrier 0 validation errors 0 validation errors

The reported WRITE_AFTER_WRITE hazard is expected
and 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

  • HEAD-only testing; no baseline comparison.
  • Synthetic test fixtures only.
  • No real-title execution was performed.
  • Testing was limited to the 185 MiB import size.
  • Only NVIDIA hardware was tested.
  • This was not a performance benchmark.

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.

**@⁠Timon360SB** on GitHub · 2026-11-24 15:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927#issuecomment-7136595571) ## Testing results Tested PR #927 on two independent NVIDIA GPU configurations. **Tested commit:** `e82ca07b790dac7dc083cabaabd74f3da78d619c` ### Test environments | Component | System 1 | System 2 | |---|---|---| | CPU | AMD Ryzen 7 7800X3D | AMD Ryzen 5 3600X | | GPU | NVIDIA GeForce RTX 5070 | NVIDIA GeForce RTX 2060 SUPER | | VRAM | 12 GB | 8 GB | | RAM | 32 GB | 16 GB | | GPU driver | 621.14 | 621.14 | | OS | Windows 11 Pro (26200) | Windows 11 Pro (28000) | | Vulkan SDK | 1.4.363.0 | 1.4.363.0 | ### Test configuration - Build configuration: RelWithDebInfo - Build generator: Ninja Multi-Config - Vulkan validation: enabled - GPU-assisted validation: enabled - Synchronization validation: enabled - Repetitions: 3 per system Both selected build targets compiled successfully. ### CTest results | Test | RTX 5070 | RTX 2060 SUPER | |---|---:|---:| | `vk_host_region_import` | 3/3 PASS | 3/3 PASS | | `vk_sync_validation` | 3/3 PASS | 3/3 PASS | | **Total** | **6/6 PASS** | **6/6 PASS** | **Combined 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. | Property | RTX 5070 | RTX 2060 SUPER | |---|---|---| | Region size | 185 MiB | 185 MiB | | Import result | imported | imported | | Alignment | 64 bytes | 64 bytes | | Memory requirements | 193986560 bytes | 193986560 bytes | | Memory type bits | `0xc` | `0x18` | | Selected memory type | 2 | 3 | | Buffer device address | `0xb010000` | `0x92d0000` | | CPU-GPU coherence | OK | OK | The 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: | Scenario | RTX 5070 | RTX 2060 SUPER | |---|---:|---:| | Without a barrier | 1 validation error | 1 validation error | | With a barrier | 0 validation errors | 0 validation errors | The reported `WRITE_AFTER_WRITE` hazard is expected and 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 - HEAD-only testing; no baseline comparison. - Synthetic test fixtures only. - No real-title execution was performed. - Testing was limited to the 185 MiB import size. - Only NVIDIA hardware was tested. - This was not a performance benchmark. ### 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.
Author
Owner

@⁠roanh47 on GitHub · 2026-11-24 16:23 UTC · original

Hardened at ed1de62ab on top of e82ca07b7 (the commit the earlier reviews were on), in reply to the high-severity findings:

  1. Skip, not pass, on a machine that cannot import. A refused allocation used to exit 0, i.e. report a pass. Now VK_ERROR_OUT_OF_DEVICE_MEMORY, VK_ERROR_OUT_OF_HOST_MEMORY, VK_ERROR_INVALID_EXTERNAL_HANDLE, VirtualAlloc failing for want of commit (ERROR_NOT_ENOUGH_MEMORY, ERROR_COMMITMENT_LIMIT, ERROR_WORKING_SET_QUOTA), and every other "unsupported" answer exit 77 with one SKIP vk_host_region_import: ... line naming the reason and the size.
  2. Transfer → host barrier after the copy whose destination the CPU compares, as the fill path already had.
  3. vkGetPhysicalDeviceExternalBufferProperties is queried for the exact usage set and VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT before anything is allocated; a usage or handle the driver does not report as compatible/importable exits 77. A driver asking for VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT now gets VkMemoryDedicatedAllocateInfo instead of a skip.
  4. VK_ERROR_DEVICE_LOST stays exit 1 (and so does every other failing VkResult, a coherence mismatch, or a validation error), so the skip can no longer hide a lost device.
  5. The default case is unchanged: 185 MiB, SKIP_RETURN_CODE 77, TIMEOUT 120. Added vk_host_region_import_validation, the same import with LEONIDA_VK_VALIDATION=1;VK_VALIDATE_SYNC=1; the binary exits 77 when 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):

ctest -R "^vk_host_region_import" --output-on-failure
1/2 Test #147: vk_host_region_import ..............   Passed    0.21 sec
2/2 Test #148: vk_host_region_import_validation ...   Passed    0.24 sec
100% tests passed out of 2

LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1 vk_host_region_import_test.exe 185
device: NVIDIA GeForce RTX 3070 (validation on)
host-region import: size=185 MiB result=imported alignment=64 requirements=193986560 memoryTypeBits=0x18 type=3 dedicated=no bda=0x6ff0000 handleTypes=0x80 import-features=0x6 cpu-gpu-coherence=ok
exit 0, zero validation errors

vk_host_region_import_test.exe 65536
SKIP vk_host_region_import: size=65536 MiB result=import-refused vkResult=-2 alignment=64 requirements=68719476736 memoryTypeBits=0x18 type=3 dedicated=no
exit 77

python -I scripts/check_no_game_data.py on both changed files is clean. The not-importable and dedicated-only branches are code-reviewed but not exercisable on this hardware (it reports import-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.

**@⁠roanh47** on GitHub · 2026-11-24 16:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927#issuecomment-7137594132) Hardened at `ed1de62ab` on top of `e82ca07b7` (the commit the earlier reviews were on), in reply to the high-severity findings: 1. **Skip, not pass, on a machine that cannot import.** A refused allocation used to exit `0`, i.e. report a pass. Now `VK_ERROR_OUT_OF_DEVICE_MEMORY`, `VK_ERROR_OUT_OF_HOST_MEMORY`, `VK_ERROR_INVALID_EXTERNAL_HANDLE`, `VirtualAlloc` failing for want of commit (`ERROR_NOT_ENOUGH_MEMORY`, `ERROR_COMMITMENT_LIMIT`, `ERROR_WORKING_SET_QUOTA`), and every other "unsupported" answer exit `77` with one `SKIP vk_host_region_import: ...` line naming the reason and the size. 2. **Transfer → host barrier after the copy** whose destination the CPU compares, as the fill path already had. 3. **`vkGetPhysicalDeviceExternalBufferProperties`** is queried for the exact usage set and `VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT` before anything is allocated; a usage or handle the driver does not report as compatible/importable exits `77`. A driver asking for `VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT` now gets `VkMemoryDedicatedAllocateInfo` instead of a skip. 4. **`VK_ERROR_DEVICE_LOST` stays exit `1`** (and so does every other failing `VkResult`, a coherence mismatch, or a validation error), so the skip can no longer hide a lost device. 5. The default case is unchanged: 185 MiB, `SKIP_RETURN_CODE 77`, `TIMEOUT 120`. Added `vk_host_region_import_validation`, the same import with `LEONIDA_VK_VALIDATION=1;VK_VALIDATE_SYNC=1`; the binary exits `77` when 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): ```text ctest -R "^vk_host_region_import" --output-on-failure 1/2 Test #147: vk_host_region_import .............. Passed 0.21 sec 2/2 Test #148: vk_host_region_import_validation ... Passed 0.24 sec 100% tests passed out of 2 LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1 vk_host_region_import_test.exe 185 device: NVIDIA GeForce RTX 3070 (validation on) host-region import: size=185 MiB result=imported alignment=64 requirements=193986560 memoryTypeBits=0x18 type=3 dedicated=no bda=0x6ff0000 handleTypes=0x80 import-features=0x6 cpu-gpu-coherence=ok exit 0, zero validation errors vk_host_region_import_test.exe 65536 SKIP vk_host_region_import: size=65536 MiB result=import-refused vkResult=-2 alignment=64 requirements=68719476736 memoryTypeBits=0x18 type=3 dedicated=no exit 77 ``` `python -I scripts/check_no_game_data.py` on both changed files is clean. The `not-importable` and dedicated-only branches are code-reviewed but not exercisable on this hardware (it reports `import-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.
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 17:46 UTC · original

Independently tested ed1de62ab on 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)
    device: NVIDIA GeForce RTX 3060 Ti (GA104, Low Hash Rate)
    host-region import: size=185 MiB result=imported alignment=64 requirements=193986560 memoryTypeBits=0x18 type=3 dedicated=no bda=0x4f30000 handleTypes=0x80 import-features=0x6 cpu-gpu-coherence=ok
    
  • vk_host_region_import_validation: Skipped (VK_LAYER_KHRONOS_validation not installed in this Wine prefix).

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 17:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927#issuecomment-7139692018) Independently tested `ed1de62ab` on 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) ``` device: NVIDIA GeForce RTX 3060 Ti (GA104, Low Hash Rate) host-region import: size=185 MiB result=imported alignment=64 requirements=193986560 memoryTypeBits=0x18 type=3 dedicated=no bda=0x4f30000 handleTypes=0x80 import-features=0x6 cpu-gpu-coherence=ok ``` - `vk_host_region_import_validation`: **Skipped** (`VK_LAYER_KHRONOS_validation` not installed in this Wine prefix). AI-assisted: yes
Author
Owner

@⁠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 plain 32a5d9698 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).

**@⁠QemmHD** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/927#issuecomment-7143990065) 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 plain 32a5d9698 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).
This discussion has been locked. Commenting is limited to contributors.
No description provided.