mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #1681] d3d12_vulkan: without Resizable BAR, textures and staging buffers leave the BAR window to the arena; tile heaps prefer VRAM (RT-ALLOC-NO-REBAR-RETRIES) #1695
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#1695
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/1681
Author: @ImLele69
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:rt-alloc-no-rebar📝 Commits (4)
798077bd3d12_vulkan: leave the BAR window to host-visible VRAM allocations and stop retrying it when full092cc9ed3d12_vulkan: try a memory type once while its last six tries all failed1940c2ad3d12_vulkan: a tile heap prefers device-local memory instead of requiring it86eb22fMerge branch 'main' of https://github.com/ubiquitarianism/leonida into rt-alloc-no-rebar📊 Changes
3 files changed (+42 additions, -6 deletions)
View changed files
📝
runtime/shims/d3d12_vulkan_device.cpp(+3 -1)📝
runtime/src/vulkan_memory.h(+22 -2)📝
runtime/test/d3d12_state_map_test.cpp(+17 -3)📄 Description
Claimed in the coordination issue as: RT-ALLOC-NO-REBAR-RETRIES — https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156470795
What and why
On a card without Resizable BAR the DEVICE_LOCAL | HOST_VISIBLE memory type sits in a heap of about 256 MiB. Two things went wrong once that window or VRAM filled up during the story load (RTX 2070 SUPER 8 GB, NVIDIA 620.70.06, Wine 11.21):
memory_type_orderput the window type second for every texture and default-heap buffer that prefers VRAM, and in index order for staging buffers. Textures used it up (nvidia-smiBAR1 at 246 of 256 MiB), and from 18,585 registered images on, every such allocation failed there before reaching system memory.Heap::tiles) required DEVICE_LOCAL, so with VRAM full the 8 MiB heaps failed for every type andtiles()returned nothing.Changes:
memory_type_order: only an allocation that asks for both DEVICE_LOCAL and HOST_VISIBLE (the arena, upload buffers with Resizable BAR) tries a BAR-window type (bar_window_type, new) in its place; the others try it last. Nothing changes with Resizable BAR, where that type is not a window.Heap::tiles: DEVICE_LOCAL preferred instead of required. The types are the sparse resource's ownmemoryTypeBits, so a system-memory type there is valid.The first version also changed
allocate's retries ofVK_ERROR_OUT_OF_HOST_MEMORY.mainhas since made those retries adaptive (they stop while they don't recover), which covers the same case without the regression kawaii-shakal pointed out for the arena, so that part and its failure counter are gone after the merge withmain0d80bc5df.Tested
d3d12_state_map_test(Linux, clang 20): new cases forbar_window_typeand the order of textures, staging buffers and the arena on the RTX 3090 layout already in the test, with and without Resizable BAR. Passes after the merge.VK_ERROR_OUT_OF_DEVICE_MEMORY, so only changes 1 and 2 above can apply there, once VRAM is full.AI-assisted: yes (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.