Shaders: speed up translated pipeline compiles and add PSO measurements #1524
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!1524
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1524/head"
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?
@bmjask on GitHub · 2026-11-24 17:16 UTC · original
bmjask:perf/pso-runtime-eval→main· +664 −30 · 7 files · 8 commits · merged 2026-11-24 19:57 UTCLarge translated pipelines can spend substantial CPU time and commit inside the driver compiler. Runtime-indexed vectors also inflate generated DXIL, while unconstrained background compiles compete with each other. This PR:
What is in it
Recompiler: avoid dynamic vector indices in format helperschanges the generated HLSL helpers and extends typed-format GPU coverage.D3D12.X: limit concurrent huge pipeline compilesadds size-based background compile lanes, cache-retry handling, logging, tests, and documented environment controls. Pipelines of 4 MiB or more get their own one-wide lane, which can run next to the ordinary slot. Every gated compile still needs 3 GB of commit free.Shaders: export and measure exact compute pipelinesadds strict record-hash selection, deterministic HLSL export, cache-disabled driver timing, tests, and CLI documentation.D3D12.X: identify driver compiles in the PSO logandREADME: …add numbereddriver compile start/finish #Klines.XCL_PSO_TRACE=1logs every compile.D3D12.X: log the record hash and time only the driver's compile(review fixes):record HASH, the hash--measure-pso/--record-hashtake).Shaders: fix --export-hlsl / --measure-pso review findings:XCL_HEAP_WINDOWSis honoured.mainc160d86(#1426, direct DXIL).pso.rskeeps both features.--measure-psomeasures the default HLSL path, notXCL_DIRECT_DXIL.Performance evidence (third-party; not repeated on NVIDIA)
--measure-pso --repeat 2,3a06645with vs without9f65f95(comment of 18:13Z):CS_RTShadowTrace32TemporalHQCS_RaytracingResolveCSComputeSkinningPedVelocityCS_ShadowRenderTiledCascades/…ParaboloidShadows9e3831evsee7f2f3, 2 runs each: all four runs ended in the+0x23cf683watchdog about 29 s after the last frame. No watchdog improvement is claimed. The builds in flight there are mid-size non-RT compute that commit 1 does not change. A second load was not reached.--measure-psotimings.Tested
x86_64-pc-windows-msvc; debug tests and release smoke builds.4143a09,cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 870 passed, 0 failed, 42 ignored. SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)title_textures,vram(twoPoisonErrorfollow-ons) andpso_async. All 4 passed alone, and the suite was clean on the rerun.big_compile_tests,shaders::tests, anda_stream_counts_referenced_shader_code_not_its_descriptors, 15 passed. These include new tests for the gate label, a flag without its value, single-file export and non-compute skipping.ee7f2f3(786 passed), and @RodrigoTorreao on an RX 6750 XT at3a06645(783 passed; 3 failed, all the known RDNA2 packed-mip readback).git diff --check c160d86...4143a09: clean.Regression run
Main and PR ran back to back under the shared smoke lock on an otherwise idle machine, with
XCL_PRESS_A_AT=10,15,20,25,30,40(A pressed at those seconds) for both. Main is9e3831e; the release build ofc160d86was not available. That means this PR's numbers also include #1426.main:
PR:
PR / main: 100.6 % of frames, 103.5 % of peak commit.
Not tested
3a06645by @RodrigoTorreao).AI use
main, reviewed the diff, and ran the first validation.main;@pickles976 on GitHub · 2026-11-24 17:20 UTC · original
Verdict from the DXC/PSO lane — this is potentially the most watchdog-relevant PR of the wave, and it is currently unreviewable on purpose: the template body is empty, and for a perf PR the numbers are the whole argument. What #534 proved tonight is that cold-translation time during loads is a direct watchdog input (warm cache + preload cleared load 1; cache misses in load 2 got killed), so "build 64 pipelines at once with a serial lane for ≥ 4 MiB giants" is precisely the right shape of fix — but the thread needs: ① the
--measure-psobefore/after table, cold and warm, on a known-heavy title corpus (aggregate build-seconds per load, not just a few samples — the campaign has the corpus); ② the one field that matters most: does 64-wide building bring a cold second-load inside the watchdog budget (an actual+0x23cf683A/B with the PR vs without — @RodrigoTorreao @RockFellerX have the calibration rig for it); ③ rationale for the 4 MiB giant lane (driver serialization at large DXIL? that connects straight to #1526: -O0 artifacts were ~2× size and would land in this lane far more often — the two PRs interact on exactly those shaders). Positives worth keeping in the changelog either way: folding the memory-window count into the translation-cache keys is the device-scoping fix my #1472 review asked for on the negative side arriving on the positive side — worth stating explicitly so the two reviews land on one invariant ("cache entries are device/policy-scoped, not just content-scoped"); and a measurement mode (--measure-pso --repeat) shipping in the tool is the community being able to re-verify claims without a title run.@gsucristo on GitHub · 2026-11-24 17:57 UTC · original
Reviewed
3a06645against base9e3831e. Commit 1 (emit.rs) is clean and semantically sound, but Commits 2 (real.rs) and 3 (shaders.rs) have several concrete bugs that should be fixed before merge (and splitting the three independent changes into separate PRs would make review and benchmarking much cleaner).Commit 1 (
9f65f95—emit.rs,tests.rs)pick4/or_at4(emit.rs:5274–5280),bvh_intersect(emit.rs:5354–5358), and the addedBUFFER_LOAD_FORMAT_XYZW/BUFFER_STORE_FORMAT_XYZWGPU test (tests.rs:1513–1514, 1577, 1582) look semantically equivalent on all valid inputs and strictly safer on OOB indices.emit.rsis inTRANSLATOR_SOURCES(build.rs:14), this invalidates translated/DXIL/driver caches for all users. A before/after DXIL size and cold compile-time comparison on a few large compute shaders would help justify the churn (the 60 s regression run also shows1313frames on PR vs1571onmainwithout explanation).Commit 2 (
724b9e2—real.rs,README.md)started.elapsed()(real.rs:3787–3822):let started = Instant::now()sits atreal.rs:3787beforedriver_compilewaits inbig_compile_turn(onmain,_slotwas acquired beforestarted).driver_cache::keep(p, &b, started.elapsed())(real.rs:3802,KEEP = 250 ms) and thecompute PSO with the translated console CS (... ms)log (real.rs:3817–3822) now include semaphore/commit wait time — a fast compile that waited ≥ 250 ms for a slot gets written todriver_cacheas slow. Returning or passing the inner compile duration fromdriver_compilefixes this cleanly.small_and_title_thread_compiles_bypass_the_gate(real.rs:3705–3719):held(real.rs:3709) only saturates&BIG_COMPILES, while line3716callsdriver_compile("test", usize::MAX / 2, true, || 8). Becauseusize::MAX / 2 >= GIANT_DRIVER_COMPILE(4 MiB),compile_slots(...)routes to&GIANT_COMPILES(0/1 held), so line3716passes even if the title-thread bypass were broken.3712hardcodesbytes = 16, which deadlocks ifcargo testruns withXCL_HUGE_PSO_BYTES <= 16.the_concurrency_limit_holds_and_all_finish(real.rs:3693, 3701) assertsPEAK == 2relying on a 20 ms sleep, which can flake under heavy load (a 2-threadBarriermakes it deterministic).GIANT_COMPILES+BIG_COMPILESsemaphores can raise peak memory (real.rs:3548–3554):GIANT_COMPILES(>= 4 MiB, 1-wide) separate fromBIG_COMPILES(default = 1,max = 64) prevents a giant shader from starving the ordinary lane, but allows a>= 4 MiBgiant compile to overlap concurrently withXCL_HUGE_PSO_CONCURRENCYbig compiles (2 concurrent by default vs 1 onmain), increasing peak commit when a giant shader hits. (Also, ifXCL_HUGE_PSO_BYTES > 4 MiB,BIG_COMPILESbecomes unreachable.)StreamOut::shader_bytesedge case:if huge || bytes >= huge_pso_bytes()(real.rs:3566) is redundant (hugealready requiresbytes >= huge_pso_bytes()) and logs on every>= 256 KBcompute PSO including warmdriver_cachehits, duplicatingreal.rs:3817–3822.finish_two_pass(real.rs:4680–4700) passes combinedbytes = stream.shader_bytes() + tp.cs.len()into the mesh pass'sdriver_compile(real.rs:4687), double-countingtp.cs.len()(which is logged again atreal.rs:4698), and emits up to 3 INFO lines per two-pass PSO (two-pass ... gatedplus twoungated herelines, which also diverges fromREADME.md:135–136).StreamOut::shader_bytes()(real.rs:4600–4617) silently returns0ifstream_subobjectsencounters a subobject type unknown tonull::subobject_payload. Accumulatingshader_bytesdirectly inStreamOut::shader()avoids re-parsing and the silent-zero fallback.Commit 3 (
3a06645—shaders.rs,pso.rs,main.rs,README.md)ID3D12RootSignatureCOM leak inmeasure_pso(shaders.rs:924–953):desc.pRootSignature = ManuallyDrop::new(Some(rs))is never released viaManuallyDrop::into_inner(...)on either normal return or the earlyErr(e) => return 2exit atshaders.rs:938(comparePipelines::makeatshaders.rs:1057).pso_measurement_compiles_an_exact_synthetic_recordbreakscargo testwithout Developer Mode, under Wine/vkd3d-proton, without DXC, or on WARP (shaders.rs:905–916, 1547–1563):ID3D12Device9::ShaderCacheControl(..., DISABLE)requires Windows Developer Mode (E_ACCESSDENIEDwithout it) and is currently stubbed asE_NOTIMPLinvkd3d-proton. The test unconditionally assertsmeasure_pso(...) == 0instead of skipping when cache control is unavailable.wave64_supported(): it does not checkrecomp::dxc::location(), and underXCL_ADAPTER=warp,wave64_supported()succeeds via WARP whilePipelines::new()(adapter::candidates) fails.measure_pso(shaders.rs:889–916),console_translationanddxc::compilerun before checkingID3D12Device9::ShaderCacheControl, wasting tens of seconds on large shaders before failing fast when cache control is unavailable.export_hlslflags every non-compute record in an archive as a failure (shaders.rs:827–831), and keeps scanning after a--record-hashfailure (shaders.rs:827–848):--record-hashisNone, every VS/PS/MS/GS record encountered before reachingcountincrementsfailuresand printsnot a console compute shaderto stderr; non-compute records should be silently skipped unless explicitly requested by--record-hash.--record-hashisSomeand the matched record fails (!is_compute_container,console_hlslerror, or write error), the branchescontinueinstead ofbreaking, scanning all remaining records in the pack.--export-hlsland--measure-pso(shaders.rs:711–715):elsebranch and returnsprint(path, "single file", ...)before lines717(--export-hlsl) and736(--measure-pso), contradictingmain.rs:32–40(the unit tests bypassedrun()viaInput::Files).--export-hlsland--measure-psoignoreXCL_HEAP_WINDOWS=1(#680) (shaders.rs:731, 748):--precompile(shaders.rs:756–757), neither ORsrecomp::HEAP_WINDOWSwhenrecomp::pso::heap_windows()is active, so both translate/measure the switch form instead of the exact runtime form underXCL_HEAP_WINDOWS=1. (Noteexport_hlslline856also prints{windows} windowsunmasked, so it would needwindows & !recomp::HEAP_WINDOWSlikeprecompile.)shaders.rs:682–683, 717–751):--export-hlsl,--measure-pso, or--record-hashmakevalue()returnNoneand silently fall through instead of erroring.--export-hlsl --record-hash DEADBEEFcreates./--record-hash/).(AI use: reviewed with AI assistance — findings independently verified against commit
3a06645.)@bmjask on GitHub · 2026-11-24 17:57 UTC · original
Status update (head
ee7f2f3, up to date withmain9e3831e):D3D12.X: identify driver compiles in the PSO log: large driver compiles now log numbered start/finish lines with the compute program hash and whether a driver blob was supplied, so a slow compile seen in a title log can be fed straight to--measure-pso HEX.XCL_PSO_TRACE=1logs every compile. README updated.@pickles976, on your review: the description was filled in before your comment, and some of what you describe is not in this PR. It has no 64-wide build and no change to the translation-cache keys (the memory-window/heap-window work was left out). To your points:
--export-hlsl,--measure-pso --repeat) to measure one. I have not run a before/after over a large external corpus. That is listed under Not tested and I won't state numbers I haven't measured.XCL_HUGE_PSO_CONCURRENCYcan raise that limit, and the separate one-wide lane makes sure the rare >= 4 MiB programs (each ~1.5 GB of driver commit) never run alongside each other or take the ordinary slot. On the interaction with #1526: larger -O0 DXIL would land in these lanes more often. That only bounds concurrency; it doesn't change results.@RodrigoTorreao on GitHub · 2026-11-24 18:13 UTC · original
Test report on AMD (RDNA2, Windows driver) for
3a06645, unmodified. This PR's Not tested lists AMD.These are the cache-off before/after numbers @gsucristo asked for to justify commit 1 (DXIL size and cold compile time on a few large compute shaders), and part ① of @pickles976's ask. The head has moved to
ee7f2f3since. Its two new commits only add PSO log lines inreal.rsand README text, with no change undergpu/recomp/, so the DXIL and timings below apply to it unchanged. The suite was run on3a06645, not re-run onee7f2f3.Short version: on this driver,
9f65f95(no dynamic vector indices in the format and BVH helpers) makes the ray-tracing compute pipelines much cheaper to build. The heaviest one I measured goes from 230 s to 63 s inCreateComputePipelineStatewith the cache off. Programs without those helpers do not change beyond noise.Tested
XCL_DXC_DIR3a06645. "Before" is3a06645with9f65f95reverted locally, so both use the same--measure-pso. Neither of the other two commits changes the HLSL.main9e3831e's:ParaboloidShadowsis 363 460 B on both.xcl shaders <folder of 8 retail records> --measure-pso <hash> --repeat 2, with the cache disabled by the tool. Release build, 4 memory windows (switch form). Before and after alternated per program.CS_RTShadowTrace32TemporalHQ(36968699275efc8f)CS_RaytracingResolvecloth_default (fb110f51ccc8f375)CSComputeSkinningPedVelocity(5683ddcd01491067)CS_ScreenProbes_TraceRays_BVH_Shared_ShaderBinning(a2fba2f14aaaa761)CS_AmbientMapSky16(9d07f6b9e70856f3)ColorDownsampleCS(da0e539ea887f3fc)CS_ShadowRenderTiledCascades(1d6a161c9bb69ab0)CS_BatchCullMeshlets_ParaboloidShadows(1ada490879c33c0e)cargo test --workspace --no-fail-fast -- --test-threads=4(debug,XCL_SAMPLE_*set to the retail files): 783 passed, 3 failed, 41 ignored.placed_title_textures_share_vram_and_preserve_pixelsand twoPoisonErrorfollow-ons), fixed by #470 / #1028 and unrelated to this PR.heap_window_out_of_memory_falls_back_to_the_switch_form("no heap windows", the suite ran withoutXCL_HEAP_WINDOWS).XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e: 4 passed, 0 failed, including that test, on native wave64.Not tested
+0x23cf683, cold second load with and without this PR). That needs several title runs per side, because the set of programs a load builds changes from run to run here. I have not done it yet.724b9e2) in a title run, and the heap-window form for the timings above.AI use
xcl'sPSO …lines and the test output.@pickles976 on GitHub · 2026-11-24 18:21 UTC · original
RodrigoTorreao's numbers settle my measurement ask — and they deserve the arithmetic stated out loud, because this is the watchdog case in miniature: one ray-tracing compute pipeline taking 230 s cold is, by itself, larger than the entire observed watchdog budget band on cold runs (5 min deaths ≈ 300 s). A single helper pattern — dynamic vector indices in the format/BVH helpers — converting 230 s to 63 s is the strongest proof yet that cold translation latency is a real modulator of which runs die early, even though the fully-precompiled run (24,699 programs, xcl#662) proved latency is not the primary gate. Consequences for the queue: ① commit 1 is justified on AMD data even though the PR description said "Not tested: AMD" — third-party measurement is the right way to fix that label, and ② if RT compute pipelines are entered during world entry (they are for this title's ray grid), this one 230 s stall sits exactly where the watchdog fires — worth the author's confirmation of the phase these builds land in, because if they land inside the blocked window, the fix order changes: commit 1 before the cache work, not after. My policy-version-in-cache-key note stands regardless (it protects the 63 s from silently regressing to 230 s on a driver update).
@MatyEjsr on GitHub · 2026-11-24 18:25 UTC · original
Tested PR #1524 at head
ee7f2f36e03c6ca79fc4fbbe6a2ba5b1a7e92855on an NVIDIA RTX 3090 and reviewed the new commits4e310655andee7f2f36. The full test suite passes on this machine, and two concrete bugs turned up in4e310655.Tested
stable-x86_64-pc-windows-msvc), debug build, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0)cargo build --workspace -j 8: OK in 9.91 s (2 pre-existingfetch_updatedeprecation warnings)cargo test --workspace -j 8 -- --test-threads=8 --nocapture: 786 passed (including 5 SKIPPED), 0 failed, 41 ignoredgpu::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)heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)uploads_start_from_each_subresources_state(no D3D12 debug layer,0x887A002D)XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e heap_window_out_of_memory_falls_back_to_the_switch_form -- --nocapture: 1 passed, 0 failed, 0 ignoredpso_measurement_compiles_an_exact_synthetic_record: passed (3640 bytes DXIL, 16 ms DXC, 1 cache-off run(s), median 0.010 sin the full run;20 ms DXC, median 0.015 sstandalone)git diff --check 9e3831e...ee7f2f3: cleanFindings on
4e310655/ee7f2f36driver compile startand--measure-pso(crates/xcl/src/hle/d3d12x/real.rs:3790,3807,3821vscrates/xcl/src/shaders.rs:597,628):translated_compute_pso_oncelogskey.0, whichcompute_blob_key(real.rs:4035-4040) computes withDefaultHasherover translated&dxil.--measure-pso HEXand--export-hlsl --record-hash HEXlook upshader::fnv64(&blob)over the raw console shader container bytes (cs).driver compile startcannot match--measure-pso, contrary toREADME.md(ee7f2f36). Observed withXCL_PSO_TRACE=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture:crate::gpu::shader::fnv64(cs)(or both hashes clearly labeled) would make the log line match--measure-pso.XCL_PSO_TRACE=1labels small PSOs ashuge, ungated here(crates/xcl/src/hle/d3d12x/real.rs:3578-3586):_arm ofmatch (huge, slot.is_some())assumesbytes >= huge_pso_bytes(), tracing small compiles logshuge, ungated hereon non-huge PSOs (reproduced on both the 3,744 B compute PSO above and the 16 B compile insmall_and_title_thread_compiles_bypass_the_gate:driver compile finish #1: test PSO, 16 B DXIL, 0 ms, huge, ungated here (...)).XCL_PSO_TRACEis read viastd::env::varon every compile instead of cached in aOnceLocklikehuge_pso_bytes()/huge_pso_concurrency().724b9e2and3a06645(queue wait time included instarted.elapsed(),ManuallyDroproot-signature leak inmeasure_pso, un-skippedShaderCacheControltest when Developer Mode is off, single-file CLI path returning before--export-hlsl/--measure-pso) are still present unchanged atee7f2f36.Not tested
--measure-pso/--export-hlslon a large external shader corpus.AI use
@RodrigoTorreao on GitHub · 2026-11-24 18:32 UTC · original
@pickles976 on the phase question (18:21Z): on this machine, the ray-tracing builds were not inside the blocked window of a cold first world load. This is a cold watchdog A/B of
main9e3831eagainst this PR atee7f2f3, 2 runs each, interleaved. All four runs end in the+0x23cf683watchdog about 29 s after the last presented frame, with or without the PR. The builds in flight in that window are not ones commit 1 changes.Setup
xcl.exe(fresh AMD driver cache), a freshXCL_DXIL_CACHE(soused-pipelines.txtis empty and nothing is preloaded),XCL_PSO_DISK_CACHE=0,XCL_TRANSLATED_CACHE=0,XCL_NETWORK=0.XCL_HEAP_WINDOWS.mainand 13.4 / 12.6 s on the PR, unchanged by commit 1;driver compile start #48: compute PSO, 360932 B DXIL, hash 1c63f83c927fde2f, driver blob absent, still without a finish line when the title killed itself, 5 – 13 s later.mainlogs only finished builds, so whether the same program was in flight there is not visible.record … not foundwith--measure-psoon the retailshaders.rpf. That confirms on a title run what @MatyEjsr found above: the log carries aDefaultHasherkey over the DXIL, not the record'sfnv64.CS_RTShadowTrace32TemporalHQandCS_RaytracingResolvehold. On this first cold load, though, the watchdog is reached before those programs matter. What is in flight there is mid-size non-RT compute.Not tested
XCL_HEAP_WINDOWS=1, andXCL_HUGE_PSO_CONCURRENCYother than the default.AI use
xcl.log.@DavidM1911 on GitHub · 2026-11-24 18:58 UTC · original
Test report — RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: 1 failure (736 passed, 1 failed, 21 ignored):measure_psoreturns 2 becauseID3D12Device9::ShaderCacheControl(…, DISABLE)fails on this machine:0x887A002D = DXGI_ERROR_SDK_COMPONENT_MISSING — this driver/D3D12 runtime doesn't support disabling the shader cache. The new test hard-requires that call to succeed, so it fails on hardware where the feature is absent; it probably needs the same
skip_testtreatment as the wave64 check, ormeasure_psoshould tolerate the cache-control failure (a cache disable is best-effort for measurement anyway).@bmjask on GitHub · 2026-11-24 19:19 UTC · original
For anyone measuring this PR's pipeline times: a cold compile needs all three cache layers off or cleared. Otherwise a repeat run reuses earlier work and the numbers look far better than a first launch.
1. XCL's own caches (environment variables for the run):
XCL_TRANSLATED_CACHE=0: no on-disk translation cache (console shader → DXIL).XCL_PSO_DISK_CACHE=0: no on-disk pipeline cache.XCL_PSO_PRELOAD=0: no pipeline preloading at start-up.XCL_DXIL_CACHE=<empty dir>, instead of clearing%LOCALAPPDATA%\xcl\.2. The GPU driver's shader cache:
xcl.exeunder Program Settings). Apply, then reboot or at least restart the app. Set it back afterwards; leaving it off slows every game.3. Windows' DirectX shader cache:
cleanmgr) on the system drive and tick DirectX Shader Cache.Please say in your report which of these you turned off. A "cold" number with any layer still warm isn't comparable, and a warm driver cache explains most 1 ms PSO times.
AI use: Claude Code (Claude Opus 5.5) wrote this comment for @bmjask.
@bmjask on GitHub · 2026-11-24 19:21 UTC · original
Update, head
4143a09: merged currentmain(c160d86, #1426 direct DXIL), so the conflict is resolved.pso.rskeeps main's direct DXIL routing andXCL_DXIL_DUMPalongsideconsole_hlslfor--export-hlsl.--measure-psostill measures the HLSL path, which is the default;XCL_DIRECT_DXILis opt-in.Thanks @MatyEjsr, @RodrigoTorreao and @gsucristo for the reviews and measurements. Fixes in
051d2c8and4143a09:@MatyEjsr (
4e31065)record HASH, which isfnv64of the console shader container, the hash--measure-psoand--export-hlsl --record-hashlook up (and[SHADER]lines print). The old value was aDefaultHasherkey over DXIL that no tool could look up. Thanks also to @RodrigoTorreao for confirming that on a title run.XCL_PSO_TRACE=1no longer labels small compiles "huge". There is a unit test for the label, and the variable is read once.@gsucristo (
724b9e2/3a06645)driver_cache::keepand the compute PSO log now get the time spent in the driver only, so a compile that queued isn't stored as a slow one.XCL_HUGE_PSO_BYTES, so it can't pass falsely and doesn't deadlock with a small threshold. The concurrency test meets on aBarrierinstead of sleeping.StreamOutcounts shader bytes as subobjects are written, so there's no re-parse and no silent 0.measure_pso:--export-hlslskips non-compute records silently unless one is requested, and a requested record's failure stops the scan.XCL_HEAP_WINDOWS=1like--precompile.Performance, stated as measured (all from @RodrigoTorreao, RX 6750 XT; I have not repeated these on NVIDIA):
--measure-pso, with vs without9f65f95:CS_RTShadowTrace32TemporalHQ: 230 → 63 sCS_RaytracingResolve: 106 → 68 s+0x23cf683about 29 s after the last frame, with or without the PR.@pickles976: given that A/B, I'm not claiming this PR moves the first-load watchdog. On that load, the builds in flight are mid-size non-RT compute that commit 1 doesn't change. Whether RT builds land in a later load's blocked window is untested; nothing reached a second load. The ray-tracing cost reduction stands on its own.
On cache scoping:
emit.rsis inTRANSLATOR_SOURCES, so the translator change already invalidates translated and DXIL caches. Driver blobs are keyed by the DXIL. A driver update is the driver cache's own concern and isn't changed here.Full suite on RTX 4090 at
4143a09: 870 passed, 0 failed, 42 ignored (SKIPPED: 2 no wave64, 1 no heap windows). @MatyEjsr, a re-check of the log line, and @RodrigoTorreao, arecord …hash from a title log fed to--measure-pso, would be welcome.@nnonno91 on GitHub · 2026-11-24 19:24 UTC · original
Independent AMD check of the log-to-CLI workflow at
4143a09e3478d665dc3027171f3383f356fb24b2.Tested
XCL_ADAPTER='AMD Radeon'.cargo build --workspace --lockedpassed.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputreported 870 passed, 0 failed, 42 ignored. The pass count includes two explicit skips:pso_measurement_compiles_an_exact_synthetic_record(cache control unavailable,0x887A002D) andheap_window_out_of_memory_falls_back_to_the_switch_form(heap windows off). The bundled title passed.XCL_PSO_TRACE=1,XCL_DUMP_SHADERS=1,XCL_PSO_DISK_CACHE=0, and an isolated cache and dump directory,cargo test --locked -p xcl --test gpu_compute_e2e -- --exact console_wave64_compute_through_the_pso_hook_dispatch_and_read_back --test-threads=1 --nocapturegave 1 passed, 0 failed, 0 ignored, 0 skips. The runtime trace named the synthetic recordf762fc1473e87d61, had matching start/finish IDs, and did not label the small PSO huge.xcl shaders <file or folder> --export-hlsl <out> --record-hash f762fc1473e87d61 --windows 4 --split 0accepted the exact trace ID. This wrote one file and zero failures in each of four runs (single file or a folder with a decoy, each withXCL_HEAP_WINDOWS=0or1). The paired HLSL outputs matched byte for byte within each mode and used its expected accessors.dxc.exe -HV 2021 -E main -T cs_6_6 -Fo <out.dxil> <export.hlsl>compiled both modes. The 5,736-byte switch-mode DXIL also matched the runtime's cached DXIL by SHA-256. A wrong ID exited 2 and wrote zero files.xcl shaders <file> --measure-pso f762fc1473e87d61 --windows 4 --split 0reached driver cache control on that same record and exited 2 with the Developer Mode explanation and0x887A002D. It emitted no timing samples.Not tested
Cache-disabled timings with Developer Mode on, retail records or title smoke, or other adapters.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) ran the tests and CLI checks, verified the artifacts, and drafted this report.
@gbuyssens on GitHub · 2026-11-24 18:48 UTC · original · edited 2026-11-24 19:27 UTC
Test report and review of
ee7f2f3(base9e3831e).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4(debug): PRee7f2f3785 passed, 1 failed, 41 ignored; main9e3831e776 passed, 0 failed, 41 ignored. The failure isshaders::tests::pso_measurement_compiles_an_exact_synthetic_record(point 5 below: Developer Mode is off here). SKIPPED on both:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).scripts/smoke.ps1, 60 s, retail title (RockstarGamesInc package), back to back on an idle machine, same shader cache state:9e3831e: 1346 frames, peak commit 14573 MB, 0 crashes, 0 device removalsee7f2f3, first run after the translator change: 1475 frames, 14643 MB, 0 / 0ee7f2f3, second run: 1333 frames, 14568 MB, 0 / 09f65f95) in isolation: I exported the 5 largest compute programs from the title'sshaders.rpfwith the PR binary and with the PR minus9f65f95, then compiled each with DXC 1.8.2502-T cs_6_6 -HV 2021 -O1. The DXIL is 0.8–2.3 % smaller on all 5 (e.g. 994,844 → 981,468 B; 599,916 → 587,548 B), and DXC time is unchanged within noise (7.6–22.6 s per program). That is small but real, and no behaviour change was found.Issues found (each checked in the code at
ee7f2f3)big_compile_turn(real.rs:3608) takes a slot, then pollsbig_compile_commit_free()without reserving anything. On main there was one slot (most: 1). NowBIG_COMPILESandGIANT_COMPILESare separate semaphores, so at least two compiles (N+1 withXCL_HUGE_PSO_CONCURRENCY=N) can read the same "3 GB free" and enter the driver together. The comment puts each compile at ~1.5 GB, and the giant lane takes the largest programs. This is the out-of-commit case the guard was written for. Suggestion: one shared budget across both lanes, or reserve the estimated commit per compile.translated_compute_pso_once,started(real.rs:3802) is taken beforedriver_compile_identifiedwaits for its slot, anddriver_cache::keep(p, &b, started.elapsed())stores that value. A fast compile that waited behind a giant one is recorded as slow.small_and_title_thread_compiles_bypass_the_gatedoes not test the title-thread bypass. Its "huge on a title thread" case usesusize::MAX / 2, whichcompile_slotsroutes toGIANT_COMPILES, and that lane is free in the test. The test still passes with the thread-name check removed, and a regression would hang the join instead of failing.XCL_HUGE_PSO_BYTESalso changes which compute PSOs are deferred (real.rs:3778,big = dxil.len() >= huge_pso_bytes()), not only which ones are gated. A low value sends almost every compute PSO to the background, and the README describes only the gating.--measure-psoneeds Developer Mode. On this machine it exits withcannot disable the driver cache ... (0x887A002D).pso_measurement_compiles_an_exact_synthetic_recordasserts success and is gated only on wave64, so it should skip instead of failing there. It does fail on this machine (see the suite run above).--export-hlslon a full pack reports22157 failure(s), all of them non-compute records ("not a console compute shader"). It also passes--windowsas is, without theHEAP_WINDOWSbit, so withXCL_HEAP_WINDOWS=1the exported program is not the one the title compiles.Several of these overlap with gsucristo's review above (2, 3, the peak-commit concern). I agree with the request to split: commit 1 can land on its own now; the compile lanes need 1–4 fixed; the export/measure tool is a separate PR.
Not tested
--measure-psotimings (Developer Mode is off on this machine).Edited: added the full suite run.
AI use
@raylitebull on GitHub · 2026-11-24 19:56 UTC · original
Tested PR head
4143a09merged ontomain(6c89285) on Windows 11 with an AMD Radeon RX 9070 XT (16191 MiB VRAM, RDNA4, native wave64).Tested
4143a09onto6c89285(release build).shaders::tests::pso_measurement_compiles_an_exact_synthetic_recordPASSED (0.10 s;2312 B DXIL, 12 ms DXC, median 0.006 s).XCL_NETWORK=0, default pool settingsXCL_HUGE_PSO_BYTES=262144/ concurrency1):0x0(0crashes,0device removals).2,049(PresentX 2049,44two-second buckets).0-present streak was1bucket (<= 2 s).650translated pipelines (1,216DXIL cache hits,79misses,45coalesced,34DXC compiles,0failures).39,593DirectStorage requests (2,547 MB,0failed),19,629 MBpeak commit (19,774 MBprivate,10,126 MBworking set),8,898 MBprocess VRAM (10,356 MBadapter VRAM); captured 4K loading frames rendered cleanly with no visual corruption.Not tested
>= 256 KBhuge-PSO gate (this 90 s run hit34normal DXC compiles and did not reach a cold huge-shader storm).cargo test --workspacesuite or NVIDIA/Intel GPUs on this merged commit.@vladbondarenko97 on GitHub · 2026-11-24 20:25 UTC · original
NVIDIA data point for the merged lanes, from a retail run (not
--measure-pso): GTA VI 1.0.2.1,mainb9b6ea6(this PR + #1426 + #1195 + #1288), release, RTX 3080 Ti 12 GB (driver 610.88), i7-12700KF, Windows 11.XCL_PSO_TRACE=1 XCL_PSO_WAIT_MS=50, warm driver cache from earlier runs.Driver compile times from the
driver compile finish #Klines over the run (1494 compiles, 515 s of driver time in total, up to the title's watchdog at 180 s):For comparison, our earlier run of the same title on an older tree had single driver compiles of 88.5 s and 113.3 s at world load. No device removal; the run ended in the title's watchdog (
+0x2215c35) about 30 s after the last present, which looks unrelated to compile time (binds went on without the pipeline after 50 ms; the sparse queue stalls at the same time, see #433). I did not run--measure-psobefore/after, so this is not a controlled A/B.AI use: Claude Code (Claude Opus 5.5) ran the box, computed the table from the log and wrote this note.
@bmjask on GitHub · 2026-11-24 22:06 UTC · original
@vladbondarenko97 thanks for the NVIDIA retail-run distribution (1,494 driver compiles; the ≥ 512 KB bucket at a 12.4 s median, 46.0 s max, against 88.5 s / 113.3 s single compiles on the older tree). Agreed that it's not a controlled A/B, and that the watchdog about 30 s after the last present looks tied to the sparse-queue stall (#433), not to compile time.
AI use: Claude Code (Claude Opus 5.5) wrote this comment for @bmjask.
@DavidM1911 on GitHub · 2026-11-26 05:40 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin