Repository navigation
Runtime: reclaim GPU batches on all completed CommandSlots in VulkanQueue::acquire - #4787
emirhan-karaca wants to merge 1 commit into
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Built and ran vk_queue_slot_batch_reclaim_test at 6d7c25e62 on Windows 11, RTX 5070 Ti: 4 cases passed (validation errors: 0), exit 0.
VulkanQueue::acquire now reclaims GPU batches on every completed CommandSlot, not just the current one, so a queue with several completed slots does not hold their batches; the 419-line test covers the multi-slot completion, partial completion and the already-reclaimed case. git diff --check clean.
Merge check: clean with #4557, #4663, #4740 and #4756 (independent of the fence/semaphore changes). No blocking issue.
|
Verified the completed-slot sweep with two completed and two still pending on a physical RTX 3080 Ti, NVIDIA 620.73.04, CachyOS Linux, at For the mixed case I modified only the fixture locally. I put a queue timeline signal between submissions 2 and 3, blocked the last two submissions on a second gate value, then released the first pair and waited on the midpoint signal. One plain submission triggered
Nine runs produced identical counts and zero validation errors. This directly checks both lifetimes on one sweep: completed batches released their handles while in-flight batches retained theirs. AI-assisted, synthetic commands only. |
|
Tested 6d7c25e merged with main 98fa503 on Linux (CMake 4.4.5/Ninja, GCC, Vulkan headers only) and Windows (MSVC 14.51, /W4 /permissive-): concern (runtime test could not be run)
|
Claim: #4683
Problem
VulkanQueue::acquire()(runtime/src/vulkan_backend.h:2280-2295) sweeps all completedCommandSlots (slot.ticket <= done) to clearslot.segmentsand recycleslot.events, but only resetspredicate,predicated_copy, andcounted_dispatchon the singlereuseslot (and only aftervkResetCommandBuffersucceeds). After a multi-submission burst, completed slots beyond slot 0 retain theirVkBuffer,VkDeviceMemory, andVkDescriptorPoolhandles indefinitely during steady-state traffic.Fix
slot.predicate.reset(),slot.predicated_copy.reset(), andslot.counted_dispatch.reset()into the completed-slot sweep alongsideslot.segments.clear().vk_queue_slot_batch_reclaim_testcoveringPredicateReducer::Batch,PredicatedBufferCopier::Batch,IndirectDispatchCounter::Batch, and failedvkResetCommandBuffer. (Note: adjacent open PR runtime: cap the command buffers a Vulkan queue keeps in flight at 64 #4191 also refactorsVulkanQueue::acquire(), but leaves these three batch resets outside the completed-slot sweep.)Verification
llvmpipe(Vulkan 1.4.318),VK_LAYER_KHRONOS_validation1.3.275, Ubuntu 24.04.5, GCC 13.3.0.main(98fa503f):vk_queue_slot_batch_reclaim_testfails deterministically on all 3 batch types (buf=3 mem=3 pool=3,buf=3 mem=3 pool=6,buf=3 mem=3 pool=0).vk_queue_slot_batch_reclaim_test3x plain + 3xLEONIDA_VK_VALIDATION=1(0 validation errors);vk_predicate_capture_test,vk_predicated_copy_test,vk_queue_query_sync_testunderLEONIDA_VK_VALIDATION=1(0 validation errors);ctest(4/4) andpython3 -I tests/test_ctest_registration.py(4/4) pass.