runtime: work-aware timeout clock for console command-list value waits #1957
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!1957
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1957"
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?
@IlyassRS3 on GitHub · 2026-11-25 16:45 UTC · original
IlyassRS3:fix/rt-list-value-wait-work-aware-timeout→main· +814 −33 · 5 files · 2 commits · merged 2026-11-26 14:41 UTCClaim:
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.@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 16:45 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@DadaCap on GitHub · 2026-11-25 17:23 UTC · original
Retail result for this in the world phase (RTX 5080, NVIDIA 621.24, Windows 11; merged onto the tree of 7167396852 with #1972, our copy-cost and lifetime branches;
LEONIDA_VALUE_WAIT_TIMEOUT_MSunset):So it does with no override what took me a 30 s limit that then ran out behind a 107 s pipeline build (in another run 13 gates timed out that way). The picture of that run is the best so far (bloom, lens flare, lit tree and fence). One run; I have not read the code beyond the diff's shape.
list_value_wait_budget_testpasses on my tree. Thank you for taking the finding to a real fix. AI-assisted (Claude Code).@aslan2142 on GitHub · 2026-11-25 17:27 UTC · original
Thanks, the pausable clock is a good idea. Two things before this can go in:
start_gategives a cut-short gate a 4 ms budget, but the 60 s pause cap of the full timeout. A wait that is never met can then hold a frame for up to 60 s, not the few ms the demotion is there for. Please scale the cap with the gate's own budget.matching_producerandreleaser_busynever expire. A producer held behind a dependency the model doesn't track (a title fence wait, aSignalthat never returns) now hangs where the timeout used to free it. Please add a finite cap.Pump(or a mock of it) and fails without this change.AI-assisted (Claude Code, Claude Opus 5.5).
@kawaii-shakal on GitHub · 2026-11-25 17:35 UTC · original
Independent test report for
ec95c3c0b(VERIFY-1887-1957-BLACKWELL, claimed in #1608).Setup: Windows 11 Pro 26300, VS 2026 MSVC, RelWithDebInfo, RTX 5070 Ti (Blackwell), NVIDIA driver 617.42,
LEONIDA_VK_DEVICE=5070. Clean configure and full build ofruntime/succeed with MSVC.Full CTest (
ctest -j 6 --timeout 600):9e7720c9eec95c3c0bThe one new test,
list_value_wait_budget, passes. The skipped ones are the same as on base (game files or features this setup does not have:shader_library_corpus, bink,fsr_dispatch,bvh_builder,vk_sync_validation,d3d12_rgb9e5_rtv,d3d12_boot_movie,d3d12_first_light).Repeat runs:
list_value_wait_budget,d3d12_title_va,d3d12_title_va_shadow,d3d12_unmapped_vsharpand the ninexs_proxy_mock*tests,--repeat until-fail:20 -j 4: all 13 passed all 20 rounds.AI-assisted (Claude Code, Claude Opus 5.5).
@IlyassRS3 on GitHub · 2026-11-25 17:52 UTC · original
Thank you @aslan2142 for the review (and @DadaCap / @kawaii-shakal for the retail RTX 5080 and RTX 5070 Ti verification!). All four review points are addressed in
9520db518:start_gate()now callsdefault_pause_caps(gate_ms, cut_short)using the gate's own budget (cut_short ? kDemotedTimeoutMs : full). Demoted (cut_short) gates getactive_us = 1x(4 ms) andmax_us = 4x(16 ms), so an unmodelled wait only pays a few milliseconds (at most 8 ms under unrelated active work / 20 ms under a busy releaser or stuck producer) instead of inheriting the full timeout's 60 s cap.matching_producerandreleaser_busy:GateTimeoutStatenow trackstotal_paused_usacross all pause reasons against a finitemax_pause_cap_us(default_pause_caps:1500xofgate_ms, capped at 10 min —300 s/ 5 min at the default 200 ms timeout, covering multi-minute world-phase pipeline builds while guaranteeing a finite exit if a producer is held behind an untracked title fence wait or aSignalthat never returns). Alternating betweenactive_work,matching_producer, andreleaser_busysharestotal_paused_us <= max_pause_cap_us.Pump:runtime/test/xs_proxy_mock_test.cppdriving the realPump(d3d12_xs_list_values.h) across matching-producer pause (11a), busy-releaser pause via a 150 msCopyPageMappingsBatchXaction hook (11b), demoted-gate active-work cap scaling (11c), and finite cap on a stuck matching producer (11d).runtime/test/list_value_wait_budget_test.cppwith finite-cap, demoted-cap, combined-pause, and 1 ms mock-Pumptick-driver checks; also verified all 4 scenarios directly against realPumpunder ASan+UBSan and TSan (and confirmed negative control fails onmain).Antigravity agent by Google DeepMind).AI-assisted: yes (Antigravity agent by Google DeepMind).
@Tyrannys on GitHub · 2026-11-25 18:12 UTC · original · edited 2026-11-25 18:55 UTC
Test report from a combined build on a second NVIDIA machine. Counts only.
Machine: Windows 11, RTX 4070 SUPER, NVIDIA 621.01, 64 GB, own 1.0.2.1 copy.
Build:
mainfe1553456(already contains #1827 and #1893), plus #674, #1662, #1851, #1849, #1905, #1957, #1950, #1886 and #1894. All of them merged without conflicts.Shaders: translated on
3de22a190+ #674 + #1662 with--wave64-emulate. 29,279 of 29,280 translated, and all 29,279 passspirv-val. That is 2,683 library programs and 29 of 29 FSPX.main's translator changes since then are correctness fixes only.Pipeline cache: warm and complete, 26,503 of 26,503 (9.6 GB).
ActivateRays,ActivateProbesandActivateProbesTargetprograms of indirect diffuse lighting.Recipe:
scripts/windows-boot/boot.ps1 -Seconds 480,LEONIDA_KEYBOARD_PAD=1 LEONIDA_SKIP_INT3=1 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_MAP_READBACK=1,LEONIDA_PIPELINE_CACHE_DIRpointing at the offline cache. Host image copy:off (auto: NVIDIA)from #1851. One run per row.LEONIDA_TITLE_WATCHDOG=0)game_scarlett_master.exe+0x23cf683)main42537e7b6+ #1631; my run table of 07:54 in #1608).AI-assisted (Claude Code).
@GGandCo on GitHub · 2026-11-25 18:38 UTC · original
Combined integration verification of
9520db518on Windows 11, MSVC RelWithDebInfo, Intel UHD Graphics (i5-1334U), Intel driver 32.0.101.6314.list_value_wait_budget, all ninexs_proxy_mock*modes (including the added real-Pump scenarios),d3d12_xmem_placed, andd3d12_m2_textured: 12/12 passed. Build succeeded.This was cherry-picked into an existing private integration tree with other runtime changes, including a texture-quality experiment; it is not an isolated-main or full-suite result. It does not establish successful title startup or playability. No title files or shader content are included.
AI-assisted: OpenAI Codex.
@qhukz13 on GitHub · 2026-11-25 18:43 UTC · original
Independent run on Windows 10 19045, GTX 1050 Ti (Pascal, 4 GB), NVIDIA 582.66, MSVC (VS 18 Build Tools), RelWithDebInfo. Base
b0f3d3998with this PR (ec95c3c0b) and #1887 applied together.d3d12_xs_list_values.hbuilds clean under MSVC as part of the full runtime build (the PR had a stubbed-fsyntax-onlycheck on clang only).xmempair is flaky, 5/5 on rerun).list_value_wait_budget: passes 3/3, plain and with validation.xbox_list_value_fallback,xbox_gpu_label_completion,xs_proxy_mock*: pass 3/3.AI-assisted (Claude Code).
@KushGene on GitHub · 2026-11-25 18:52 UTC · original
Independent Wine/RADV report for
9520db518against its merge base9e7720c9e. All 448 shared tests had the same outcome. The newlist_value_wait_budgettest passed in the suite and in 20 additional standalone runs of the Windows executable.9e7720c9e9520db518Fedora 45, AMD Radeon RX 6700 XT (NAVI22), Mesa RADV 26.2.7, Wine Staging 11.21. A Windows Vulkan probe enumerated only AMD
1002:73df. Cross-built the unmodified revisions with clang-cl/LLD 23.1.5, xwin SDK 10.0.26100 and CMake 4.3.0 (Ninja, RelWithDebInfo, D3D12 shim tests enabled, Rust XMA2 decoder built). SDL3 was unavailable, so CTest disabled its two GameInput tests. Ran the entire configured suite with four workers, then reran every failure individually on both revisions.d3d12_queue_wait,d3d12_queue_wait_timeout,xbox_list_value_fallbackpassed on both revisions. The same 15 failures reproduced individually on base and PR:bcrypt_rng,bcrypt_rng_seeded,d3d12_clear,d3d12_clear_formats,d3d12_clear_restricted_depth,d3d12_console_descriptor_heap,d3d12_mesh,d3d12_xs_root_signature,device_proxy,device_proxy_trace,file_system,gameinput_host,pipeline_cache_seed,root_sig,xbox_gpu_label_completion.Synthetic tests only. No retail run or frame-rate measurement. AI-assisted (Codex). Coordination claim.
@azsekazvamdimitar on GitHub · 2026-11-25 19:50 UTC · original
Independent test report (Linux, Wine and Proton) for
9520db518, claim VERIFY-1887-1957-LINUX-WINE in #1608.Setup: RTX 3090 (Ampere), NVIDIA 590.48.01, Debian 13 (Linux 6.12), clang-cl cross build with xwin; WineHQ 11.22 (winewayland) and GE-Proton11-14 (winex11).
Test suites (main
b9320a118against main + this PR, same machine, full runtime CTest):ctest -j4ctest -j4list_value_wait_budgetandxs_proxy_mockpass on all three. Under Proton the failing set is the same as main's. Under WineHQ the two runs differed only in tests that timed out or flaked under-j4(gfx10_tilingon main,xbox_bvh_builderwith the PR, one of thexmemvariants each way); run one at a time, all three trees give the same result:gfx10_tilingandxbox_bvh_builderpass, andxmem,xmem_no_write_watchandxmem_write_watchfail one check (writing to 512 of them charges about those 512 pages) on main too. The other failures are main's own under Wine (host comparisons and Wine host differences).Retail boot under GE-Proton, 1200 s each, same tree and settings, the A press scripted from 50 s. Tree: main
71a769d7dwith #1827, #1849, #1851, #1867, #1918 and a local merge of #429, plus local logging; settingsLEONIDA_ASYNC_PIPELINES=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096 LEONIDA_DEVICE_FAULT=1. The PR's two commits are cherry-picked on top for the third column.LEONIDA_VALUE_WAIT_TIMEOUT_MS=30000So on this machine the PR's own clock meets about as many gates as the 30 s override (1,059 of 1,118 against 1,065 of 1,067) without the override's cost in submissions. One run per column, so the speed numbers carry run-to-run noise. In the override run the opening "two years ago" card and the credit captions drew; in the default-limit run they did not. I did not watch the screen in the run with the PR.
Not run on Windows. AI-assisted (Claude), measured and checked by me.
@Snooozs on GitHub · 2026-11-25 20:02 UTC · original
A CPU-only check of the wait clock at
9520db518(MSVC,list_value_wait_budget.hbyte-identical to the head; the numbers areGateTimeoutStatedriven in 1 ms steps, 200 ms budget):matching_producerreleaser_busyon every passreleaser_busynoneactive_workTwo things from the pump code (
d3d12_xs_list_values.h:820), read, not run in the game:releaser_busyislanded_any || !opening.empty() || pending_releases_ != 0, andlanded_anyis "a write group landed in this pass", from any queue. With writes landing on every pass an unmet gate never reaches its idle budget until the 300 s cap, although no releaser is busy.timeouts_in_a_row_(demotion after 4) is reset by any met gate.Why I looked: in a retail boot of mine (RTX 5060 Ti, main + this PR, default timeout) 40 gates were held, 18 met and 5 timed out, and no submission followed for about 200 s, the longest stall of the releaser being 151.5 s (one pipeline build inside a
Signal). The releaser part is expected; I can't say whether the rest is the case above. A producer that can no longer make progress, and unrelated landings counting asreleaser_busy, look like the two to separate.AI-assisted (Claude Code, Claude Opus 5.5).
@MoonEyes on GitHub · 2026-11-25 22:24 UTC · original
Independent test report for this PR at head
9520db518, merged locally on maindb1a22d29(merge30d296f7b, no conflicts, no rebase).What this adds to the reports above: an RTX 4060 (Ada); a native Windows full suite at the current head, on main
db1a22d29(earlier full runs were onec95c3c0b); an independent repeat of the author's negative control, plus two header mutants. Thexmemflake was already reported above; new here arexs_proxy_mock:4487and thexbox_raw_2d_stripestimeout.Configuration: Windows 11 Pro 10.0.26300, desktop RTX 4060, NVIDIA driver 610.88. MSVC 19.44 (VS 2022), CMake + Ninja, RelWithDebInfo, full
runtime/build (946 steps, exit 0). No game files: the 11 tests that need them are skipped and 2 are disabled, same as on main.Counts
list_value_wait_budgetand thexs_proxy_mock*tests, 10 tests): 10/10 passed.ctest -j 4 --timeout 600on the merge: 455 registered, 439 passed, 3 failed, 11 skipped, 2 disabled.The 3 failures under
-j 4are load-dependent; two of them were also reproduced on main; none touches this PR's codexs_proxy_mockfails atxs_proxy_mock_test.cpp:4487,EXPECT(g_tear.torn == 0 && g_tear.reads > 0): in section 7 (value stores). The check combinestorn == 0andreads > 0, and the output does not say which half failed; my reading is that the reader thread got no read under CPU load. The line is not in this PR's diff. On maindb1a22d29it fails at the same line in 1 of 20 serial runs, and again under-j 8 --repeat until-fail:15. On the merge it passed 20 of 20 serial runs and failed the same line once under load.xmem_write_watch(alsoxmemandxmem_no_write_watchunder the-j 8repeat) fails the check "writing to 512 of them charges about those 512 pages" under load and passes alone. Same failure on main under the same repeat run.xbox_raw_2d_stripestimes out at 35 s under-j 4; alone it takes 23.1 s on the merge and 23.7 s on main (I did not run main under-j 4, so this one is not shown on main).Each of the 3 passes alone on the merge; I did not see a failure specific to the merge.
Mutation (the PR's tests against main's source)
xs_proxy_mock_test.cppwith main'sshims/d3d12_xs_list_values.hswapped in, rebuilt: fails 10 of 10 runs at line 4583,stats.gates_timed_out == 0 && stats.gates_met == 0 && cell2(27) == 0(section 11, added by this PR).list_value_wait_budget_test.cppcannot be built against main: main has nosrc/list_value_wait_budget.h.max_usfails at line 227; a normalmax_uscap 10 times too large fails at line 71. The unmutated header passes.Not covered: no retail boot or playability test. The open questions in the comments (a
matching_producerorreleaser_busypause lasting up to 300 s) are runtime behaviour these unit tests do not exercise.AI-assisted: yes (Claude Code, Claude Opus 5.5, built and ran the tests; a second agent checked this text)
@djrolfes on GitHub · 2026-11-26 01:15 UTC · original
Additional synchronous Linux/Wine retail observation for head
9520db518, not an isolated performance A/B. RTX 3070 Ti 8 GiB, NVIDIA 620.73.04, Wine 11.22, clang-cl 23.1.5. Merged onto private integration fffc9857f (existing host-import/mesh/runtime fixes plus #2116 diagnostics), yielding 796896ead. Only merge conflict was adjacent includes; both headers retained. Targeted runtime build succeeds, focused Wine tests pass 11/11 (nine xs_proxy_mock modes, list_value_wait_budget, queue_holds_report); native list_value_wait_budget passes ASan+UBSan.1800 s bounded run with LEONIDA_VALUE_WAIT_TIMEOUT_MS=30000, synchronous pipelines, compute warmup disabled, watchdog kicked: 33 gates held / 18 met / 8 timed out / 7 still pending, zero short waits, one demotion. At ~874 s there were 4 timeouts; by ~1593 s, 8. Submitted/landed writes remained 8145/8092; latest snapshot had 21 pending write groups, 26 unsatisfied CPU fence waits and 61 held operations with a release running. Meanwhile 22 slow compute builds completed, mostly about 1 minute each; active compilation lasted through the pass. Presents/submissions stopped at 1192/2424 around 203 s. No verified world frame or device-loss report.
This illustrates the remaining finite-cap limit during a continuous cold compilation interval: the policy does not keep all gates valid through the full interval. It does NOT prove the pending work is deadlocked, nor that extending pause caps is the right fix. Cache state/input timing differed from the prior integration, so lower timeout counts are not a controlled causal result. Keeping subsequent warm-cache validation separate; raw logs/captures remain local. AI-assisted (OpenAI GPT-6.1 Sol).
@aslan2142 on GitHub · 2026-11-26 14:42 UTC · original
Thank you, @IlyassRS3. This went into
mainthrough #2350 (RT-LINUX-AMD-WORLD), merged at your head9520db518with your commits and authorship kept. In our world run on an RX 7900 XTX, 450 of 464 cross-queue gates were met with it, against 0 of 33 before. GitHub shows this PR as merged for that reason, so nothing needs closing.AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)