D3D12.X: prioritize graphics pipelines in the async PSO worker pool #628
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!628
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-628"
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?
@Cattn on GitHub · 2026-11-24 02:41 UTC · original
Cattn:pso-async-graphics-priority→main· +143 −16 · 1 files · 1 commits · openReplace the single FIFO
mpsc::channelinpso_asyncwith a two-laneWorkQueueso queued graphics pipelines dequeue ahead of queued compute pipelines on thexcl-pso-*worker pool.When a retail title transitions into world rendering, it queues hundreds of large compute pipelines (100–490 KB DXIL) ahead of its graphics draw pipelines. With one shared FIFO channel, all
xcl-pso-*workers spent tens of seconds compiling compute shaders while every queued graphics pipeline waited behind them (in a local world-loading stack run, 217 compute PSOs finished while 0 graphics PSOs finished over 28 s; with graphics prioritized first, 181 background pipelines built including ~147 graphics PSOs and the title began presenting post-loading world frames). Within each lane (graphics and compute), FIFO order is preserved.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs: replace thempscchannel inqueue()withWorkQueue<T>(gfxandcomputeVecDeques, poppinggfxbeforecompute) +Pool/enqueue; add unit testsgraphics_jobs_dequeue_ahead_of_queued_compute_jobsandworker_pool_prioritizes_graphics_pipeline_over_queued_compute.Tested
32.0.16.1742, wave32), AMD Ryzen 7 7800X3D, 32 GB RAM, Windows 11 Pro 10.0.26200, DXC 1.9.2609.5,rustc 1.93.1 (01f6ddf75 2026-02-11), debug (tests) and release (smoke).766b661),cargo build --workspacepassed andcargo test -p xcl --lib pso_async -- --nocapturereported 4 passed, 0 failed, 0 ignored and 0 skipped.ac387a1),cargo build --workspace && cargo test --workspace -- --test-threads=4reported 688 passed, 0 failed, 41 ignored.SKIPPEDGPU tests (2, no wave64 on this adapter):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware.Wait64BitValueXstall.Regression run
Not tested
pso_asyncunit tests cover queue priority.AI use
WorkQueuepriority scheduling and unit tests inpso_async.rs, ran the test suite and smoke runs on the hardware listed above, and drafted this description.gpt-6.2-sol) resolved the rebase conflict, ran the post-rebase build and focused tests, and refreshed the regression runs and PR description.@MesshM on GitHub · 2026-11-24 02:55 UTC · original
Test run of
ac387a1af03b187fe6ca7bf330ff7085549d0230on AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain18c105alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 691 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 651 passed, 0 failed, 21 ignoredSKIPPED;graphics_jobs_dequeue_ahead_of_queued_compute_jobsandworker_pool_prioritizes_graphics_pipeline_over_queued_computepass.Review: The two-lane queue is strict priority: while graphics jobs keep arriving, queued compute jobs wait. That cannot hang, since a bind that needs a compute pipeline runs its job itself in
resolve_waitwhen no worker has started it, but under a steady stream of graphics pipelines the compute ones are then built on the binding thread rather than in the background. Worth knowing; not a blocker.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@thehollowedone on GitHub · 2026-11-24 03:07 UTC · original
Tested
I ran the same synthetic D3D12 fixture on
mainatdd2ae9aand that revision with onlyac387a1applied. A gate held the sole pipeline worker while the fixture queued a compute job first and a graphics job second. Each job built a native pipeline, submitted work, and read back the result.cargo test --offline --locked -p xcl --test gpu_queue_check -- --nocapture --test-threads=1ran the scratch fixture withXCL_DXC_THREADS=1andXCL_ADAPTER=3080 Ti. Each revision passed 1/1 with no skips. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug.Not tested
Sustained or multi-worker queue pressure, D3D12 debug-layer messages, and retail loading.
AI use
Codex with GPT-6.2 Sol wrote the scratch fixture, ran the tests, and drafted this report.
@mastrr9 on GitHub · 2026-11-24 05:05 UTC · original
Independent NVIDIA RTX 5080 build/test run and code review at head
766b661235289f8c76b2a4169b046927fa3e8355.Code Review
WorkQueuesplit (gfxdrained ahead ofcompute) under a singleMutex+Condvar, with deterministic unit tests covering both queue ordering and worker-pool prioritization. No issues found.Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974),rustc 1.100.0 (0ef1bc386 2026-11-09), debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4ok):hle::d3d12x::pso_async::tests::graphics_jobs_dequeue_ahead_of_queued_compute_jobshle::d3d12x::pso_async::tests::worker_pool_prioritizes_graphics_pipeline_over_queued_computehle::d3d12x::pso_async::used_tests::*tests.gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)test_title_draws_with_a_root_signature_under_the_debug_layer(no d3d12SDKLayers.dll)uploads_start_from_each_subresources_state(no D3D12 debug layer (0x887A002D))Not tested
AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.
@raylitebull on GitHub · 2026-11-24 10:39 UTC · original
Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (
Build and test+PR description). The two-lane graphics-priority queue inpso_asynccleanly prevents graphics builds from stalling behind compute backlog. Recommend merging, @ivall (small heads-up: check #690's preloadqueue()call on currentmain— it will need updating toenqueue()on merge).@brainhay5 on GitHub · 2026-11-24 12:58 UTC · original
Does not build when merged onto current
main47efa2e(merge itself is clean, one file,pso_async.rs):Looks like a rebase is needed — the call this PR adds does not resolve against what
pso_async.rshas on main now.For context on why it matters to this title: on
47efa2ethe async PSO pool never drains. XCL's overlay shows0 running, 3 done, 57516 pipelines queuedat 95 s with a black screen, andxcl-pso-5…xcl-pso-14are all blocked in a wait. So anything that gets those workers moving is on the critical path for GTA VI.AI use: OpenCode, DeepSeek V4.1 Flash 1017.
@thehollowedone on GitHub · 2026-11-24 13:01 UTC · original
I verified the caller update on a local, uncommitted merge of
766b661onto47efa2e. The unresolved call is inresolve_within, the bounded wait path. Replacinglet _ = queue().lock().unwrap().send(p.clone());withenqueue(p.clone());changedcargo check --offline --locked -p xcl --libfrom E0425 to pass.With the fix,
cargo test --offline --locked -p xcl --lib pso_async -- --test-threads=1passed 6/6. That includes a scratch fixture that occupied the worker pool, called the bounded wait twice on a lazy compute pipeline, then queued a graphics job. Both waits returned the stand-in. When one worker was released, it ran graphics first, then compute, once each. The fixture also passed three isolated runs with the filterscratch_bounded_bind_enqueues_compute_behind_graphics.Windows 11 build 26300, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. This check covers worker scheduling with synthetic jobs. Driver compile time and retail world loading remain untested here.
AI-assisted. Codex (GPT-6, exact variant unavailable) tested the caller change and drafted this follow-up.
@JJAutoCompare on GitHub · 2026-11-25 06:36 UTC · original
Empirical test report (
766b6612)Hardware / environment
766b661235, Windows x64 build 10.0.26200.9974, AMD Ryzen 7 3800X 8-Core Processor.Commands and results
cargo test --workspace --no-run— exit 0. Built the workspace test executables in 53.63 s. Cargo emitted a deprecation warning for fetch_update in XGameRuntime. This command runs zero tests.Observed behavior
The queue test verified that graphics jobs dequeue ahead of earlier compute jobs and that jobs retain submission order within each class. The worker-pool test occupied every worker with a synthetic job, queued a compute job followed by a graphics job, and released one worker. The graphics job started first, and both jobs returned the expected synthetic pipeline handles. The PR adds two CPU-only tests.
Not tested
Full GPU workspace suite and game smoke runs omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr628-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 12:43 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@jacksonslab on GitHub · 2026-11-25 14:35 UTC · original
Data point from a retail title (GTA VI 1.0.2.1, Series X profile, 12 GB NVIDIA) supporting this change, plus one case it leaves open.
Measured. Bind waits are bounded (
XCL_PSO_WAIT_MS=50,XCL_GRAPHICS_PSO_WAIT_MS=300). In one session, 785 of 1,025 bind timeouts were for pipelines still queued for a worker, not still building. That is the head-of-line blocking this PR describes.What #628 leaves open: compute behind compute. The title also queues about 160–240 giant compute programs (1.0–1.8 MB of DXIL, several seconds each in the driver). Within the compute lane, these still hold up ordinary compute pipelines queued behind them. Locally I gave slow compute builds their own set of workers (
xcl-pso-slow-*), so other compute builds don't wait behind them. With that, skipped draws dropped to 8 of about 524k in a 600 s session.The local version chose the slow lane from recorded build times, a journal that upstream does not have. A version for upstream main, selecting by console code size (
effects::BIG_CODE, 16 KiB), builds and passes thepso_asynctests, but I have not run it on a GPU. It probably fits best as a third lane on top of yourWorkQueue, not as a separate PR. Happy to rebase it onto this branch if that is useful.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.