mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:20:53 +01:00
[PR #1910] runtime: cache helper Vulkan device procs, fix uncounted BDA fault and BAR/cleanup guards (RT-VK-HELPER-PROC-CACHE-AND-GUARDS) #1919
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#1919
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/1910
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rt-vk-helper-proc-cache-and-guards📝 Commits (1)
8651979runtime: cache helper Vulkan device procs, fix uncounted BDA fault and BAR/cleanup guards (RT-VK-HELPER-PROC-CACHE-AND-GUARDS)📊 Changes
6 files changed (+714 additions, -155 deletions)
View changed files
📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/src/quad_index_expand.h(+48 -26)📝
runtime/src/vulkan_indirect_dispatch_count.h(+91 -50)📝
runtime/src/vulkan_predicate.h(+125 -48)📝
runtime/src/vulkan_predicated_copy.h(+66 -31)➕
runtime/test/vk_helper_proc_cache_test.cpp(+377 -0)📄 Description
Item ID:
RT-VK-HELPER-PROC-CACHE-AND-GUARDS(claimed in #1608).Summary
Hardens and speeds up the four Vulkan replay compute helpers (
runtime/src/vulkan_indirect_dispatch_count.h,runtime/src/vulkan_predicate.h,runtime/src/vulkan_predicated_copy.h,runtime/src/quad_index_expand.h):count_offsetGPU BDA fault + immediate failure cleanup (vulkan_indirect_dispatch_count.h):LEONIDA_INDIRECT_GROUP_BUDGETwas active andcount == VK_NULL_HANDLEwith a non-zerocount_offset,Batch::prepare()accepted the call and wroteout.count = count_va + count_offset = count_offset != 0;emit()then treatedjob.count != 0ashas_count = 1and passedcount_offsetas a raw GPU device address.Batch::prepare()now rejects!count && count_offset != 0, explicitly setsout.count = count ? count_va + count_offset : 0, prefers pure VRAM ahead of the 256 MiB BAR window on non-ReBAR GPUs (!resizable_bar()), and destroys partialVkBuffer/VkDeviceMemoryallocations immediately on failure instead of retaining dead handles until submission completion.vulkan_predicate.h):PredicateReducer::batch()'s first-DEVICE_LOCALloop withmemory_type_order()(withmemoryHeapCount == 0mock compatibility), prefers pure VRAM over the 256 MiB BAR window on non-ReBAR GPUs, retries all eligible memory types onVK_ERROR_OUT_OF_DEVICE_MEMORY, and clears failed handles on error.vulkan_predicated_copy.h):PredicatedBufferCopier::Batch::prepare()destroys the newly createdVkDescriptorPoolimmediately ifvkAllocateDescriptorSetsfails instead of keeping an empty pool inpoolsuntil batch teardown.vkGetDeviceProcAddrstring lookups (all four helpers):PFN_vk*function pointers once insidemake_pipeline()rather than invokingvkGetDeviceProcAddrthrough the loader on everyprepare(),capture(),emit(), and batch cleanup call.Verification
vk_helper_proc_cache(runtime/test/vk_helper_proc_cache_test.cpp, Clang 20, C++20,-Wall -Wextra -Werror):LEONIDA_INDIRECT_GROUP_BUDGET=1024): PASSLEONIDA_INDIRECT_GROUP_BUDGET=1024): PASS-O2× 3 (LEONIDA_INDIRECT_GROUP_BUDGET=1024): PASSruntime/test/indirect_dispatch_count_alloc_test.cpp: PASSruntime/test/replay_quad_list_test.cpp: PASSmain's headers withLEONIDA_INDIRECT_GROUP_BUDGET=1024: fails onmain(prepare(args, 0, VK_NULL_HANDLE, 16, ...)returnedtrue), passes on this branch.python3 -I scripts/check_no_game_data.pyon all 6 touched files andpython3 -I tests/test_text_write_line_endings.pypassed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.