D3D12.X: pipeline and DXC workers run below normal, raised while a title waits #3336
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3336"
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-29T09:06:33Z.
Requested by Prime
The ordinary pipeline workers (
xcl-pso-*) and the DXC workers (xcl-dxc-*) are a thread for every core but one each, at the title's own priority: while a world streams its shaders in, they take cores from the title threads the frame waits for. They stayed at normal priority on purpose, because a title thread can wait for a pipeline and must not wait behind its own threads; only the preload workers had a way out of that (lowest priority, raised to normal while their build is wanted).Both kinds of worker now start below normal, and the same raise covers them: a normal worker notes itself on the build it runs (
Demand::normal_thread), the first waiter raises it to normal and the last one to leave puts it back. A DXC compile runs at normal when its build is wanted as it starts, and one already running is raised (dxc::raise_wanted) when its build becomes wanted.XCL_LOW_PRIORITY_WORKERS=0keeps every worker at normal priority.Related: #2423 orders the DXC queue so wanted compiles go first (queue order, not thread priority).
What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs: pipeline workers start below normal;Demand::normal_threadand the raise while a title thread waitscrates/xcl/src/gpu/recomp/dxc.rs: DXC workers below normal,dxc::raise_wanted; testa_running_compile_is_raised_when_a_title_thread_comes_to_want_itREADME.md:XCL_LOW_PRIORITY_WORKERSTested
cargo test --workspace --no-fail-fast -- --test-threads=4with the threeuma_drivertests below skipped, on27c6a4bbc4: 2606 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): 2467 passed, 0 failed; 2467 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 belowRegression run
Not tested
AI use
Optional temporary Discord for coordinating contributor work, testing and comparing results.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T13:18:51Z.
Ran the DXC worker priority test at
27c6a4bbon 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 new test passes: a DXC compile already running is raised when a title thread comes to want its build. The PR is a draft and has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. It is a CPU-side priority test, not a frame-time 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 saintwolf on 2026-11-29T13:47:48Z.
Reviewed and tested at
27c6a4bb.Code review findings
Build::unwant(crates/xcl/src/gpu/recomp/dxc.rs):raise_wanted()raises matching workers toTHREAD_PRIORITY_NORMALand immediately removes them fromRUNNING, andBuild::unwantonly lowers the PSO worker. If a title thread waits briefly (XCL_GFX_PSO_WAIT_MStimeout) and moves on, the DXC worker remains atNORMALfor the rest of a multi-second compile.build.demand(crates/xcl/src/hle/d3d12x/pso_async.rs):Build::wantcallsdxc::raise_wanted()while holdingbuild.demand.lock(), which acquiresdxc::RUNNINGand runsOpenThread/SetThreadPriority/CloseHandleunder both locks. It doesn't deadlock today only becauseWantedclosures only read anAtomicBool, but callingdxc::raise_wanted()after droppingbuild.demandremoves both the lock-ordering hazard and syscall latency underdemand.xcl-pso-whole(real/dispatch_chain.rs) is not lowered bylower_this_worker(), and there is no unit test coveringpso_async'snote_worker/Build::want/Build::unwantpriority transitions (onlydxc::RunningCompileis tested).Tested locally
32.0.16.2140), AMD Ryzen 7 7800X3D,rustc 1.100.0.cargo test -p xcl --lib gpu::recomp::dxc::queue_tests:: -- --test-threads=1: 3 passed, 0 failed.AI use
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:39:35Z.
Review: COMMENTED
Static review of
27c6a4bbfor the stack in the #3041 comparison.I independently reached the same worker-priority finding as saintwolf.
raise_wanteddrops the DXC compile from its tracking list when it boosts the worker. If the last title waiter times out,unwantlowers the pipeline worker only. The compiler can stay at normal priority until the job ends. DXC tracking ?? Waiter removalReview 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:25Z.
Review: COMMENTED
Critical review of current head
27c6a4bb. Unresolved priority-lifetime issue:raise_wantedremoves a running DXC compile fromRUNNINGwhen it boosts the worker.Build::unwantlowers the PSO worker, but cannot find and lower that DXC worker after a timed-out title wait. A long compile can therefore remain at normal priority and compete with frame work even after demand ends. Keep the running compile tracked until completion and tie its priority to current waiter count; test a waiter timing out while compilation continues. This was also identified in the existing review thread. No local Windows run.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:58:27Z.
Review (head
27c6a4bb, diff read, not a merge-check; draft, so not built or run):build_pieces(pso_async.rs~4324) hands pieces to other normal workers as queue jobs that only setBUILDING; they're never noted on the build'sDemand, so while a title waits for the parent, the helpers compiling its pieces stay below normal. Whendispatch_chain::buildruns on a title thread (compile not deferred,real.rs~6162), the title thread itself waits on below-normal helpers, where on main they ran at normal.big_compile_turnaren't raised either.note_worker,Demand::normal_threadand the reset inRunningBuild::drophave no test; only the DXC raise is tested.create_device_sets_dred_first); worth a rerun. AI use should name the model.Fine: the raise and reset happen under the
demand/RUNNINGlocks (no raise after the build ends, no reused thread ids), theWantedclosures only read an atomic (no lock-order problem),THREAD_SET_LIMITED_INFORMATIONis enough forSetThreadPriority, andXCL_LOW_PRIORITY_WORKERS=0restores normal 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-01T16:10:16Z.
Test report (not a merge-check: draft)
base:
b2b1f109d2head:
27c6a4bbc4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 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: none
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3336#issuecomment-7300249274, 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.
assessment: merges, builds and passes the whole suite on current main (0 failed); the findings in my review stand
hardware / 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.