mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #1879] runtime: BAR-aware memory fallback and heap-size filtering in BindlessSet (RT-BINDLESS-MEMORY-FALLBACK-AND-BAR) #1891
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#1891
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/1879
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:rt-bindless-memory-fallback-and-bar📝 Commits (1)
5a6baearuntime: BAR-aware memory fallback and heap-size filtering in BindlessSet📊 Changes
3 files changed (+674 additions, -25 deletions)
View changed files
📝
runtime/CMakeLists.txt(+12 -0)📝
runtime/src/vulkan_bindless.h(+99 -25)➕
runtime/test/vk_bindless_memory_fallback_test.cpp(+563 -0)📄 Description
Item:
RT-BINDLESS-MEMORY-FALLBACK-AND-BARClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164522386
Summary
Fixes memory-type selection and OOM fallback in
BindlessSet(runtime/src/vulkan_bindless.h) usingvulkan_memory.h'smemory_type_order()andresizable_bar()policy:local == fallbackOOM trap inBindlessSet::create():memory_type(bits, DEVICE_LOCAL)andmemory_type(bits, HOST_VISIBLE | HOST_COHERENT)each returned only the first matching memory type with no heap-size check and no retry loop.DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENTBAR type appears at index 0 before mainDEVICE_LOCALVRAM and system RAM on a non-ReBAR GPU,local == fallback == 0, soif (fallback != local)evaluated false on BAR OOM — skipping both main VRAM and system RAM and degrading or failing bindless descriptor table flushes (up to 64 MiB as the table grows).table(device_local == true) tries non-small-BARDEVICE_LOCALtypes first, then remainingDEVICE_LOCALtypes, then falls back toHOST_VISIBLE | HOST_COHERENTtypes (trackingtried_maskto avoid duplicate attempts and incrementingtable_host_fallbacks_when aDEVICE_LOCALtype existed and host fallback succeeded).staging(device_local == false) prefers system RAM over small BAR on non-ReBAR GPUs (while preserving ReBAR staging whenresizable_bar()is true) and retries secondaryHOST_VISIBLE | HOST_COHERENTtypes on OOM.VUID-vkAllocateMemory-pAllocateInfo-01713):requirements.sizewhenmemoryHeapCount > 0(preserving compatibility with synthetic zero-heap mocks wherememoryHeapCount == 0).create_fallbacks()multi-type OOM retry & failed-handle cleanup:DEVICE_LOCALtypes, retries all eligible fitting types on OOM, records failure vianote_failure("fallback image", result), and clears failedimage.image/image.memory/fallback_sampler_handles so~BindlessSet()never frees an invalid handle.No overlap with open PRs
#425or#1092.Verification
runtime/test/vk_bindless_memory_fallback_test.cpp(CTestvk_bindless_memory_fallback):clang++ -std=c++20 -Wall -Wextra -Wno-missing-field-initializers -Werror -O1 -g -fsanitize=address,undefined: passed (0 leaks, 0 invalid frees, 0 undersized alloc attempts)clang++ -std=c++20 -O1 -g -fsanitize=thread: passedclang++ -std=c++20 -O2(3 runs): passedbindless_sizing_test: passed;vk_bindless_grow_test.cppandvk_bindless_test.cpp: syntax-checked cleanlymain: compilingvk_bindless_memory_fallback_test.cppagainstmain'sruntime/src/vulkan_bindless.hfails immediately (FAIL line 346: !mock.table_types_bound.empty() && mock.table_types_bound.back() == 1)python3 -I scripts/check_no_game_data.pyon all changed files: passedpython3 -I tests/test_text_write_line_endings.py: passed (3 tests)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.