You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OLD-9794: fix(vulkan): use memory_type_order with OOM fallback in PredicateReducer::batch - #1569
Replace the single-choice memory-type scan with leonida::memory_type_order(memory_, requirements.memoryTypeBits, 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, requirements.size) (runtime/src/vulkan_memory.h), filtering out heaps smaller than requirements.size (VUID-vkAllocateMemory-pAllocateInfo-01713).
Iterate over all ordered compatible memory types when vkAllocateMemory() fails (e.g., VK_ERROR_OUT_OF_DEVICE_MEMORY), resetting b->memory = VK_NULL_HANDLE on each failed attempt so ~Batch() cleans up safely.
python3 -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/src/vulkan_predicate.h runtime/test/predicate_alloc_test.cpp: OK (exit 0, zero game data)
Tested dd8625af6 applied onto main42537e7b6 on Windows with an AMD Radeon RX 7900 XT (RDNA3), AMD driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, VS 2022 (MSVC 19.44), RelWithDebInfo. This is the first Windows run, and the first on a discrete GPU reported here. No game files.
The new test builds under MSVC and predicate_alloc passes.
The related tests pass, 13 of 13, plain and with LEONIDA_VK_VALIDATION=1 (validation on, no messages).
Seven of them run on the card and reach PredicateReducer::batch with its real memory layout: vk_command_replay, vk_predicated_copy, vk_predicate_capture, vk_overlapping_occlusion, vk_overlapping_occlusion_no_statistics, vk_binary_occlusion and d3d12_predicated_copy.
The other six are CPU-only or mocked: predicated_copy, replay_write_immediate_predication, d3d12_state_map, indirect_dispatch_count_alloc, predicate_alloc and replay_query_predication.
One small thing in the test. On OOM the mock vkAllocateMemory already writes VK_NULL_HANDLE to *out, so no check depends on the new b->memory = VK_NULL_HANDLE reset: the tests would pass without it. If the mock wrote a poison handle such as 0xdead on failure, test 4 would catch a missing reset: batch would come back non-null, because the poison handle passes the !b->memory check and the mock bind succeeds.
Hi @Tortoche, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/CMakeLists.txt, runtime/src/vulkan_predicate.h), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.
AI-assisted (Claude Code, Claude Opus 5.5).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
needs rebaseConflicts with the base branch: rebase it on main
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item ID:
OLD-9794Carries forward Draft
#71(old-pr/9794bytotonii/totonicpu, preserving original commit authorship atdd8625af6), rebased cleanly ontomain(364ab4eab).Claimed in
#14: #14 (comment)AI-assisted: yes
Summary
runtime/src/vulkan_predicate.h(PredicateReducer::batch):leonida::memory_type_order(memory_, requirements.memoryTypeBits, 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, requirements.size)(runtime/src/vulkan_memory.h), filtering out heaps smaller thanrequirements.size(VUID-vkAllocateMemory-pAllocateInfo-01713).vkAllocateMemory()fails (e.g.,VK_ERROR_OUT_OF_DEVICE_MEMORY), resettingb->memory = VK_NULL_HANDLEon each failed attempt so~Batch()cleans up safely.runtime/test/predicate_alloc_test.cpp&runtime/CMakeLists.txt:predicate_alloc_test(registered aspredicate_allocunderif(TARGET Vulkan::Headers)), covering undersized-heap skip, OOM fallback, all-heaps-undersized failure, and all-types-OOM cleanup.Tests Executed (Linux x86_64, no retail game files / no Windows build)
ctest --test-dir runtime/build -C RelWithDebInfo: 71 Passed / 2 Skipped (shader_library_corpus,vk_sync_validation) / 0 Failed out of 73ctest --test-dir runtime/build -C RelWithDebInfo -E "^xdxr_build_check$" --output-on-failure: 70 Passed / 2 Skipped / 0 Failed out of 72 (includingpredicate_alloc1/1 andvk_predicate_capture1/1)ctest --test-dir runtime/build -C RelWithDebInfo -R "^xdxr_build_check$" --output-on-failure: 2/2 Passed (xdxr_build,xdxr_build_check)./runtime/build/predicate_alloc_test: OK (predicate_alloc_test: all checks passed)python3 -I tests/test_ci_registration.py: 16/16 passedpython3 -I tests/test_ctest_registration.py: 5/5 passedpython3 -I tests/test_text_write_line_endings.py: 3/3 passedpython3 -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/src/vulkan_predicate.h runtime/test/predicate_alloc_test.cpp: OK (exit 0, zero game data)