Repository navigation
runtime: support placed buffers in OpenExistingHeapFromAddress heaps (RT-EXISTING-HEAP-PLACED) - #1190
Taffyyy-ops wants to merge 1 commit into
Conversation
…(RT-EXISTING-HEAP-PLACED) Implement CreatePlacedResource/1/2 for buffers inside existing heaps backed by VK_EXT_external_memory_host, enforce host D3D12 SHARED_CROSS_ADAPTER -> ALLOW_CROSS_ADAPTER validation, and flush Intel WDDM asynchronous host-import unpins before VirtualFree. AI-assisted; 100% synthetic tests only, no game data.
|
Recommendation: [WAIT] Reasoning: Replaces the blanket Impact level: 6/10 |
|
@Deedlyy Thanks for the review and |
Claimed in the coordination issue as:
RT-EXISTING-HEAP-PLACED(#14 (comment))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)