mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1539] [MERGED] RT-RADV-IMPORT-PINS: d3d12: free declined host imports at once and pin the pages of live ones (RADV CS rejection) #1567
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#1567
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/1539
Author: @aslan2142
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:radv-import-pins📝 Commits (4)
599fe9fd3d12: free a declined slot-133 import at once9f82f13d3d12: pin the pages of a live host importd4f3e0bMerge main (b07b9ecb0) into radv-import-pins8665eeeMerge commit '3f81d46ac' into HEAD📊 Changes
5 files changed (+255 additions, -12 deletions)
View changed files
📝
runtime/shims/d3d12_com.h(+3 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+49 -10)📝
runtime/src/title_page_watch.h(+25 -0)📝
runtime/test/d3d12_title_va_test.cpp(+125 -0)📝
runtime/test/kernel_writes_test.cpp(+53 -2)📄 Description
Item:
RT-RADV-IMPORT-PINS, NateWeav's claim (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141859164). The finding, the measurements and the design are theirs (that comment and https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142359977). This implements their description on currentmain, as offered in https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151275414. @NateWeav, if you'd rather open your own patch, say so and this one closes.Not included:
RT-SHADOW-ALIAS-GUARD(their second claim, the copy cost after the fix).What and why
On RADV, making a page read-only while a
VK_EXT_external_memory_hostimport of it is live makes the kernel reject that submission and every later one:radv/amdgpu: The CS has been rejected, thenVK_ERROR_DEVICE_LOST. The slot-133 shadow trackers guard copied title pages exactly that way, somainloses its device right after the first present on RADV.create_host_buffer(runtime/shims/d3d12_vulkan_device.cpp) now destroys the buffer and frees the memory on every decline aftervkCreateBuffer: below the arena, host-pointer properties, a type or offset mismatch, a failed allocation or bind. Before, the memory waited in the deferred queue while the shadow made instead guarded the same page.kernel_writes::holdpin over their pages (runtime/src/title_page_watch.h, newhold/release) beforevkAllocateMemory, and release it on every path that frees the memory (decline,fail(), the resource destructor,remove_console_heap).ShadowPagesand the geometry watch already pass over pinned pages. A hold records the pin even before a tracker exists and lifts a guard already on the range. Taking it before the allocation means no guard can land between the writability check and the import.Tests
kernel_writes_test: 9 checks of hold and release.d3d12_title_va_test(imports-on mode,d3d12_geometry_views):check_declined_imports: no import memory outlives a declined import across a submission (on the RDNA2 iGPU both buffers land below the arena, the path the first change fixes);check_import_over_shadow: a shadow's tracker guards its pages (control), an import of the same pages keeps them writable across two submissions, the pin ends with the import and the guard returns. On llvmpipe the import is taken and pinned; on the iGPU it is declined and no pin is left.d3d12_geometry_viewsgoes from fail to pass on the iGPU.Measured on the retail boot (RDNA2 iGPU, RADV, Wine; counts only)
mainint3after the device lossAI-assisted (Claude Code, Claude Opus 5.5).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.