d3d12: LEONIDA_RELEASE_WORKER=1 releases a queue's held work on its own worker, not on the signalling thread (RT-RELEASER-HELD-REPLAY) #2541
Closed
tiguan26 wants to merge 2 commits from
upstream-pr/2541 into main
pull from: upstream-pr/2541
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2541
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2541"
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?
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-28T01:35:16Z.
Item: RT-RELEASER-HELD-REPLAY (claimed in #1608). Builds on main alone; no dependencies.
What it changes and why
A D3D12
Waitwhose value has not been signalled holds the queue's work; theSignalthat makes it ready records andsubmits that held work inline, on the thread that signalled. The list values' releaser signals the gates of every
queue from one thread, so one queue's replay, with its first-use pipeline builds (38-93 s each when cold with
LEONIDA_ASYNC_PIPELINESoff), holds every other queue's release behind it: djrolfes measured one release taking26 minutes, with the other queues idle and waiting.
With
LEONIDA_RELEASE_WORKER=1, theSignalonly asks: the held queue's own worker records and submits its heldwork, and the signalling thread goes on at once. Each queue's replay cost stays with that queue. This removes the
cause of that stall (one thread doing every queue's replay) rather than shortening it.
Off by default, as #2464 asks for new settings until game runs on two vendors show it right. Unset, held work is
released on the signalling thread exactly as on main.
Files
This touches only
VulkanQueue's held-work and worker code inruntime/src/vulkan_backend.h(release_ready,release_held,run,async_worker,flush_async,submit,discard_waiting_on) andQueueHolds::pump_nowinruntime/src/queue_holds.h. It does not touch the title upload and wait parts ofvulkan_backend.hor any file#2464 lists as off limits; the releaser it helps lives in
d3d12_xs_list_values.h, which is unchanged.Change
VulkanQueue::release_ready(with the setting on) hands the release to the queue's own worker: theLEONIDA_SUBMIT_ASYNCworker, or one started for releases alone on the queue's first release. The worker replays,then pumps the other queues.
queue's request is not left waiting behind that replay.
flush_asyncalso waits for a requested release and for theworker's pump after it.
QueueHolds::pump_now: a pass run after any pass in progress, with no "nothing to do" shortcut (a pass on anotherthread takes a queued Present off the list before running it, so an empty list can still mean a Present in
progress).
VulkanQueue::idle()and the queue destructor use it, so the Presents queued behind released or droppedwork have run when they return.
stop_async()closes the door under the lockstart_release_worker()takes. Without that, another thread's pump could ask a queue to release until its destructor detaches it, and the
worker started then would outlive the queue (
queue_proxy's 8-thread test aborted on exactly that duringdevelopment).
process.
LEONIDA_HELD_RUN_DELAY_MS=<n>sleeps before each held operation, for tests only; it costs nothing when unset.docs/d3d12_vulkan.md: the Wait-before-Signal paragraph describes the default and the setting.Tests
d3d12_held_release_worker_test, two CTest entries. Two queues each hold two Signals behind a gate; one threadsignals both gates, as the releaser does; each held operation waits 1.5 s.
d3d12_held_release_worker(LEONIDA_RELEASE_WORKER=1): both Signals return at once, each queue's held worktakes its 3 s, and the two queues finish side by side, in order on each queue.
d3d12_held_release_on_signaller(the default): the signalling thread runs A's held work before it reaches B'sgate, as on main.
vulkan_backend.handqueue_holds.h, run withLEONIDA_RELEASE_WORKER=1, fails at the check that the held work took its time (main has neither the worker northe delay hook: "held work done at 1 ms").
vk_presenter_sync_release_workerandvk_queue_query_sync_release_workerrun those two testswith the setting on, since the Present and failed-Signal races above only occur with it. Both tests now wait the way
an application does (a fence behind the held batch,
idle()) instead of assuming the release is synchronous.What I ran: cross-built with clang-cl 19 + xwin, run under Wine 11.22 on llvmpipe (Mesa, LLVM 20.1.2), 2 cores, on
main
d442851972(after theport/d3d12-nvidiamerge), one commit. It merges cleanly onto the current main431ceba4f4, whose three newer commits change none of these files.d3d12_held_release_worker,d3d12_held_release_on_signallervk_presenter_sync,vk_presenter_sparse_capture,vk_presenter_sync_release_workervk_queue_query_sync,vk_queue_query_sync_release_workerqueue_proxy, default /LEONIDA_RELEASE_WORKER=1d3d12_staged_copy_wait(main's, useswait_submitted), default /LEONIDA_RELEASE_WORKER=1The 21 full-ctest failures under Wine/llvmpipe here: the 18 that failed on main in this same setup when I last ran
main's full suite (
d1dff7949):gameinput_host,root_sig, the threexmem,file_system, bothbcrypt_rng,vk_device_filter_tools,d3d12_descriptor,pipeline_cache_seed,d3d12_clear,d3d12_view_slices, bothd3d12_indirect_rt,d3d12_subgroup,d3d12_clear_formats,d3d12_set_descriptor_heaps;module_namesandxgameruntime, whose binaries do not include the files this change touches; andrun_tiny_game_console_paths, wherethis Wine prefix's locale turns the test's Unicode overlay folder name into
?(ERROR_INVALID_NAME), the same causeas
file_system.python -I scripts/check_no_game_data.pyon the changed files is clean, and the doc tests pass excepttest_docs_links, which fails on main forREADME.md'sassets/mandy.png. The translator is untouched.Not tested: any GPU but llvmpipe, and any game run. The real check is a retail boot with cold pipeline compiles
and
LEONIDA_RELEASE_WORKER=1, compared with the same run without it (Snooozs, djrolfes: your stall snapshots fromthe list-values work are what this targets).
GPUs tested: llvmpipe (Mesa, LLVM 20.1.2) under Wine 11.22 on Linux.
AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-28T01:59:52Z.
XCL #2965 separates queue submission from observed GPU completion in its receipts. For the release worker, an independent check would signal one completion and immediately quiesce the worker while another resource is still held. Assert the signaller stays free, the completed resource is released once, and the outstanding resource keeps its lifetime contract. This is a source comparison, without a performance claim.
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:01:31Z.
Reviewed at head
25d460ccbon Windows 11 (MSVC 202219.44) with dual-GPU Vulkan validation (LEONIDA_VK_VALIDATION=1, Vulkan SDK1.4.363.0).Verification
d3d12_held_release_worker_test,vk_queue_query_sync_test, andvk_presenter_sync_test.616.64) and AMD Radeon(TM) Graphics (25.10.30.02), both with default settings and withLEONIDA_RELEASE_WORKER=1.Findings (Request changes)
queue_holds.h:168-183;vulkan_backend.h:4030-4045,4083-4088,4681-4730,4841-4854):QueueHoldsinvokes every holder whenever any held operation or queued barrier remains.release_ready()unconditionally setsrelease_requested_ = trueon every worker-backed holder — including whenon_workeris already true — without checking whether the queue's front operation can actually advance. The worker consumesrelease_requested_, sees the front still blocked atrelease_held(), and pumps again at the end of its pass, re-armingrelease_requested_in a tight loop. Because the flag is set before the worker publishes idle,flush_async()can also stall until its 60 s timeout on a queue whose front cannot run (even underLEONIDA_SUBMIT_ASYNCwithLEONIDA_RELEASE_WORKERunset). Only request another worker pass on an actual readiness transition or release progress, letting a blocked front go idle.VulkanQueuedestruction (vulkan_backend.h:2608-2652,4061-4067,4700-4730,4857-4883):start_release_worker()capturesthisby raw pointer, and teardown detachesworker_after the 60 s drain timeout.QueueHolds::detachonly serializes holder callbacks underpump_mutex_, whereasrelease_held_guarded()and post-replay bookkeeping run outsidepump_mutex_and can still touchinbox_mutex_/ queue members after~VulkanQueue()finishes. Keep queue/context state alive until the worker exits (or join cleanly).state_mutex_can deadlock on device loss (vulkan_backend.h:2462-2477,4083-4118;queue_holds.h:61-73):When
context_.is_device_lost()skipsrun(op)insiderelease_held(), the localDeferred op(owning a COM fence pin) is destroyed whilestate_mutex_is still held. If that drops the last reference to the fence while another operation remains held,~VulkanFence->remove_fence()takespump_mutex_and callsdiscard_waiting_on()on all holders, re-acquiringstate_mutex_on the same queue. Move dropped operations into a vector and destroy them after releasingstate_mutex_(matching teardown at4169-4174).vulkan_backend.h:4061-4067;queue_holds.h:168-210):If
std::threadcreation throws insiderelease_ready()during a pump, thread-localin_pumpis never reset; an RAII scope guard forin_pumpand catching thread-start failure prevents future pumps on that thread from silently skipping.AI-assisted review + local MSVC/dual-GPU verification.
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-28T03:04:13Z.
#2541 | head
25d460ccb7| ctest -C RelWithDebInfo -R "d3d12_held_release|vk_queue_query_sync|vk_presenter_sync" (MSVC RelWithDebInfo, GPU tests) | red: clean main + the PR's test files and test registrations: d3d12_held_release_worker and d3d12_held_release_on_signaller fail on assertions (lines 90/94 and 125: the held work finishes at 0 ms, as main has no LEONIDA_HELD_RUN_DELAY_MS and no release worker); the 4 vk_* entries pass on main too | green: main02f71ccfemerged into the head, 6/6 passed, 2 of 2 runs (held_release_worker 3.5 s, on_signaller 6.4 s) | full suite: not run (a game boot was using the machine) | Windows 11, RTX 4070 SUPER, NVIDIA 621.01, Python 3.14 | AI-assisted: yes, Claude CodeImported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-28T05:16:10Z.
@timbot103 thank you, all four were right; and thanks for the RTX 5080 + AMD runs. Fixed in
99308202d(a separate commit so the changes are easy to see). AI-assisted (Claude Code, Claude Opus 5.5).1. Spin on a blocked front. Confirmed: the worker's own pump re-armed
release_requested_on every pass.release_readynow asks only when the held front can run (front_may_run, the sameready(held_.front())testrelease_helduses). The signalling thread does not wait for the state lock: if it is busy, a release is running, so it asks (once per Signal); the worker never re-arms itself on a busy lock, and a front that a Signal makes ready meanwhile is asked for by that Signal's own pass. New check ind3d12_held_release_worker(worker on): a front held on an unsignalled fence, process CPU over 1 s. With the fix 0 ms of 1001; with the oldrelease_ready(check disabled) 990 ms of 1000, and the test fails. That also covers theflush_asyncstall underLEONIDA_SUBMIT_ASYNC.2. Release outliving the queue. The detach after
flush_async's minute was main's, but you're right that the release worker makes it reachable, since one held batch's cold builds can take longer than a minute.stop_asyncnow waits for a worker still busy; only on a lost device (where a release runs nothing) is a still-stuck worker detached. That last case keeps a narrow window, which I'd rather leave than risk hanging teardown on a dead device; say if you'd prefer joining there too.3. Fence pin dropped under
state_mutex_. Confirmed (this one is on main too).release_heldnow moves every operation it ran or skipped into a local vector destroyed after the state lock, as teardown does.4.
in_pumpon a throw.QueueHoldsmarks a pass with a scope guard (PumpScope) in all three places; a failure to start the worker thread falls back to the release on the signalling thread.Retested under Wine 11.22 on llvmpipe:
d3d12_held_release_worker,d3d12_held_release_on_signaller, bothvk_presenter_syncentries plusvk_presenter_sparse_capture, bothvk_queue_query_syncentries,queue_proxyandd3d12_staged_copy_wait, 3/3 each;queue_proxyandd3d12_staged_copy_waitwithLEONIDA_RELEASE_WORKER=14/4. Full ctest 487/509: the same 21 as before plusd3d12_compile_pool, which passes 5/5 on its own and doesn't touch the holds (the load flake Tyrannys claimed as TEST-COMPILE-POOL-LOAD-FLAKE).@Tyrannys thanks for the red/green on the RTX 4070 SUPER; that is the first check of these tests on Windows with a real GPU. Your run was at the first commit, so the new blocked-front check isn't in it yet.
@akimfomin: the case you describe (one release completed, another front still held, the worker going quiet) is what the new blocked-front check exercises, measured through the worker's CPU time rather than a receipt.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T08:51:57Z.
Review: APPROVED
Reviewed the diff and tested merged onto
main(493867366) with Ninja Release (MSVC).The
LEONIDA_RELEASE_WORKERlifecycle inqueue_holds.h/vulkan_backend.hlooks solid:PumpScope,front_may_run(), destroying completeddoneentries outsidestate_mutex_, and clearingworker_busy_only afterpump_ready()avoid lock-inversion and premature-idle races. Both default (on-signaller) and worker-thread modes pass on real Vulkan hardware.Tests run
ctest --output-on-failure -R "^(d3d12_held_release_worker|d3d12_held_release_on_signaller|vk_queue_query_sync|vk_queue_query_sync_release_worker|vk_presenter_sync|vk_presenter_sync_release_worker)$": 6/6 passed (vk_queue_query_sync0.27 s,vk_queue_query_sync_release_worker0.24 s,vk_presenter_sync0.71 s,vk_presenter_sync_release_worker0.59 s,d3d12_held_release_worker7.41 s,d3d12_held_release_on_signaller6.16 s).python -m unittest tests/test_ctest_registration.py -v: 7/7 passed (0.26 s).GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341; VK_LAYER_KHRONOS_validation not installed locally).
AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:02:15Z.
#2541 | head
99308202dd(merged cleanly with mainadfb3821a2— includes the second commit'sfront_may_runidle check,stop_asyncjoin, post-lock fence-pin drop, andPumpScopeRAII) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^(d3d12_held_release_worker|d3d12_held_release_on_signaller|vk_presenter_sync|vk_presenter_sparse_capture|vk_presenter_sync_release_worker|vk_queue_query_sync|vk_queue_query_sync_release_worker|queue_proxy|d3d12_staged_copy_wait)$" --output-on-failure+LEONIDA_RELEASE_WORKER=1onqueue_proxyandd3d12_staged_copy_wait(LEONIDA_VK_VALIDATION=1) | red on main: buildingd3d12_held_release_worker_testagainstmain'squeue_holds.handvulkan_backend.hfails (line 90: b_ms >= 2.0 * kDelayMs - 50 && a_ms >= 2.0 * kDelayMs - 50,held work done at 1 ms) | green on PR+main:9/9CTests (includingd3d12_held_release_worker's newcheck_blocked_front_idlesspin check,d3d12_held_release_on_signaller, bothvk_presenter_syncandvk_queue_query_sync_release_workermodes,queue_proxy, andd3d12_staged_copy_wait) pass in35.28 s, andqueue_proxy+d3d12_staged_copy_waitpass underLEONIDA_RELEASE_WORKER=1in15.95 s, all on physical RTX 3090 hardware with0Khronos validation errors;test_docs_encoding.py,test_docs_repo_paths.py, andcheck_no_game_data.py0violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yesImported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T01:05:55Z.
Review: COMMENTED
Static audit of
99308202dagainst48bae6cad. Request changes.runtime/src/vulkan_backend.h:4917— Device-loss teardown can detach a worker that still accesses queue members. Keep the queue alive through worker exit and join before destruction.runtime/src/vulkan_backend.h:4063— The worker's pump can consume another thread's Signal while a concurrent Wait holdsstate_mutex_, then discard the only release request. Retry after contention outside the pump lock.runtime/src/vulkan_backend.h:4115— The held count reaches zero before the final render submits. A new Present can bypass deferral and read the old frame. Keep the count through replay.runtime/src/vulkan_backend.h:4128— Allocation failure can unwind the last fence pin understate_mutex_and re-enter that lock throughremove_fence(). Put the in-flight operation in storage that survives unlocking.runtime/src/vulkan_backend.h:4037— A pump starts release workers even on empty queues. Check for held work before starting a thread.runtime/CMakeLists.txt:3017— The inline CTest can inherit worker mode and pass as a duplicate. Set both worker-related flags explicitly in each entry.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-30T06:46:25Z.
Closing this. The worker is off by default and shows no frame-rate gain, #1783 already made the QueueHolds pump handoff safe (and is why this now conflicts), and timbot103's second audit (device-loss teardown, the held count reaching zero before the final render) would need a rework larger than the change is worth. Thank you @lixonik for the review, @zmasi for the hardware red/green run, and @timbot103 for both audits. AI-assisted (Claude).
Pull request closed