D3D12.X: a recorded draw's pipeline wait honours XCL_GFX_PSO_WAIT_MS again #3318
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3318"
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 ivall/xcl. Originally posted by Prime1997 on 2026-11-29T07:55:34Z.
Requested by Prime
Since the pinned one-shot pipelines for draws (
ed5e9e47), a recorded draw resolves its pipeline throughresolve_retained_for_emission, which waited byXCL_PSO_WAIT_MSalone. The graphics budget (XCL_GFX_PSO_WAIT_MS, a thread's share of each second) and the compute budget (XCL_CS_PSO_WAIT_MS) were read only byresolve_wait, which no draw reaches any more: with onlyXCL_GFX_PSO_WAIT_MSset, draws again waited until their pipeline was built.Both paths now choose their budget in
resolve_pending_budgets. With no budget set nothing changes: a draw still waits until its pipeline is built.The second commit does the same for the binds and indirect draws that pin their pipeline, which still waited by
XCL_PSO_WAIT_MSalone (unset by default: until the pipeline was built):resolve_and_pin_pending(inWaitmode, and inForBindmode for a compute pipeline),resolve_wait_bound_and_pinandresolve_for_indirect. In a a retail title session on the PC below withXCL_GFX_PSO_WAIT_MS=100and the first commit, threads still waited up to 103 s for graphics pipelines (161 waits of 1 s or more).The fourth commit keeps a pinned dispatch on
XCL_PSO_WAIT_MSalone, as before (pinned_wait_budgets): bounding it byXCL_CS_PSO_WAIT_MStoo, as the second commit first did, skipped 300-315 compute passes a session in a retail world on that PC (2-12 before), and one of two runs ended in a GPU hang (0x887A0005, no page fault, no breadcrumbs). The native compute bind (select_for_native_bind) is unchanged. The third and fifth commits change the budget test only. The third to fifth commits correct the second and are to be squashed into it before review.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs(first commit):resolve_pending_budgets(the budget choice ofresolve_wait_budgetsfor aPendingalready in hand), called byresolve_wait_budgetsand byresolve_retained_for_emission; the budget test inused_testsalso checks a retained draw (not waited for past the graphics budget) and a retained dispatch (waited for)crates/xcl/src/hle/d3d12x/pso_async.rs(second and fourth commits):WaitBudgetsandpinned_wait_budgets(a graphics pipeline: theXCL_GFX_PSO_WAIT_MSshare; a compute one:XCL_PSO_WAIT_MSonly), used byresolve_and_pin_pending_budgets(called byresolve_and_pin_pending),resolve_wait_bound_and_pinandresolve_for_indirect; the budget test also checks a pinned bind (not waited for past the graphics budget) and that a pinned dispatch gets no compute budgetcrates/xcl/src/hle/d3d12x/pso_async.rs(third and fifth commits, test only): the budget test no longer pins a fake compute result, and waits (at most 10 s) for each fake build to end before releasing it: either had crashed the library test processTested
cargo test --workspace --no-fail-fast -- --test-threads=4with the threeuma_drivertests below skipped, onf54964792b: 2605 passed, 0 failed, 49 ignored (SKIPPED GPU tests: 28 lines: 21no wave64(this card runs wave32), 3 a wave32 per-lane form refused by the translator (#1426), 2no heap windows(opt-inXCL_HEAP_WINDOWS=1), 1no dxc.exe, 1cannot disable the driver cache(needs Windows Developer Mode))cargo test -p xcl --lib -- --test-threads=1 uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window): 3 passed, 0 failed. They are left out of the whole run because on this PC's driver they can end the library test process (exit 0x7c10003, "coherent window could not be restored"), onmaintoocargo test -p xcl --lib -- --test-threads=4, same skips): 2466 passed, 0 failed; 2466 passed, 0 failedmainfa204595a4: 2605 passed, 0 failed, 49 ignored, 28SKIPPEDlines (own-prs-20261129 run, same command)scripts/smoke.ps1, no input, copied profile and shader cache): blocks belowXCL_GFX_PSO_WAIT_MS=100 XCL_CS_PSO_WAIT_MS=100) of a batch of this branch with ten other changes: with the second commit (batch 49f78cb0) 300 "its dispatches are skipped" lines and a GPU hang at 362 s; with the fourth commit (batch e6863626) 3-13 such lines and no device removal in 3 of 3 runs, but no drawn world, because a pinned dispatch still waits until its pipeline is built (16-141 s at a time) whenXCL_PSO_WAIT_MSis unset; withXCL_PSO_WAIT_MS=2000the world ran (69 frames, 0 device removals, 72 such lines)Regression run
Not tested
XCL_GFX_PSO_WAIT_MS), so they do not reach the changed budget path. The world-load runs under Tested set the budgets but are of a batch with ten other changes, not of this branch alone.AI use
Optional temporary Discord for coordinating contributor work, testing and comparing results.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-29T08:06:07Z.
One useful bound to document for the restored graphics path: XCL_GFX_PSO_WAIT_MS is a per-thread refill rate with an initial full bucket. It is not a rolling-window cap, and time spent blocked itself refills the bucket. With 500 ms configured, one newly started recording thread can spend almost the entire first second waiting on distinct cold draws, even without any other work between them.
I exercised the exact resolve_pending_budgets, gfx_wait_left/spent and budget_for logic from
ca7fa013with a deterministic monotonic clock and a wait backend that either returned ready immediately or consumed precisely the offered timeout. Eight consecutive distinct graphics timeouts received 500, 250, 125, 62.5, 31.25, 15.625, 7.812, 3.906 ms: 996.093 ms total, versus 4,000 ms for eight independent full allowances. Eight ready graphics pipelines consumed zero simulated time. With the same graphics setting, a 30 ms compute override and a 700 ms general fallback, eight distinct compute timeouts consumed 240 ms, confirming the separate per-dispatch bound. A fresh recording thread starts its own bucket.This is consistent with restoring the existing token bucket; it matters for interpreting first-frame or per-present wait totals. I'd spell out initial burst plus refill when documenting the switch. These are offered-budget controls, not native driver timings, and worker/admission priority in #3307/#3284 is separate. OpenAI Codex prepared and ran the CPU control and drafted this note.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T08:41:51Z.
Ran the graphics-budget selection test at
ca7fa013on an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
The test passes: a retained draw is not waited for past the graphics budget while a retained dispatch still uses the compute budget. The PR is a draft and its thread has only a note about the budget's initial refill; this adds a Blackwell datapoint on driver 32.0.16.2140. It is a CPU-side budget-selection test, not a title wait measurement.
Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T13:18:40Z.
Re-ran the graphics-budget test at
ad569ed5after the head moved fromca7fa013; this is a new response in the same thread, not an edit of my earlier report: https://github.com/xcl-dev/xcl/pull/3318#issuecomment-7253272672Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
The test still passes at the new head: a retained draw is not waited for past the graphics budget while a retained dispatch still uses the compute budget. This adds the new head and driver 32.0.16.2140 as dimensions; it is a CPU-side budget test, not a title wait measurement.
Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T14:20:31Z.
Re-ran the graphics-budget test at
665d4e25after the head moved fromad569ed5; this is a new response in the same thread, not an edit of my earlier report: https://github.com/xcl-dev/xcl/pull/3318#issuecomment-7256443373Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
The test still passes at the new head, which only changes a test fixture so it never pins a fake pipeline. This adds the new head and driver 32.0.16.2140 as dimensions. CPU-side budget test, not a title wait measurement.
Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T14:39:56Z.
Re-ran the graphics-budget test at
559ff553after the head moved from665d4e25; this is a new response in the same thread, not an edit of my earlier report: https://github.com/xcl-dev/xcl/pull/3318#issuecomment-7257227563Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
The test still passes at the new head, whose commit restores the previous behaviour for a pinned dispatch. The test also asserts that a retained draw stays within the graphics budget and a retained dispatch uses the compute budget. This adds the new head and driver 32.0.16.2140 as dimensions. CPU-side test, not a title wait measurement.
Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T15:24:11Z.
Re-ran the graphics-budget test at
f5496479after the head moved from559ff553; this is a new response in the same thread, not an edit of my earlier report: https://github.com/xcl-dev/xcl/pull/3318#issuecomment-7257480066Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
The test still passes at the new head, which only changes how the test waits for its fake builds before releasing them. This adds the new head and driver 32.0.16.2140 as dimensions. CPU-side budget test, not a title wait measurement.
Not tested: a retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by minimalhipster990 on 2026-11-29T15:52:20Z.
Retail run with
XCL_GFX_PSO_WAIT_MS=50on RTX 4090: at the current headf5496479the title reaches its world in 2 of 2 runs. Onmainit reached it in 0 of 8. This covers the case the description lists as not measured.Setup
--locked:main7a649b0e7341c1daf1bcf2f3101e9518a8a8c16f.f54964792b965e2de7ba002753a70ddd52bddedamerged onto thatmain(clean merge,git diff --checkclean), giving local merge commit27853b44.ad569ed57e8b2bec41817a53dae312a49105887bmerged the same way (ce8c60cf), run before the head moved.cargo test --release --locked -p xcl --lib -- the_graphics_budget_is_a_threads_for_a_second --test-threads=1: 1 passed, 0 failed on each merged tree.XCL_GFX_PSO_WAIT_MS=50 XCL_CS_PSO_WAIT_MS=200 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_COHERENT_HEAPS=sparse XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=3990 XCL_TWO_PASS_MB=3072.XCL_PSO_WAIT_MSandXCL_DIRECT_DXILwere unset.mainrun). The NVIDIA driver cache was left to the driver. Themainandad569ed5runs were run in ABBA order. The twof5496479runs came after them, back to back.Results
"World" means the first 2 s
XCL_ACTIVITYinterval with 10,000 or more draws. The budget line (still being built after … ms) is logged for the first 16 events and then at powers of two, so the line count is a sample. The last counter value is in brackets.mainAad569ed5Aad569ed5BmainBf5496479Af5496479B"Compute programs skipped" counts the
compute pipeline of record … not built after 200 ms: its dispatches are skippedlines (one per program).ad569ed5a pinned dispatch also stopped waiting afterXCL_CS_PSO_WAIT_MS. So those two runs skipped 102–193 compute programs, against 0 onmain, and do not isolate the graphics budget.f5496479pinned dispatches wait as before: 15 and 2 programs skipped. Those runs logged 17 and 15 compute pipeline waits (214 s and 65 s in all) and reached the world later, but still with no graphics wait over 1 s.With the same budget, six earlier
mainruns never reached the world either, whetherXCL_DIRECT_DXILwas unset or1. Each had 0 budget lines and 3–197 graphics waits over 1 s. The captured frames show an interior (a figure at a window) with the PR, and loading artwork onmain.Device removals. These are not caused by this PR, as far as I can tell. All 6 removals in this table, and 3 of the 6 earlier
mainruns, ended with system commit almost exhausted: 1.2–5.4 GB left at removal (53.8–58.3 GB in use). DRED had no breadcrumbs. Process commit was 42–46 GB at the last memory report, 33–36 GB of it inother. The PR runs last longer, so they reach the same memory limit later in the world.Not tested: the full workspace suite (only the budget test above), AMD, the
XCL_PSO_REBUILD_RECIPES/ pressure-policy paths this PR also changes, and runs withoutXCL_GFX_PSO_WAIT_MS. With that variable unset the PR's description says nothing changes, and I did not check it. Two runs per tree, so the arrival times are rough: they vary a lot from run to run.AI use: Claude Code (Claude Opus 5.5) built the trees, ran the tests and the replays, and wrote this report. The person running these tests asked for it.
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:39:27Z.
Review: COMMENTED
Static review of
665d4e25for the stack in the #3041 comparison.A compute-only wait budget can bring back command-list splitting in the measured revision. With only
XCL_CS_PSO_WAIT_MSset, native compute bind can time out and leave an initial pipeline pending. The retained deferral guard still checks onlyXCL_PSO_WAIT_MS. With allocator pooling enabled, repeated dispatches can split the recording while that build remains pending. The guard's comment records prior command-list memory exhaustion from repeated splitting under short budgets. This concerns665d4e25, before the later pinned-dispatch fixes described in the PR. Native bind ?? Deferral guardReview assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:43:32Z.
Review: COMMENTED
Critical review of current head
f5496479. The latest changes preserve unbounded waiting for pinned compute while applying the graphics budget to retained draws and indirect graphics binds; that addresses the prior missing-dispatch regression. I found no current-head code blocker in the budget routing. Please keep the GPU-world regression as a merge gate: withXCL_GFX_PSO_WAIT_MS=50, count skipped graphics draws, pinned-compute omissions, device removals, and frame time over the same scripted scene. The RTX 4090 result is encouraging but covers two runs. No local Windows run.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:07:52Z.
Review (head
f5496479, diff read, not a merge-check; draft, so not built or run):resolve_retained_for_emissionnow passescs_wait_budget()(pso_async.rs~12428), so a direct or submit-replayed Dispatch is skipped onceXCL_CS_PSO_WAIT_MSruns out (what dispatches did before056fc43b, which the description doesn't mention). Butpinned_wait_budgets(~12318) keeps ExecuteIndirect and DispatchMesh compute onXCL_PSO_WAIT_MS, and the PR's fourth commit gives the reason: the CS cutoff skipped about 300 compute passes and hung the GPU. Either make the two paths consistent or explain why direct dispatches are safe, and test a dispatch with a compute budget set (the test at ~10528 passescs = None).XCL_CS_PSO_WAIT_MSset, put-off dispatches can be dropped again. On main a dispatch is only put off whenXCL_PSO_WAIT_MSis unset (79b19941records it at once with the bounded wait otherwise), and the submit replay is safe becauseresolve_retained_for_emissionwaits withwait_budget(), which is None then. If it now also honourscs_wait_budget(), a run with onlyXCL_CS_PSO_WAIT_MSset still puts dispatches off but gives the submit wait a limit, so a put-off dispatch can be skipped at the submit, the case #2547 was about. (Added after reviewing #2547.)resolve_pending_budgetsdirectly, and ~10552 comparespinned_wait_budgets()with its own definition, so it would pass even ifresolve_retained_for_emissionkeptwait_budget().resolve_wait_bound_and_pin(~12409) is#[cfg(test)], but the description lists it among the changed bind paths.3b6a91edfailed the same geometry tests that day), so it needs a rebase and rerun. Commits 3-5 are fixups to squash, and AI use names no model.Fine: with no budget variable set nothing changes.
resolve_pending_budgetspicks the budget exactly as main'sresolve_wait_budgets, and each path counts one use of the pipeline. A recorded draw past its budget is skipped, as on main withXCL_PSO_WAIT_MS. "Again" checks out:ed5e9e47moved draws off the graphics budget. No overlap with #3306 / #3307 (worker and compile-gate priority).AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T17:39:59Z.
Test report (not a merge-check: draft)
, wanted "). This PR doesn't touch heaps or the mixed window, and the same intermittent failure hit other PR runs on this machine today while two full runs of main passed, so it is most likely not this PR. The rest of the suite passes, and the findings in my review standbase:
b2b1f109d2head:
f54964792bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 1 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: hle::d3d12x::uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3318#issuecomment-7300409794, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: no smoke run. The first run of this merge lost the lib test binary to the known
uma_drivercoherent-window abort; this is the rerun.assessment: 1 test failed in this run:
uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment("remake_mixed: segment 0 (64 MB CUSTOM): Map gavehardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.