mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2025] runtime: early-exit pending_through and cache semaphore completions in RetireTickets #2033
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#2033
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/2025
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:perf/rt-retire-tickets-early-break-and-sem-cache📝 Commits (1)
cf5127eruntime: early-exit pending_through and cache semaphore completions in RetireTickets📊 Changes
2 files changed (+106 additions, -2 deletions)
View changed files
📝
runtime/src/retire_tickets.h(+49 -2)📝
runtime/test/retire_tickets_test.cpp(+57 -0)📄 Description
Coordination item:
RT-RETIRE-TICKETS-EARLY-BREAK-AND-SEM-CACHE(claimed on #1608).Why
RetireTickets::pending_through(ticket)scanned the entirepending_deque even though normalrecord()calls arrive in non-decreasing ticket order (as documented at the top ofretire_tickets.h). Under deletion-queue backpressure (VulkanBackend::wait_retire_ticket(old_ticket)), scanning thousands of newer in-flight submissions wastes mutex-held CPU time undersubmit_mutex_.RetireTickets::completed(query)invoked the caller's Vulkan semaphore query (vkGetSemaphoreCounterValue) for every non-idle pending entry, even when a previous entry in the same pass already confirmed an equal or higher timeline value on that semaphore.Changes
runtime/src/retire_tickets.h:monotonic_(automatically reset totruewhenpending_drains, cleared if an out-of-order ticket< pending_.back().ticketis recorded) sopending_through(ticket)returns immediately whenticket < pending_.front().ticketand breaks as soon asentry.ticket > ticketin the monotonic case, while preserving full-scan exactness for out-of-order tickets.(semaphore, highest_confirmed_value)entries on the stack insidecompleted(query)so subsequent entries in the same pass withfront.value <= confirmedskip redundantquery()calls.runtime/test/retire_tickets_test.cpp: add tests for per-pass confirmed-value caching, >8-semaphore cache eviction, non-monotonicpending_through()fallback, monotonic reset after drain, and cutoff-before-front early return.Verification
runtime/test/retire_tickets_test.cppwithclang++ -std=c++20 -Wall -Wextra -Werror:-O1 -g -fsanitize=address,undefined): PASS.-O1 -g -fsanitize=thread): PASS.-O2): PASS.-O2benchmark (50,000 calls topending_through(16)on 4,096 pending submissions across 3 queues):main:137.223 ms(acc=2400000)8.417 ms(acc=2400000, 16.30× faster, bit-exact).python3 -I scripts/check_no_game_data.py runtime/src/retire_tickets.h runtime/test/retire_tickets_test.cpp: clean.python3 -I tests/test_text_write_line_endings.py: 3/3 OK.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.