mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #1957] [MERGED] runtime: work-aware timeout clock for console command-list value waits #1964
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#1964
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/1957
Author: @IlyassRS3
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:fix/rt-list-value-wait-work-aware-timeout📝 Commits (2)
ec95c3cruntime: pause list value wait timeouts while submitted or held work can still satisfy them9520db5runtime: cap all list-value wait pauses, scale demoted caps, and test Pump📊 Changes
5 files changed (+814 additions, -33 deletions)
View changed files
📝
runtime/CMakeLists.txt(+2 -0)📝
runtime/shims/d3d12_xs_list_values.h(+134 -33)➕
runtime/src/list_value_wait_budget.h(+251 -0)➕
runtime/test/list_value_wait_budget_test.cpp(+348 -0)📝
runtime/test/xs_proxy_mock_test.cpp(+79 -0)📄 Description
Claim:
RT-LIST-VALUE-WAIT-WORK-AWARE-TIMEOUT(claim comment#7168326837on #1608, taking @DadaCap's world-phase finding#7167966834).Problem
In retail world-phase testing (#1608
#7167966834), the default 200 ms wall-clock timeout inruntime/shims/d3d12_xs_list_values.h(which demotes to 4 ms after 4 timeouts in a row) cuts short all 122 command-list memory waits (0 met) whenever the releaser is busy running multi-second held work or an in-flight producer write has not yet finished on the GPU. That lets dependent queues run out of order and turns lit world frames into silhouettes/black frames, whereas raisingLEONIDA_VALUE_WAIT_TIMEOUT_MS=30000let 68–82 waits be met and produced lit buildings, windows, interiors, trees, and lamp glow.Fix
Extract a portable, sanitizer-verifiable timeout & producer dependency policy into
runtime/src/list_value_wait_budget.hand wire it intort::d3d12_xs::list_values::Pump(runtime/shims/d3d12_xs_list_values.h):GateTimeoutState): tracks idleelapsed_usseparately from paused time instead of comparing wall-clocknow >= deadline, with finite pause caps scaled to the gate's own timeout budget (default_pause_caps(gate_ms, cut_short)):PauseReason::releaser_busy: pauses while writes just landed, gates are opening in this pass, or the releaser thread still has queued/activeSignal()releases (pending_releases_atomic counter with RAIIPendingReleaseGuard), bounded bymax_pause_cap_us.PauseReason::matching_producer: pauses while an in-flightWriteGrouphas a final write (overwrite-aware back-to-front scan, including timestamp writes) that can satisfy an unmet wait of the gate, provided every pending gate<= after_gateon the producer's queue is cycle-free with respect to the waiting queue, bounded bymax_pause_cap_us.PauseReason::active_work: pauses while unrelated unblocked GPU work (an unblockedWriteGroupor unblocked action gate on another queue) is still executing, bounded byactive_pause_cap_us(and sharingtotal_paused_us <= max_pause_cap_us).default_pause_caps(gate_ms, cut_short)):active_us = 300x(60 sat200 ms) andmax_us = 1500x(300 s/ 5 min at200 ms, capped at 10 min) — covers multi-minute world-phase pipeline builds while guaranteeing a finite exit if a producer is held behind an untracked dependency (e.g. a title fence wait or stuckSignal()).cut_short) gates:active_us = 1x(4 ms) andmax_us = 4x(16 ms) of the gate's short 4 ms budget, so unmodelled waits pay only a few milliseconds rather than inheriting the full timeout's cap.PauseReason::none: ticks normally once no submitted or held work can still satisfy the gate (or when a direct/indirect multi-queue cycle is detected).take_open(): only constructs the flatPendingWriteGroup/PendingGateview when a non-forced front memory gate is still unmet and!releaser_busy.Pump:add_writes()recordsafter_gate = max_pending_gate_locked(queue.get()).watch_late()watches cut-short waits fornow + fullrather than the stalegate.since + full(which could already be expired after a long pause).note_outcome()guardsgate.waits.front()with!gate.waits.empty().Overlap notes
watch_releaser, untouched) and #1868 (only 2 lines insideadd_writesrecordafter_gate, and thexs_proxy_mock_test.cppaddition is at section 11 right beforestop_list_values).Verification
ec95c3c0b).list_value_wait_budget(runtime/test/list_value_wait_budget_test.cpp, 11 test groups including finitemax_pause_cap_us, demoted-gate cap scaling, alternating pause reasons, and a 1 ms mock-Pumptick driver).Pumpregression tests inruntime/test/xs_proxy_mock_test.cpp(section 11a–d: matching producer pause, busy releaser pause, demoted gate cap under unrelated active work, and finite cap on a stuck matching producer).list_value_wait_budget_testcleanly under:clang++ -std=c++20 -O1 -g -fsanitize=address,undefined -Wall -Wextra -Werrorclang++ -std=c++20 -O1 -g -fsanitize=thread -Wall -Wextra -Werrorclang++ -std=c++20 -O2 -Wall -Wextra -Werrorrt::d3d12_xs::list_values::Pump(runtime/shims/d3d12_xs_list_values.h) directly under a scratch POSIX-backed Win32 harness running all four scenarios (11a–d) under ASan+UBSan and TSan (4/4 passed, 0 warnings/races), and confirmed the same test fails againstmain'sd3d12_xs_list_values.h(times out at 40 ms while the matching producer is in flight).python3 -I scripts/check_no_game_data.pyon all 5 changed files andpython3 -I tests/test_text_write_line_endings.py: all passed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.