D3D12.X: add opt-in per-frame PSO wait budget (XCL_PSO_FRAME_WAIT_MS) #1931
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1931
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1931"
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?
@gsucristo on GitHub · 2026-11-24 23:40 UTC · original
gsucristo:d3d12x/pso-frame-wait-budget→main· +124 −7 · 3 files · 1 commits · draftAdds an opt-in shared per-frame wait budget (
XCL_PSO_FRAME_WAIT_MS=<ms>, off by default) forpso_async::resolve_wait. When a title binds dozens of uncompiled compute pipelines in a single frame, a per-pipeline timeout (XCL_PSO_WAIT_MS) multiplies across each pending pipeline and can stall a frame for seconds; sharing one budget across the frame caps total stall time and refills onPresentX.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs: parseXCL_PSO_FRAME_WAIT_MS, track remaining microsecond wait budget for the current frame, cap eachresolve_waitbymin(XCL_PSO_WAIT_MS, frame_remaining), deduct elapsed wait time, and exposebegin_frame()to refill the budget. Pipelines skipped solely because the frame budget ran out are not marked permanentlylate, so they can still be waited for on the next frame if not finished by a worker yet.crates/xcl/src/hle/d3d12x/present.rs: callsuper::pso_async::begin_frame()inpresent_x_frame.README.md: documentXCL_PSO_FRAME_WAIT_MS.shared_frame_budget_caps_multiple_slow_pipelines_and_refills_on_next_frameverifying that a second pending pipeline returns immediately once the shared frame budget is spent and resolves after refill.Tested
rustc 1.98.1, debug test build cross-compiled tox86_64-pc-windows-msvccargo test --target x86_64-pc-windows-msvc -p xcl --lib -- pso_async::: 7 passed, 0 failed, 0 ignoredRegression run
main:
PR:
Not tested
cargo test --workspace -- --test-threads=4scripts/smoke.ps1regression run on main and this PR (required before leaving draft)AI use
pso_async::unit tests under Wine, and drafted this PR description.@raylitebull on GitHub · 2026-11-25 00:57 UTC · original
Code review on \e870dd2:\n\n- \XCL_PSO_FRAME_WAIT_MS\ in \pso_async.rs\ and \present.rs\ cleanly shares a microsecond per-frame budget across
esolve_wait\ calls, refills on \PresentX, avoids marking frame-budget-exhausted pipelines permanently \late, and handles \udget.is_zero()\ after \p.want(). \Build and test (Windows, no GPU)\ is green.\n\nWhat is still needed before merge:\n1. Fix the \PR description\ check (include an exact-head \xcl-smoke\ pair in the PR body for \hle/d3d12x/*\ changes).\n2. Independent AMD and NVIDIA verification on \
e870dd2.@Pipodi on GitHub · 2026-11-25 01:35 UTC · original
Test report: #1931 on the retail title's world load
I tested head
e870dd2, merged without conflicts ontomainbf9eebd(local merge2bce47f), in a release build. The title stops presenting at about 76 s onmain. WithXCL_PSO_FRAME_WAIT_MS=500it gets past that point, but then it crawls, and with a warm cache it crashes.Setup
XCL_PRESS_AT=16:A, default settings otherwise (no direct DXIL, no heap windows).Results
mainbf9eebd, fresh cachequeue.Waitwatchdog lines0xFFFFFFFFFFFFFFFF; no device removalFindings
queue.Waittimeouts: each waits on a value one step past what the GPU has completed. It is the same access violation @STmihan reported on #1269 (comment), which they tie to split recordings whose older segments are not reset. I did not test that fix; it has no PR. #1993 conflicts withmaininsparse.rs, so I did not run it.Not tested
XCL_DIRECT_DXIL, heap windows, AMD.AI use
@DavidM1911 on GitHub · 2026-11-25 02:40 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Dezmonius on GitHub · 2026-11-25 06:54 UTC · original
Native Windows comparison of the runtime hunks from
e870dd2, applied tocbc296abwith the same local DirectStorage late-page adaptation and activity counters in both runs. RTX 5070 / 610.88, i7-7700K, 32 GiB RAM, Windows 10 19045, Rust 1.100.0 release. Both runs were offline with direct DXIL, Series X profile, same scripted input and same warm cache location.XCL_PSO_WAIT_MS=1000in both; the 500 ms frame budget ran second.The enabled run had only a few later presents. The last sampled image remained loading artwork, and I did not verify any rendered gameplay. The final queue timeouts included a producer whose fence had been submitted but was still one value short of the requested completion. This directly shows the PSO wait signal dropping and queue timeouts appearing in this pair, without establishing that the timeouts caused the crash.
cargo test --locked --offline -j 4 -p xcl --lib pso_async:: -- --test-threads=1: 7 passed, 0 failed, 0 ignored on the candidate. Full suite not run. No game assets or raw logs attached. AI-assisted (OpenAI Codex, GPT-6).@Pipodi on GitHub · 2026-11-25 07:25 UTC · original
Test report for
e870dd2(this PR's head) onmain568e7db, alone and together with #929 (b3a969b), on the retail title.Builds: local merges, never pushed. This PR conflicts with
maininREADME.mdonly; that conflict was resolved tomain's side, and no code conflicted.5ada3de=main+ this PR (present.rs+1,pso_async.rs+127/−7).80ffe43=main+ this PR + #929, merged one at a time (addstitle_list.rs+167).Tested
xcl runof the retail title for 300 s, with a new emptyXCL_DXIL_CACHEper run. One run per row.queue.Waitwatchdog linesmain568e7db5ada3de(this PR)XCL_PSO_FRAME_WAIT_MS=500+0x23cf683)80ffe43(this PR + #929)XCL_PSO_FRAME_WAIT_MS=500+0x4e51965)main's stop at about 70 s, but slowly. Presents per 10 s after the stop:+0x23cf683(the offset seen onmainin earlier runs) to a later bad read.Not tested
XCL_PSO_FRAME_WAIT_MSvalues, a warm cache, and more than one run per build.AI use: Claude Code. A Claude Sonnet 5.5 session made the local merges, ran the title runs and collected the counts; Claude Opus 5.5 wrote this report.
@throny on GitHub · 2026-11-26 00:48 UTC · original
Two contributors checked independently and found that #1652 #2114 solves the same problem (for #505) in a different way: #1607, group D95. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@luckyteagirl on GitHub · 2026-11-26 09:04 UTC · original · reviewed
On
e870dd2, the frame budget is read beforeresolve_wait_for_exand debited only after it returns. Two title threads resolving different pending PSOs can each read the same 40 ms remaining value, each wait for 40 ms, and then subtract 40 ms. That admits roughly 80 ms of aggregate bind waiting in a frame whose setting promises a 40 ms total cap. The sequential unit test at lines 511–543 does not exercise simultaneous callers.There is a related frame-boundary race:
begin_framestores the new frame's allowance while an old wait is still in flight; the old wait's laterconsume_frame_budgetsubtracts its elapsed time from the new frame. Could each caller reserve its allowance atomically before sleeping, then refund unused time only to the frame generation it reserved from? A barrier fixture that starts two pending binds together, plus one that refills during an outstanding wait, would cover both cases.This is an exact-head source review. I did not run a concurrent repro or title smoke test.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.