Repository navigation
D3D12.X: bound driver PSO compile concurrency and surface stage progress (#156) - #214
heretic1321 wants to merge 1 commit into
Conversation
01d686b to
bf2a27e
Compare
Tested on Windows + NVIDIA (RTX 4090)The PR says it was never built or run on Windows, so here is a Windows / NVIDIA run. No retail game here, so the measurement plan above (thread dumps, Setup: Windows 11, i7-13700KF, RTX 4090 (driver 32.0.16.2101, wave32 only), Rust 1.100 MSVC, Agility SDK 1.620.2, Windows SDK DXC 1.8.2502 (and DXC 1.9.2609 for E2).
E2 (
On this NVIDIA card the DXC step dominates, not the driver: the heap windows cut DXC ~12× and the driver's one cold compile ~6× against the One thing from reading the code (not measured – no game)Title-thread compiles now wait on the background slots. Before this PR only Minor: AI-assisted (GitHub Copilot); runs and numbers are from my machine. |
|
Tested on an RTX 5070 Ti, merged onto What it fixes, shown on
Notes:
E2 (from #187) at 700 blocks / 19,601 instructions. Each cell is DXIL bytes, median DXC seconds, and the range of three driver times in seconds:
Tested
Not tested
🤖 GPT-6.2 Astra, Claude Opus 5.5 |
Part of ivall#232. The null write at title+0x2215c35 is the retail game's hang watchdog (`mov dword [0], 0`, identified in ivall#156), not a bad pointer from the layer: it fires when one of the title's threads stays silent for long (~30 s per ivall#214). With lazy pipelines a graphics pipeline is sent to the workers at its first SetPipelineState (`resolve_for_bind` -> `resolve`), and then `bind::graphics_bound` / `execute_indirect` call `resolve_wait`: that waits for the build without any limit, and runs it in the title's own thread when no worker has taken it yet. An NVIDIA driver takes 10-17 s for one big translated pixel shader (ivall#156 measurements), so a frame that binds a few new ones holds the title's thread past its watchdog. Now a draw sends the build to the workers and waits at most what is left of 4 s between two presents (`XCL_PSO_WAIT_MS`, 0 = no limit as before). Past it the draw uses the stand-in (draws nothing), logged per pipeline. Compute pipelines are still waited for as before. Every pipeline wait of 2 s or more is logged with the thread, so a run shows what held it. Assisted-by: Antigravity (Claude Opus 5.5)
bf2a27e to
f007d4a
Compare
f007d4a to
960162e
Compare
|
Ready for review at Review points, one by one
Still missing to merge: the two |
Collects the shader compile-time numbers published in issue ivall#156 and PRs ivall#187 and ivall#214 into one note, so they need not be derived again: driver time grows faster than DXIL size, the DXC version changes DXIL size (so a byte threshold is version-relative), the four-window switch form costs 12.5-15.5x DXC against one window with DXC 1.8/1.9 while the heap form (ivall#187) stays near one window, and only the cold driver run of a cell is a real compile. Every number is attributed to its author and thread; nothing was measured for this note. Assisted-by: Antigravity CLI (Claude Opus 5.5)
|
Test report on NVIDIA Ampere 8 GB, with the retail title from #156. Tested
Not tested
AI use
|
|
@heretic1321 this now conflicts with What it does
Tested
Not tested
Resolution (
|
|
A macOS/Wine check of this head, from the bench described in #258 (M5 Pro, 48 GB, CrossOver 26 + D3DMetal 3.0, DXC 1.9.2609, Wine, no Windows machine here) — and the reason I came: I had written the same fix you have here. I was preparing a patch for the window title's "N pipelines queued" figure, because What I ran on this host, on your head
If it is useful as this PR stands: I can also run your head against |
Collects the shader compile-time numbers published in issue ivall#156 and PRs ivall#187 and ivall#214 into one note, so they need not be derived again: driver time grows faster than DXIL size, the DXC version changes DXIL size (so a byte threshold is version-relative), the four-window switch form costs 12.5-15.5x DXC against one window with DXC 1.8/1.9 while the heap form (ivall#187) stays near one window, and only the cold driver run of a cell is a real compile. Every number is attributed to its author and thread; nothing was measured for this note. Assisted-by: Antigravity CLI (Claude Opus 5.5)
960162e to
8e32bea
Compare
|
Rebased cleanly onto Thank you @woreksami and @mikebuckets171 for the runs and detailed notes:
What is still needed to merge: a Windows |
Part of ivall#156. Bounds background driver pipeline compilation concurrency (1 big >= XCL_BIG_PSO_KB behind free-commit wait capped at 30 s, then 2 on wave32-only / 4 on wave64 via XCL_DRIVER_COMPILE_THREADS) across compute, graphics, MS, and GS paths while keeping title threads and xcl-pso-urgent exempt. Re-enters the guard on cold retry if a cached compute blob is rejected, fixes pso_async::counts() to exclude dormant lazy stand-ins, translates GS/fallback stream formats and topologies, and surfaces driver compile progress in the window title. Assisted-by: T3 Code / Antigravity (gemini-pro-orchestrator-neon)
8e32bea to
96e68a4
Compare
|
Rebased again onto
The |
|
Regression run of Against the limits in CONTRIBUTING.md: 101 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
Mitigation and stage instrumentation for #156, rebased as a single commit onto
upstream/main(47efa2e, head96e68a4). Incorporates@woreksami's tested conflict resolution against#516,#634/#636, and#690and fixes the rejected-cached-blob retry edge case.What is in it
crates/xcl/src/hle/d3d12x/real.rs:DriverCompileGuardbounding background (xcl-pso-*other thanxcl-pso-urgent, covering bothxcl-pso-Nand#690'sxcl-pso-pre-N) driverCreate*PipelineStateconcurrency across all translated paths (CSaround#634/#636's cached-blob lookup + retry,VS+PSaroundretry_without_rect_gs,MS-mesh/MS-cs,GS-mesh/GS-cs):BIG_COMPILES(1,>= XCL_BIG_PSO_KB, default256KiB) → 30 s-cappedwait_for_commit()→driver_compiles()(XCL_DRIVER_COMPILE_THREADS, default2on 32-lane-only / NVIDIA,4on 64-lane). Title threads andxcl-pso-urgentbypass both semaphores andwait_for_commit().finish_psorejects a cached compute blob (hr < 0 && cached.is_some()),guard.discard()drops the cached-size guard without incrementingDRIVER_COMPILING[1]or logging twice, andDriverCompileGuard::enterre-enters withdxil.len()before the cold retry so big shaders still respectBIG_COMPILESandwait_for_commit().driver_compile_counts(), admission + compile slow logging (>= 2 sorXCL_TRACE_PSO_TIME=1), console topology/RTV/DSV translation infallback_stream(subobjects14/15/16) andtranslated_gs_pso, plus unit tests (big_compile_serialization_leaves_fast_lane_for_small_compiles,urgent_and_title_threads_are_exempt_from_background_slots).crates/xcl/src/hle/d3d12x/pso_async.rs:counts()via atomicQUEUED+mark_enqueued/finish_pending/enqueueexcluding dormant lazy stand-ins (preloadkeeps using#690's low-priority queue without inflatingQUEUED), plus isolated unit testdormant_lazy_pipelines_are_not_counted_as_queued.crates/xcl/src/hle/d3d12x/present.rs:upstream/main'sFPSwindow title (#516) and surfaces driver compile counts alongside DXC and queued counts (compiling shaders: N dxc, M done[, D driver (C done)][, Q pipelines queued][, F failed]).Overlaps
#567(boundswait_for_committo 5 s vs our 30 s cap).#267,#533,#891(bound title-thread wait durations; orthogonal to bounding worker driver compile concurrency).#628(prioritizes graphics over compute inpso_async's worker queue).Tested
1.95.0, head96e68a4onupstream/main47efa2e:AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace --target x86_64-pc-windows-msvc— exit 0 (13.14s, 0 errors, 0 warnings).AR_x86_64_pc_windows_msvc=llvm-ar cargo check --tests --workspace --target x86_64-pc-windows-msvc— exit 0 (8.48s, 0 errors, 0 warnings).python3 scripts/pr_check.py --localverified all required sections and asset/model checks (failing only on the missing Windowsxcl-smokeblocks).96e68a4):@woreksamitested960162eon Windows 11 + RTX 3060 8 GB (queue drained0 driver (18 done), retail title advanced to setup/loading) and tested a local conflict resolution ontomain6025201(cargo test --release -p xcl --lib: 666 passed, 0 failed, 21 ignored).@mikebuckets171tested960162eviax86_64-pc-windows-gnullvm/ Wine on macOS (dormant_lazy_pipelines_are_not_counted_as_queuedpassed).@yous0serious(RTX 4090) and@Kalmarv(RTX 5070 Ti) testedbf2a27e; review points from both were incorporated in960162eand retained here.Regression run
96e68a4(no Windows GPU host here; Windows testers are invited to runscripts/smoke.ps1onmainvs96e68a4).Not tested
lld-link/link.exe),cargo test --workspaceexecution, GPU tests, AMD / Intel hardware, andscripts/smoke.ps1/ retail title runs on96e68a4.AI use
T3 Code / Antigravity, Orchestrator (Neon) / gemini-pro-orchestrator-neon: rebased ontoupstream/main(47efa2e), applied conflict resolution, addedDriverCompileGuard::discard()for rejected-cached-blob retries, and ran Linux-to-x86_64-pc-windows-msvccargo checkandscripts/pr_check.py --local.