mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:20:53 +01:00
[PR #1273] runtime: track title host memory regions and import into Vulkan (RT-TITLE-HOST-REGION) #1307
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1307
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1273
Author: @madhyn
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:exp/title-host-region📝 Commits (3)
71fed4aruntime: add RT-TITLE-HOST-REGION host memory import and VA lookupceed3d3d3d12: translate TitleHostRegions VAs in CBV/SRV/UAV descriptors31c072atitle_host_regions: retire before host free, multi-block VirtualQuery, and failure tracking📊 Changes
8 files changed (+1282 additions, -28 deletions)
View changed files
📝
runtime/CMakeLists.txt(+9 -1)📝
runtime/shims/d3d12_vulkan_device.cpp(+18 -5)📝
runtime/shims/xmem.cpp(+46 -7)➕
runtime/src/title_host_regions.h(+266 -0)📝
runtime/src/vulkan_backend.h(+49 -15)➕
runtime/src/vulkan_title_regions.h(+434 -0)➕
runtime/test/title_host_region_gpu_test.cpp(+227 -0)➕
runtime/test/title_host_regions_test.cpp(+233 -0)📄 Description
Follow-up to #927 (which added the
vk_host_region_import_testprobe) for RT-TITLE-HOST-REGION on #14.Summary
runtime/src/title_host_regions.h: Thread-safe (std::mutex) non-overlapping interval table (leonida::TitleHostRegions) mapping[host_va, host_va + size)to{gpu_bda, tag, handle}withO(\log N)find(),resolve_bda(), partial-unmap splitting inunregister_range(),pending_imports(),mark_imported(),take_retired(), and process-widetitle_host_regions().runtime/src/vulkan_title_regions.h: LazyVK_EXT_external_memory_hostimporter (leonida::VulkanTitleRegions) creatingVkBuffers withVK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,VirtualQuerycommitted-page validation on Windows,HOST_WRITE -> SHADER_READbarrier (record_host_write_barrier()), andvkDeviceWaitIdlecleanup of retired regions (collect_retired()).VK_ERROR_OUT_OF_HOST_MEMORYon 16 GB hosts.runtime/src/vulkan_backend.h,runtime/shims/d3d12_vulkan_device.cpp,runtime/shims/xmem.cpp:TitleVirtualAlloc,TitleVirtualFree(added toSHIM_TABLE(title_memory)),XMemVirtualAlloc(MEM_COMMIT),map_page, andunmap_page.VulkanContext::title_regions_whenhost_pointer_alignment != 0, syncs pending imports and emits the host-write barrier at command-buffer start, and falls back totitle_regions_.lookup(...)inreplay_.buffer_atandreplay_.host_at.runtime/test/title_host_regions_test.cpp: interval table, partial unmap splitting, retired handle lifecycle, and concurrent access.runtime/test/title_host_region_gpu_test.cpp: end-to-endVulkanContextimport,host_at/buffer_at/resolve_title_bda, GPU copy + readback verification of CPU-written bytes, and clean retirement before freeing host pages.Verification (NVIDIA GeForce RTX 3060 Ti)
ctest):title_host_regionsPassed (9.35 s),title_host_region_gpuPassed (0.23 s).clang-cl+xwin) under Wine 11.22:title_host_regions_test.exe: PASStitle_host_region_gpu_test.exe:ok (align=4096, bda supported)AI-assisted: yes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.