D3D12.X: add opt-in gameplay graphics PSO frame budget, scale workers, and log slow compile hashes #2988
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!2988
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2988"
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?
@Saksukella on GitHub · 2026-11-27 07:41 UTC · original
Saksukella:perf/pso-dynamic-frame-budget→amd-dev· +177 −29 · 2 files · 2 commits · openIntroduces a dynamic boot-to-gameplay graphics PSO frame wait budget, scales default PSO compile worker threads on high-core / high-RAM hosts, and logs shader record hashes for slow driver compiles (
>= 500 ms).Motivation & summary of changes
On AMD RDNA 4 (RX 9070 XT), world entry hits hundreds of uncached 3D graphics PSOs. Because
DEFAULT_FRAME_BUDGET_MSwas12,000 msacross all frames, a single 3D gameplay frame hitting 10–13 unready graphics PSOs stalled the title thread for 5–6.5 seconds per frame (237.8 s total in a 240 s run) before falling back to stand-ins anyway. Meanwhile,pso_worker_threads()remained capped at 6 even on 16–24 thread / 32+ GiB systems, and slow driver compiles (>= 500 ms) did not log the shader record hash withoutXCL_PSO_TRACE=1.crates/xcl/src/hle/d3d12x/pso_async.rs):FrameBudgetPolicy::{Explicit, Dynamic}withGAMEPLAY_FRAME_BUDGET_MS = 32starting atGAMEPLAY_FRAME_BUDGET_START_FRAME = 60.frame < 60) keep the existing12,000 msbudget; once active rendering is flowing (frame >= 60), graphics PSO bind waits cap at32 ms/framewhile background workers finish compiling them in parallel.XCL_PSO_FRAME_BUDGET_MS(orXCL_GFX_PSO_FRAME_BUDGET_MS) always overrides uniformly across all frames.p.compute == true/wait_for_submit) are completely untouched (fcap = None).crates/xcl/src/hle/d3d12x/pso_async.rs):pso_worker_threads_for(logical_cpus, total_ram_gib): hosts with< 16logical CPUs or< 24 GiBRAM keep the existing2..=6cap; hosts with>= 16CPUs and>= 24 GiBRAM scale to(logical_cpus / 2).clamp(6, 10)(protected by81c04142commit-headroom gating). ExplicitXCL_PSO_THREADS/XCL_DXC_THREADSalways override.crates/xcl/src/hle/d3d12x/real.rs):driver_compile_identifiednow logs any compile>= 500 mswith its 64-bitrecordhash and driver blob status without requiringXCL_PSO_TRACE=1, andfinish_two_passsupplies the two-pass console shader hash on all 3 call sites.Tested
amd-dev(bf7c82ee+dd0b65f1,--test-threads=1, 0 new warnings):cargo test -p xcl --lib pso_async -- --test-threads=1:38 passed; 0 failed, including new pure-CPU unit tests:dynamic_frame_budget_transitions_after_boot_and_honors_explicit_overridepso_worker_threads_scales_with_cpus_and_ramcargo test -p xcl --lib big_compile -- --test-threads=1:15 passed(1 pre-existing unrelated failuregiant_driver_compiles_have_their_own_laneonbf7c82eebase).Not tested
< 16logical CPUs or< 24 GiBRAM (verified viapso_worker_threads_scales_with_cpus_and_ramunit test).Regression run
Baseline (
main,b49be183):This PR (
dd0b65f1onamd-devbf7c82ee):AI use
@thehollowedone on GitHub · 2026-11-27 08:09 UTC · original
Independent check of #2988 head
dd0b65f1against its exact parentbf7c82eeon Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC:cargo test --offline --locked -j 4 -p xcl --lib pso_async -- --test-threads=1on head: 38 passed, 0 failed, 0 ignored. These are policy/queue tests, not GPU coverage.XCL_SAMPLE_RPFset to my locally owned shader pack andXCL_REQUIRE_GPU=1,cargo test --offline --locked -j 4 -p xcl --test gpu_pso_e2e -- --test-threads=1on head: 3 passed, 4 failed, 0 ignored. The exact parent gives the same 3/4/0 result and the same failing test names. Three mesh pairs report “PSO without a compute pass”; later tests also hit the shared PSO-count assertion. An isolated VS/PS draw reads clear color at pixel (25,17) on both revisions. I cannot attribute these NVIDIA failures to this PR. No title executable was run.One policy point:
resolve_wait_foruses the count of successfulPresentcalls, andframe_budget_forswitches the default from 12 s to 32 ms at count 60. Menu and loading presents count too; at 30 FPS the threshold is reached about two seconds after the first presentation, even if world loading is still ahead. The new unit test proves the numeric threshold, but not the described boot/menu-to-gameplay transition. If the 12 s budget must protect loading menus, the 32 ms default needs an explicit phase signal; until then, an opt-in budget is the bounded option. A regression should present more than 60 loading/menu frames, bind a cold graphics PSO, and verify the intended wait while producer compute remains uncapped. If 60 presents is intentionally just a responsiveness heuristic, the description and a measured visual-correctness run should say so.Not tested: full workspace suite, Intel/AMD hardware, or a paired title smoke run. AI use: Codex (GPT-6.2 Sol) ran the exact-head and exact-parent tests and traced the frame counter; Codex (GPT-6.2 Astra) reviewed the attribution and wait policy.
D3D12.X: use dynamic gameplay graphics PSO frame budget, scale workers, and log slow compile hashesto D3D12.X: add opt-in gameplay graphics PSO frame budget, scale workers, and log slow compile hashes@thehollowedone on GitHub · 2026-11-27 08:34 UTC · original
Follow-up to my earlier NVIDIA report: I isolated the two pack-backed failures on the exact
amd-devparentbf7c82ee, so they should not be read as mesh translation failures introduced by #2988.On Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC, with
XCL_SAMPLE_RPFset to my locally owned shader pack andXCL_REQUIRE_GPU=1, I ran each test in a separate process usingcargo test --offline --locked -j 4 -p xcl --test gpu_pso_e2e <test> -- --exact --nocapture --test-threads=1:retail_vs_ps_through_the_pso_hook_render_and_read_back: 1 passed, 0 failed, 0 ignored withXCL_HEAP_WINDOWS=0on the parent. The parent defaults heap windows on. #1743 already addresses the graphics test runner's missing heap-window descriptors; this result supports handling that through the existing PR.retail_mesh_pipelines_through_the_hook: 1 passed, 0 failed, 0 ignored, 7/7 MS+PS pairs withXCL_PSO_FRAME_BUDGET_MS=offon the parent (heap windows left at their default). With the default 12-second per-frame cap, later pairs instead receive stand-ins and the test reports missing compute passes. This synthetic test creates seven PSOs before anyPresent, so they share frame 0's budget. Disabling heap windows did not fix it: 0 passed, 1 failed, 0 ignored, 2/7 pairs.main83b00818, with its default settings, each isolated test passed (1/0/0; mesh 7/7).mainandamd-devhave diverged, so this is a baseline comparison, not an attribution to #2988.The mesh test should give each synthetic PSO its own frame budget or explicitly disable the frame cap while measuring translation. That would distinguish a stand-in from an actual failure to build the two-pass PSO. No title executable was run; no full workspace suite or paired smoke run was done in this follow-up. AI use: Codex (GPT-6.2 Sol) traced the wait path and ran these GPU tests.
@Saksukella on GitHub · 2026-11-27 08:34 UTC · original
Thanks @thehollowedone for the thorough check and great policy catch!
You're right that switching from 12 s to 32 ms at Present count 60 triggers during menu/loading screens and can skip cold graphics PSOs on world entry. Pushed an update keeping the default graphics frame budget at \12_000 ms\ (identical to \md-dev, zero premature draw skips), while making \XCL_GFX_PSO_FRAME_BUDGET_MS\ strictly opt-in (caps graphics-only bind waits from frame 60 onward while leaving producer compute uncapped, with \XCL_PSO_FRAME_BUDGET_MS\ overriding all frames). High-core/high-RAM worker scaling (\6 -> 10\ on >=16T / >=24GiB) and >= 500 ms\ slow-compile shader record hash logging remain enabled by default. Updated \rame_budget_keeps_default_12s_and_honors_opt_in_gfx_and_explicit_overrides\ (\38/38\ passed in \pso_async).
@fromthemoonx on GitHub · 2026-11-27 08:41 UTC · original
Full suite on NVIDIA (listed under Not tested) on the new head
6f5e03c: no new failure compared withamd-devitself. Every failure here also fails onbf7c82e, or is a parallel-only flake that passes alone on both.Tested:
6f5e03c(its base is currentamd-devbf7c82e, so head = merged), andbf7c82eitself for comparison. RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X (16 threads), 16 GB RAM (GlobalMemoryStatusExreads 15 GiB, so this host keeps the old2..=6worker cap and does not reach the new scaling), Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.cargo test --workspace --no-fail-fast -- --test-threads=4,6f5e03cSKIPPEDlines, the same 6 as onbf7c82e--test-threads=4, 2 more runs on6f5e03c/ 7 runs onbf7c82ethread 'xcl-pso-0' panicked at … windows-core-0.62.2\src\interface.rs:41:18: null reference produced/non-unwinding panic. aborting., whichbf7c82edoes too (in 2 of its 7 runs, plus 1 segfault)6f5e03c, compared withbf7c82ebf7c82etoo (e.g. the 3e2etitle tests,giant_driver_compiles_have_their_own_lane)compositor_releases_root_sig_and_rejects_invalid_planes(psos_for leaked root_sig COM refs)bf7c82etoo (1 of 7, same assertion)hle::kernelx::guards::tests::writes_from_many_threads_are_all_caught_and_kept(guards.rs:411, caught pages differ)bf7c82eruns that reached it; alone, 10 of 10 on both. This PR does not touchguards.rs, so this looks like a parallel-only flakehle::d3d12x::pso_async::(38 tests),--test-threads=8From reading:
total_physical_ram_gibrounds down (ullTotalPhys >> 30), and Windows reports a little less than the installed size (16 GB reads as 15 here). So a 24 GB machine would likely read 23 and stay on the old cap. If 24 GB hosts are meant to scale, the threshold could compare in MiB, or use 23.Not tested: a title on NVIDIA with this branch, a 24 GB+ host with 16+ threads (the new worker scaling), a release build, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@ettehn on GitHub · 2026-11-27 10:33 UTC · original
I compared parent
bf7c82ee1b2685bb40417e09c4128177aa68d719and head6f5e03cf268b24e716b3f3438ae0bf435b7deb4bwith a standalone probe of the extracted Rust functions (Rust 1.97.1 MSVC). On this Windows host, Rust sees 32 logical CPUs andGlobalMemoryStatusExreports 31.8 GiB usable RAM. Each environment case ran in a fresh process.XCL_PSO_THREADS=3withXCL_DXC_THREADS=9still selects 3. One edge case isXCL_DXC_THREADS=0with no positive PSO override: the parent falls through todxc::compile_threads()and selects 2, while the head takes the hardware default and selects 10.console, andtwo_pass_recordhashes the first nonempty entry. With the same synthetic VS and two different GS inputs, both selecte92c55e701afdc98despite different GS hashes. If therecordfield is meant to identify the shader responsible for the GS pass, consider logging the GS hash or stage-qualified VS/GS hashes. The MS caller already selects MS. This concerns the diagnostic field only.The probe verifies policy output and record selection. It did not start PSO workers or run a driver compile or a title. AI use: OpenAI Codex (GPT-6) prepared and ran the probe and drafted this report.
@oni-swr on GitHub · 2026-11-27 10:37 UTC · original
RDNA3 data at gameplay frames for #2988, taken at the old head
dd0b65f1(32 ms graphics budget on by default): 4 runs, the ~90 s presenting stop does not move. The new head6f5e03cfmakes the budget opt-in, so this is the default-on variant only; I have not run6f5e03cf.Setup: RX 7800 XT 16 GB (RDNA3), driver 32.0.31035.1003, Ryzen 7 5700X3D (16 logical CPUs), 64 GB, Windows 11 build 26200, DXC 1.8.2502.11, release builds of the unmodified commits
bf7c82ee(base, its exact parent) anddd0b65f1, the same retail title.XCL_PREPARE=0 XCL_NETWORK=0 XCL_ACTIVITY=1, noXCL_PSO_*set, A pressed every 8 s, 300 s runs, each on a fresh copy of the same warm shader cache and profile, interleaved base / PR / base / PR. The 16 CPUs and 64 GB put this host in the worker-scaling branch (8 workers by the formula in the description, instead of 6; I did not check the thread count in the log).5fbd90f9on one cache copy), the third run spent ~1,650 s of summed wait time in graphics pipeline waits at the default 12 s and ~70 s in compute waits, and its presents crept back from ~120 s (2-4 per 30 s, 13-35 per 30 s in the last 90 s). That is the regime where the opt-in budget could matter; I did not run it withXCL_GFX_PSO_FRAME_BUDGET_MS=32.Not tested:
6f5e03cf, the opt-in budget, a cold cache, more than 2 runs per tree, whether skipped graphics draws changed what is on screen.AI use: Claude Code (Claude Sonnet 5.5) built the trees, ran the title, read the logs and wrote this comment. Every number comes from those runs.
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.