retire_tickets: coalesce pending_through per semaphore and guard completed_ monotonicity #935
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!935
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/935/head"
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?
@narekshaghoyandev on GitHub · 2026-11-24 15:17 UTC · original
narekshaghoyandev:ubiq-retire-tickets-dedup-wait→main· +31 −3 · 2 files · 1 commits · merged 2026-11-24 18:38 UTCSummary
RetireTickets::pending_through(ticket)inruntime/src/retire_tickets.hso multiple pending submissions on the same timeline semaphore collapse to a single(semaphore, max_value)entry instead of passing duplicateVkSemaphorehandles tovkWaitSemaphoresinwait_retire_ticket().completed_inRetireTickets::completed()so a non-monotonic ticket can never move the completed retirement prefix backward.runtime/test/retire_tickets_test.cppwith regression checks for per-semaphore coalescing, idle queue exclusion, cutoff filtering, and monotoniccompleted_.Verification
g++ -std=c++20 -Wall -Wextra -Werror -pedantic -fsanitize=address,undefined -O1 -g runtime/test/retire_tickets_test.cpp -o /tmp/retire_tickets_test && /tmp/retire_tickets_test— pass.main: fails with exit code 5 before the patch and passes cleanly after.python3 -I scripts/check_no_game_data.py runtime/src/retire_tickets.h runtime/test/retire_tickets_test.cpp— clean.Claimed in the coordination issue as: RT-RETIRE-TICKETS-DEDUP-WAIT
AI-assisted: yes (Gemini)
@KernelSmoker on GitHub · 2026-11-24 15:32 UTC · original · approved these changes
Verified on head
9392bbd9e03b88fd4746f51e2fb1e7cd7b0e5b86. The CPU-only regression binary builds with GCC 16 using-std=c++20 -Wall -Wextra -Werror -pedanticand passes;check_no_game_data.pyandgit diff --checkare clean. The per-semaphore maximum is appropriate for the caller: each queue progress timeline is monotonic and global tickets are recorded in order, while idle entries are excluded after successful queue-idle.ASan/UBSan could not be independently run here: linking fails because this environment lacks
/usr/lib64/libasan.so.8.0.0. I therefore make no sanitizer claim. Hosted GitHub checks were still pending when I reviewed.@SweatierKey on GitHub · 2026-11-24 15:33 UTC · original · approved these changes
Independent verification on Windows 11 against
origin/main@a28927849:retire_tickets_test.exe(clang-cl+ xwin SDK 10.0.26100) and ran natively on Windows 11:out-of-order queue completion kept the retirement prefix safe(rc=0), exercising per-semaphore max-value coalescing inpending_through()(skipping idle queues and post-cutoff tickets) and monotoniccompleted_clamping.python3 -I scripts/check_no_game_data.py: clean.Clean, minimal fix preventing duplicate
VkSemaphoreentries invkWaitSemaphoresand backward retirement regression.AI-assisted: yes
@moffington on GitHub · 2026-11-24 15:33 UTC · original
Reviewed
9392bbd9eagainsta28927849on Linux. No issues found.The checked-in
retire_tickets_testand an independent adversarial test suite passed with ASan/UBSan enabled.The differential suite reproduced the duplicate-semaphore issue on baseline and passed on HEAD. Also verified per-semaphore maximum-value coalescing, out-of-order completion, monotonic retirement, semaphore isolation, and recording new tickets after
queue_idle().Full Vulkan
vkWaitSemaphoresintegration was not tested locally. From the CPU-side correctness review, LGTM.@Timon360SB on GitHub · 2026-11-24 15:48 UTC · original
Testing results
Independently tested PR #935 against the baseline on
two NVIDIA GPU configurations.
Tested revisions
a28927849adb4e40dfdec8c32fb6758dcd205a379392bbd9e03b88fd4746f51e2fb1e7cd7b0e5b86Test environments
Test configuration
All selected build targets compiled successfully
for both BASE and HEAD on both systems.
CTest results
retire_ticketsvk_queue_query_syncd3d12_queue_waitd3d12_queue_handover_two_queuesvk_sync_validationAll 12 CTest invocations completed with exit code 0.
Retire tickets
The retirement prefix remained safe during
out-of-order queue completion.
The test passed consistently across all repetitions,
both revisions and both hardware configurations.
No retirement-ordering failures were observed.
Queue and query synchronization
The following scenarios completed successfully:
remove_query_poolwithQueryReplay::commit.QueryReplay::planwith
commit.vkQueueSubmitoperations.held batch.
subsequent work.
The fault-injection results were consistent across
BASE and HEAD:
The reported execution failures and device-loss
messages belong to the intentional fault-injection
scenarios.
D3D12 queue waits
Both Wait-before-Signal scenarios completed
successfully:
No test failures, hangs or timeouts were observed.
Two-queue handover
The test used a caller-owned Vulkan device with
two VkQueues handed to the layer.
The reported queue availability was 3/3/3 for
COPY/COMPUTE/DIRECT on both systems.
Results per invocation:
These results were consistent across all repetitions
on both GPUs.
The never-signaled fence scenario also completed
successfully:
The diagnostic reporting two held operations that
were never submitted is expected for this scenario.
Both upload heap configurations were covered:
Vulkan synchronization validation
The synchronization validation self-test produced
the expected results in every execution.
The reported
WRITE_AFTER_WRITEhazard wasintentionally triggered by the self-test.
Synchronization validation was confirmed to be
active in all 12 self-test executions.
The validation layers also reported configuration
warnings related to GPU-assisted validation,
feature adjustments and unsupported validation
options.
These diagnostics were consistent between BASE
and HEAD.
No unexpected validation errors or new validation
diagnostics were observed within the tested scope.
Limitations
untested synchronization or retirement scenarios.
Conclusion
All selected tests passed consistently on both
hardware configurations and both tested revisions.
The retirement prefix remained safe during
out-of-order queue completion. Queue synchronization,
fault recovery, Wait-before-Signal and two-queue
handover tests completed successfully.
No functional regressions, unexpected validation
errors or test failures were observed between BASE
and HEAD within the tested scope.
Result: PASS — no regressions detected.
AI-assisted log analysis and report preparation.
@QemmHD on GitHub · 2026-11-24 18:38 UTC · original
Merging.
Why merged: RT-RETIRE-TICKETS-DEDUP-WAIT: pending_through() merges entries per semaphore to the highest value, and completed_ can no longer move backwards. moffington (ASan/UBSan, with a differential test that fails on the base), Timon360SB, KernelSmoker and SweatierKey checked it independently.
Why it's good: retire_tickets passes both plain and under validation.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main
32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main71f99e224: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).