mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1190] runtime: support placed buffers in OpenExistingHeapFromAddress heaps (RT-EXISTING-HEAP-PLACED) #1222
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#1222
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/1190
Author: @Taffyyy-ops
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:feat/existing-heap-placed-buffers📝 Commits (1)
3b27011runtime: support placed buffers in OpenExistingHeapFromAddress heaps (RT-EXISTING-HEAP-PLACED)📊 Changes
6 files changed (+949 additions, -32 deletions)
View changed files
📝
docs/README.md(+1 -0)➕
docs/existing_heaps.md(+46 -0)📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+149 -29)➕
runtime/test/d3d12_existing_heap_placed_test.cpp(+731 -0)📝
runtime/test/d3d12_existing_heap_test.cpp(+15 -3)📄 Description
Claimed in the coordination issue as:
RT-EXISTING-HEAP-PLACED(https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142144089)What and why
ID3D12Device3::OpenExistingHeapFromAddressexisting heaps (runtime/shims/d3d12_vulkan_device.cpp):E_NOTIMPLfor existing heaps inDevice::create_placedsoCreatePlacedResource,CreatePlacedResource1, andCreatePlacedResource2bind placed buffers directly onto the heap'sVK_EXT_external_memory_hostVkDeviceMemoryatheap_offsetviaResource::create_existing_heap_buffer. Placed textures in existing heaps remain explicitlyE_NOTIMPL.D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER(includingOpenExistingHeapFromAddress) requiresD3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER(E_INVALIDARGotherwise), while keepingALLOW_CROSS_ADAPTERrefused on non-cross-adapter heaps and preservingGetDesc().Flags.VkMemoryHostPointerPropertiesEXT::memoryTypeBitswithVkBuffermemory requirements (DeviceState::host_buffer_info) and gatedVK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT/VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BITbehindDeviceState::need_buffer_device_address().Map(0, nullptr, &ptr)to returnheap_host_address + heap_offset, preserved pre-filled host pages (non-zeroing), setbinding.host_readable = trueforTRANSFER -> HOST_READbarriers, and ordered teardown (wait_retire_ticket->vkDestroyBufferbeforeheap_range_.reset()->vkFreeMemory).DeviceState::flush_host_import_unpin):vulkan-1.dllon Intel RaptorLake-S (0x8086) showed thatvkFreeMemoryonVK_EXT_external_memory_hostmemory followed immediately byVirtualFreewithout a real GPU submission in between leaves Intel's Windows WDDM paging engine unpinning freed pages, causingVK_ERROR_DEVICE_LOST(-4) on subsequent queue submits (which caused the pre-existing failure ind3d12_existing_heapon Intel). NeithervkDeviceWaitIdle,vkQueueWaitIdle, nor an empty command buffer flushed it, whereas submitting a barrier-only list viastaging_queue+idle()resolved it cleanly for bothPAGE_READWRITEandPAGE_READWRITE | PAGE_WRITECOMBINE.runtime/test/d3d12_existing_heap_placed_test.cpp(registered inruntime/CMakeLists.txtasd3d12_existing_heap_placedwithSKIP_RETURN_CODE 77), updatedruntime/test/d3d12_existing_heap_test.cpp, addeddocs/existing_heaps.md, and indexed it indocs/README.md(without touchingdocs/d3d12_vulkan.md).Tested
cmake --build runtime/build):101/101targets built cleanly (0errors,0new/W4 /permissive-warnings).LEONIDA_VK_DEVICE="RTX 5060"CTest (8/8passed in21.58s):d3d12_vulkan_device,d3d12_placed_dimensions,d3d12_placed_heap_lifetime,d3d12_existing_heap(8/8heap parity cases vs host RTX 5060 and WARP + placed buffer + slot 133),d3d12_existing_heap_placed(15/15placed parity cases vs host RTX 5060 and WARP +no-bda&bda+arenabidirectional coherence + aliasing + heap-before-buffer lifetime + 64-iter stress + Xbox proxy slot 29),d3d12_xmem_placed,d3d12_method_variants,d3d12_heap_properties.LEONIDA_VK_DEVICE="Intel"CTest (8/8passed in10.51s): exact same8suites, including8/8and15/15parity vs host Intel UHD Graphics and WARP, with the previous Intel WDDMExecuteCommandListsfailure resolved.8/8passed in0.38s):device_proxy,device_proxy_trace,xs_proxy_mock,xs_proxy_mock_no_reserve,xs_proxy_mock_no_protect,xs_proxy_mock_no_handler,xs_proxy_mock_env_slots,xs_proxy_mock_env_slots_invalid.python -I tests/test_ctest_registration.py(4tests OK)12python -I tests/test_docs_*.pysuites (47tests total OK)python -I scripts/check_no_game_data.pyon all 6 changed/added files (exit 0)git diff --cached --check(exit 0)GPUs tested:
32.0.16.2124/621.24, Windows 11)32.0.101.7026, Windows 11)AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — no translator rules changed)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.