Skip to content

Shaders: speed up translated pipeline compiles and add PSO measurements - #1524

Merged
raylitebull merged 8 commits into
xcl-dev:mainfrom
bmjask:perf/pso-runtime-eval
Nov 24, 2026
Merged

raylitebull merged 8 commits into
xcl-dev:mainfrom
bmjask:perf/pso-runtime-eval

Conversation

@bmjask

@bmjask bmjask commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Large 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:

  • removes those dynamic vector indices;
  • bounds concurrent large background compiles;
  • adds reproducible HLSL export and cache-disabled PSO measurement commands.

What is in it

  • Recompiler: avoid dynamic vector indices in format helpers changes the generated HLSL helpers and extends typed-format GPU coverage.
  • D3D12.X: limit concurrent huge pipeline compiles adds 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 pipelines adds strict record-hash selection, deterministic HLSL export, cache-disabled driver timing, tests, and CLI documentation.
  • D3D12.X: identify driver compiles in the PSO log and README: … add numbered driver compile start/finish #K lines. XCL_PSO_TRACE=1 logs every compile.
  • D3D12.X: log the record hash and time only the driver's compile (review fixes):
    • The log names the console record (record HASH, the hash --measure-pso / --record-hash take).
    • Small traced compiles are no longer labelled "huge".
    • The driver cache and PSO log get the time spent in the driver only, not the slot wait.
    • Two-pass shader bytes are counted once.
    • Gate tests are deterministic.
  • Shaders: fix --export-hlsl / --measure-pso review findings:
    • The root signature is released on every path.
    • Cache control and DXC are checked first. The GPU test skips when either is unavailable.
    • Non-compute records are skipped silently.
    • A single shader file works as input.
    • XCL_HEAP_WINDOWS is honoured.
    • A flag without its value is an error.
  • Merge of main c160d86 (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426, direct DXIL). pso.rs keeps both features. --measure-pso measures the default HLSL path, not XCL_DIRECT_DXIL.

Performance evidence (third-party; not repeated on NVIDIA)

program DXIL before → after driver median before → after
CS_RTShadowTrace32TemporalHQ 1 015 488 → 1 000 632 B 230.2 → 63.0 s
CS_RaytracingResolve 1 015 812 → 998 960 B 105.9 → 67.9 s
CSComputeSkinningPedVelocity 517 312 → 509 560 B 8.4 → 5.4 s (noisy)
3 small programs ≤ 0.5 % within noise
CS_ShadowRenderTiledCascades / …ParaboloidShadows −0.4 % 4.6 → 6.2 s / 15.9 → 18.4 s (2 runs, not judged a regression)
  • Same tester, cold watchdog A/B, main 9e3831e vs ee7f2f3, 2 runs each: all four runs ended in the +0x23cf683 watchdog 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.
  • I did not run my own before/after --measure-pso timings.

Tested

  • NVIDIA GeForce RTX 4090, driver 32.0.16.1088; Intel Core i9-12900K; Windows 11 Pro 10.0.26200; Rust 1.100.0 x86_64-pc-windows-msvc; debug tests and release smoke builds.
  • At 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)
  • An earlier run, while other agents were building and running GPU work on this machine, had 4 failures. They were in title_textures, vram (two PoisonError follow-ons) and pso_async. All 4 passed alone, and the suite was clean on the rerun.
  • Targeted tests: big_compile_tests, shaders::tests, and a_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.
  • Third-party: @MatyEjsr on an RTX 3090 at ee7f2f3 (786 passed), and @RodrigoTorreao on an RX 6750 XT at 3a06645 (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 is 9e3831e; the release build of c160d86 was not available. That means this PR's numbers also include #1426.

main:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 4090
title: game
seconds: 60
exit: 0x0
frames shown: 1448 (PresentX 1449)
presents per 2 s (last 3): 60 38 41
device removals: 0
crashes: 0
peak commit: 18568 MB

PR:

xcl-smoke v1
commit: 4143a09e3478d665dc3027171f3383f356fb24b2
gpu: NVIDIA GeForce RTX 4090
title: game
seconds: 60
exit: 0x0
frames shown: 1456 (PresentX 1457)
presents per 2 s (last 3): 60 31 56
device removals: 0
crashes: 0
peak commit: 19219 MB

PR / main: 100.6 % of frames, 103.5 % of peak commit.

Not tested

  • AMD or Intel GPUs at this head (RDNA2 was tested at 3a06645 by @RodrigoTorreao).
  • Native-wave64-only coverage or heap-window fallback on this adapter; those three tests reported explicit skips.
  • A watchdog A/B on a second world load, and aggregate build time per load over a corpus.
  • My own cache-off before/after timings on NVIDIA.

AI use

  • OpenAI Codex, GPT-5 implemented the first three commits, rebased them onto main, reviewed the diff, and ran the first validation.
  • Claude Code (Claude Opus 5.5) did the following:
    • wrote the log-identification commits and the review-fix commits;
    • merged main;
    • ran the full suite and the regression pair above;
    • copied the third-party numbers from the PR comments.

@pickles976

Copy link
Copy Markdown

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-pso before/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 +0x23cf683 A/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.

Runtime-indexed uint4 values became local arrays in DXIL and made large NVIDIA pipeline compiles substantially slower. Select components explicitly in format helpers and BVH barycentric selection instead.\n\nOn a 579 KB translated compute program this removed 101 local arrays; five cache-disabled driver runs improved from a 24.2 s median to 18.6 s. GPU tests cover packed formats, all four 32-bit components, selectors 0/1/4/7, stores, and BVH intersections.\n\nAssisted-by: OpenAI Codex (GPT-5)
Large driver compiles contend for CPU and commit when background PSO workers enter the driver together. Gate translated pipelines above a configurable DXIL threshold while allowing small and title-waited work through.

Use actual shader bytecode sizes, gate cold retries after rejected cache blobs, keep a conservative one-wide default, and put 4 MiB pipelines in a separate lane so they cannot starve ordinary large work.

Assisted-by: OpenAI Codex (GPT-5)
Make compile-time investigations reproducible by selecting a console record by hash, exporting its HLSL deterministically, and timing only cache-disabled driver PSO creation with the runtime root signature and samplers.

Assisted-by: OpenAI Codex (GPT-5)
@bmjask
bmjask force-pushed the perf/pso-runtime-eval branch from 71940c5 to 3a06645 Compare November 24, 2026 17:38
@bmjask bmjask changed the title Perf/pso runtime eval Speed up translated pipeline compilation and add PSO measurements Nov 24, 2026
bmjask and others added 2 commits November 24, 2026 12:52
Large driver compiles now log a numbered start and finish line, with the
translated program's hash and whether a driver blob was supplied for
compute pipelines, so a slow compile seen in a title log can be matched
to the record that --measure-pso exports and times. XCL_PSO_TRACE=1
logs every driver compile, not only large ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gsucristo

Copy link
Copy Markdown
Contributor

Reviewed 3a06645 against base 9e3831e. 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 added BUFFER_LOAD_FORMAT_XYZW / BUFFER_STORE_FORMAT_XYZW GPU test (tests.rs:1513–1514, 1577, 1582) look semantically equivalent on all valid inputs and strictly safer on OOB indices.
  • Missing measurements: Since emit.rs is in TRANSLATOR_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 shows 1313 frames on PR vs 1571 on main without explanation).

Commit 2 (724b9e2 — real.rs, README.md)

  1. Queue wait time leaks into started.elapsed() (real.rs:3787–3822):
    • let started = Instant::now() sits at real.rs:3787 before driver_compile waits in big_compile_turn (on main, _slot was acquired before started).
    • As a result, driver_cache::keep(p, &b, started.elapsed()) (real.rs:3802, KEEP = 250 ms) and the compute 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 to driver_cache as slow. Returning or passing the inner compile duration from driver_compile fixes this cleanly.
  2. False-pass bug and env-var deadlock in small_and_title_thread_compiles_bypass_the_gate (real.rs:3705–3719):
    • held (real.rs:3709) only saturates &BIG_COMPILES, while line 3716 calls driver_compile("test", usize::MAX / 2, true, || 8). Because usize::MAX / 2 >= GIANT_DRIVER_COMPILE (4 MiB), compile_slots(...) routes to &GIANT_COMPILES (0/1 held), so line 3716 passes even if the title-thread bypass were broken.
    • Line 3712 hardcodes bytes = 16, which deadlocks if cargo test runs with XCL_HUGE_PSO_BYTES <= 16.
    • the_concurrency_limit_holds_and_all_finish (real.rs:3693, 3701) asserts PEAK == 2 relying on a 20 ms sleep, which can flake under heavy load (a 2-thread Barrier makes it deterministic).
  3. Independent GIANT_COMPILES + BIG_COMPILES semaphores can raise peak memory (real.rs:3548–3554):
    • Keeping GIANT_COMPILES (>= 4 MiB, 1-wide) separate from BIG_COMPILES (default = 1, max = 64) prevents a giant shader from starving the ordinary lane, but allows a >= 4 MiB giant compile to overlap concurrently with XCL_HUGE_PSO_CONCURRENCY big compiles (2 concurrent by default vs 1 on main), increasing peak commit when a giant shader hits. (Also, if XCL_HUGE_PSO_BYTES > 4 MiB, BIG_COMPILES becomes unreachable.)
  4. Redundant/inaccurate logging & StreamOut::shader_bytes edge case:
    • if huge || bytes >= huge_pso_bytes() (real.rs:3566) is redundant (huge already requires bytes >= huge_pso_bytes()) and logs on every >= 256 KB compute PSO including warm driver_cache hits, duplicating real.rs:3817–3822.
    • finish_two_pass (real.rs:4680–4700) passes combined bytes = stream.shader_bytes() + tp.cs.len() into the mesh pass's driver_compile (real.rs:4687), double-counting tp.cs.len() (which is logged again at real.rs:4698), and emits up to 3 INFO lines per two-pass PSO (two-pass ... gated plus two ungated here lines, which also diverges from README.md:135–136).
    • StreamOut::shader_bytes() (real.rs:4600–4617) silently returns 0 if stream_subobjects encounters a subobject type unknown to null::subobject_payload. Accumulating shader_bytes directly in StreamOut::shader() avoids re-parsing and the silent-zero fallback.

Commit 3 (3a06645 — shaders.rs, pso.rs, main.rs, README.md)

  1. ID3D12RootSignature COM leak in measure_pso (shaders.rs:924–953):
    • desc.pRootSignature = ManuallyDrop::new(Some(rs)) is never released via ManuallyDrop::into_inner(...) on either normal return or the early Err(e) => return 2 exit at shaders.rs:938 (compare Pipelines::make at shaders.rs:1057).
  2. pso_measurement_compiles_an_exact_synthetic_record breaks cargo test without 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_ACCESSDENIED without it) and is currently stubbed as E_NOTIMPL in vkd3d-proton. The test unconditionally asserts measure_pso(...) == 0 instead of skipping when cache control is unavailable.
    • The test only guards on wave64_supported(): it does not check recomp::dxc::location(), and under XCL_ADAPTER=warp, wave64_supported() succeeds via WARP while Pipelines::new() (adapter::candidates) fails.
    • In measure_pso (shaders.rs:889–916), console_translation and dxc::compile run before checking ID3D12Device9::ShaderCacheControl, wasting tens of seconds on large shaders before failing fast when cache control is unavailable.
  3. export_hlsl flags every non-compute record in an archive as a failure (shaders.rs:827–831), and keeps scanning after a --record-hash failure (shaders.rs:827–848):
    • When --record-hash is None, every VS/PS/MS/GS record encountered before reaching count increments failures and prints not a console compute shader to stderr; non-compute records should be silently skipped unless explicitly requested by --record-hash.
    • When --record-hash is Some and the matched record fails (!is_compute_container, console_hlsl error, or write error), the branches continue instead of breaking, scanning all remaining records in the pack.
  4. Single-file inputs silently ignore --export-hlsl and --measure-pso (shaders.rs:711–715):
    • Any non-RPF9 single file hits the else branch and returns print(path, "single file", ...) before lines 717 (--export-hlsl) and 736 (--measure-pso), contradicting main.rs:32–40 (the unit tests bypassed run() via Input::Files).
  5. --export-hlsl and --measure-pso ignore XCL_HEAP_WINDOWS=1 (#680) (shaders.rs:731, 748):
    • Unlike --precompile (shaders.rs:756–757), neither ORs recomp::HEAP_WINDOWS when recomp::pso::heap_windows() is active, so both translate/measure the switch form instead of the exact runtime form under XCL_HEAP_WINDOWS=1. (Note export_hlsl line 856 also prints {windows} windows unmasked, so it would need windows & !recomp::HEAP_WINDOWS like precompile.)
  6. CLI argument parsing edge cases (shaders.rs:682–683, 717–751):
    • Missing trailing values for --export-hlsl, --measure-pso, or --record-hash make value() return None and silently fall through instead of erroring.
    • A missing value followed by another flag consumes that flag as the value (e.g. --export-hlsl --record-hash DEADBEEF creates ./--record-hash/).

(AI use: reviewed with AI assistance — findings independently verified against commit 3a06645.)

@bmjask

bmjask commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Status update (head ee7f2f3, up to date with main 9e3831e):

  • Added 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=1 logs every compile. README updated.
  • Full suite: 786 passed, 0 failed, 41 ignored (3 explicit GPU skips: 2 no wave64, 1 no heap windows).
  • Regression pair rerun back to back on an idle RTX 4090: main 1585 frames / 15673 MB peak commit, PR 1577 frames / 15437 MB, no crashes or device removals. (The earlier 1313-frame PR run was done on a busy shared machine; it does not reproduce.)

@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:

  1. The PR makes no claim of a speedup in seconds. What it adds is the tooling (--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.
  2. A watchdog A/B on a cold second load is a fair ask. Testers with that rig are welcome to try it; it is not done here.
  3. The 4 MiB lane: by default huge pipelines (>= 256 KiB DXIL) already go one at a time. XCL_HUGE_PSO_CONCURRENCY can 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 DXC: sources over 8 MB use -O1, not -O0 #1526: larger -O0 DXIL would land in these lanes more often. That only bounds concurrency; it doesn't change results.

@RodrigoTorreao

Copy link
Copy Markdown

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 ee7f2f3 since. Its two new commits only add PSO log lines in real.rs and README text, with no change under gpu/recomp/, so the DXIL and timings below apply to it unchanged. The suite was run on 3a06645, not re-run on ee7f2f3.

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 in CreateComputePipelineState with the cache off. Programs without those helpers do not change beyond noise.

Tested

  • Hardware and software:
    • AMD Radeon RX 6750 XT 12 GB (RDNA2, native wave64), driver 32.0.21045.29003
    • Intel i5-14600KF, 16 GB RAM
    • Windows 11 25H2 (26200.9974)
    • Rust 1.100.0 MSVC
    • DXC 1.9.2609.5 via XCL_DXC_DIR
  • Before / after with this PR's own tool.
    • "After" is 3a06645. "Before" is 3a06645 with 9f65f95 reverted locally, so both use the same --measure-pso. Neither of the other two commits changes the HLSL.
    • The "before" DXIL matches main 9e3831e's: ParaboloidShadows is 363 460 B on both.
    • Command: 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.
program (record hash) DXIL before → after driver, before (2 runs) driver, after (2 runs) median
CS_RTShadowTrace32TemporalHQ (36968699275efc8f) 1 015 488 → 1 000 632 B 239.7 / 220.6 s 63.1 / 62.9 s 230.2 → 63.0 s (3.7×)
CS_RaytracingResolve cloth_default (fb110f51ccc8f375) 1 015 812 → 998 960 B 104.4 / 107.5 s 68.3 / 67.6 s 105.9 → 67.9 s (1.6×)
CSComputeSkinningPedVelocity (5683ddcd01491067) 517 312 → 509 560 B 10.6 / 6.2 s 5.6 / 5.1 s 8.4 → 5.4 s (noisy)
CS_ScreenProbes_TraceRays_BVH_Shared_ShaderBinning (a2fba2f14aaaa761) 165 820 → 165 452 B 2.9 / 3.6 s 2.4 / 3.2 s 3.2 → 2.8 s
CS_AmbientMapSky16 (9d07f6b9e70856f3) 87 092 → 87 092 B 0.65 / 0.56 s 0.58 / 0.59 s 0.60 → 0.58 s
ColorDownsampleCS (da0e539ea887f3fc) 49 000 → 48 500 B 0.28 / 0.26 s 0.27 / 0.27 s 0.27 → 0.27 s
CS_ShadowRenderTiledCascades (1d6a161c9bb69ab0) 273 536 → 272 496 B 3.8 / 5.4 s 5.5 / 6.9 s 4.6 → 6.2 s
CS_BatchCullMeshlets_ParaboloidShadows (1ada490879c33c0e) 363 460 → 361 980 B 16.6 / 15.2 s 19.0 / 17.8 s 15.9 → 18.4 s
  • DXC time for the RT shadow program also drops, from 67.6 s to 51.7 s.
  • The two programs that got slower (ShadowRenderTiledCascades, ParaboloidShadows) changed their DXIL by under 0.5 %. With two runs each and the spread above, I would not read them as a regression without more runs.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug, XCL_SAMPLE_* set to the retail files): 783 passed, 3 failed, 41 ignored.
  • XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e: 4 passed, 0 failed, including that test, on native wave64.

Not tested

  • ② The watchdog A/B (+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.
  • The huge-pipeline lanes (724b9e2) in a title run, and the heap-window form for the timings above.
  • Aggregate build time per load. These are 8 hand-picked programs, not a corpus.
  • More than 2 runs per program. Other AMD generations and drivers.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds, the measurements and the tests on my machine and wrote this report. All numbers are copied from xcl's PSO … lines and the test output.

@pickles976

Copy link
Copy Markdown

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

Copy link
Copy Markdown

Tested PR #1524 at head ee7f2f36e03c6ca79fc4fbbe6a2ba5b1a7e92855 on an NVIDIA RTX 3090 and reviewed the new commits 4e310655 and ee7f2f36. The full test suite passes on this machine, and two concrete bugs turned up in 4e310655.

Tested

  • OS: Windows 11 Pro for Workstations 10.0.26200 (Build 26200)
  • CPU / RAM: AMD Ryzen 7 7800X3D (8-core), 31.4 GB RAM
  • GPU: NVIDIA GeForce RTX 3090 24 GB, driver 617.42 (32.0.16.1742), wave32 (split-wave64)
  • Toolchain: rustc 1.100.0 (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-existing fetch_update deprecation warnings)
  • cargo test --workspace -j 8 -- --test-threads=8 --nocapture: 786 passed (including 5 SKIPPED), 0 failed, 41 ignored
    • SKIPPED (not counted as coverage):
      • 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)
      • 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 ignored
  • pso_measurement_compiles_an_exact_synthetic_record: passed (3640 bytes DXIL, 16 ms DXC, 1 cache-off run(s), median 0.010 s in the full run; 20 ms DXC, median 0.015 s standalone)
  • git diff --check 9e3831e...ee7f2f3: clean

Findings on 4e310655 / ee7f2f36

  1. Hash mismatch between driver compile start and --measure-pso (crates/xcl/src/hle/d3d12x/real.rs:3790,3807,3821 vs crates/xcl/src/shaders.rs:597,628):
    • translated_compute_pso_once logs key.0, which compute_blob_key (real.rs:4035-4040) computes with DefaultHasher over translated &dxil.
    • --measure-pso HEX and --export-hlsl --record-hash HEX look up shader::fnv64(&blob) over the raw console shader container bytes (cs).
    • Because both the hashed bytes and hash algorithm differ, a hash copied from driver compile start cannot match --measure-pso, contrary to README.md (ee7f2f36). Observed with XCL_PSO_TRACE=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture:
      xcl: [SHADER] cs d632a05c071e2f41: 212 B, format xbox-native, parts [DXIL]
      xcl: D3D12.X: driver compile start #1: compute PSO, 3744 B DXIL, hash 17eef6808d2938df, driver blob absent
      xcl: [SHADER] cs f762fc1473e87d61: 308 B, format xbox-native, parts [DXIL]
      xcl: D3D12.X: driver compile start #2: compute PSO, 6128 B DXIL, hash a4bec3979f7100d5, driver blob absent
      
    • Logging crate::gpu::shader::fnv64(cs) (or both hashes clearly labeled) would make the log line match --measure-pso.
  2. XCL_PSO_TRACE=1 labels small PSOs as huge, ungated here (crates/xcl/src/hle/d3d12x/real.rs:3578-3586):
    • Because the _ arm of match (huge, slot.is_some()) assumes bytes >= huge_pso_bytes(), tracing small compiles logs huge, ungated here on non-huge PSOs (reproduced on both the 3,744 B compute PSO above and the 16 B compile in small_and_title_thread_compiles_bypass_the_gate: driver compile finish #1: test PSO, 16 B DXIL, 0 ms, huge, ungated here (...)).
    • Minor: XCL_PSO_TRACE is read via std::env::var on every compile instead of cached in a OnceLock like huge_pso_bytes() / huge_pso_concurrency().
  3. Earlier review notes on commits 724b9e2 and 3a06645 (queue wait time included in started.elapsed(), ManuallyDrop root-signature leak in measure_pso, un-skipped ShaderCacheControl test when Developer Mode is off, single-file CLI path returning before --export-hlsl / --measure-pso) are still present unchanged at ee7f2f36.

Not tested

  • AMD / native wave64 GPUs, release build, D3D12 debug-layer tests (Graphics Tools not installed), retail title smoke run, or --measure-pso / --export-hlsl on a large external shader corpus.

AI use

  • agy with gemini-4-neon-high ran the build and tests on this machine, verified the diff, and drafted this report from the logs.

@RodrigoTorreao

Copy link
Copy Markdown

@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 main 9e3831e against this PR at ee7f2f3, 2 runs each, interleaved. All four runs end in the +0x23cf683 watchdog 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

  • Hardware: RX 6750 XT 12 GB (RDNA2), driver 32.0.21045.29003, i5-14600KF, 16 GB RAM, Windows 11 26200.9974. Release builds, DXC 1.9.2609.5.
  • Each run was cold: a renamed copy of xcl.exe (fresh AMD driver cache), a fresh XCL_DXIL_CACHE (so used-pipelines.txt is empty and nothing is preloaded), XCL_PSO_DISK_CACHE=0, XCL_TRANSLATED_CACHE=0, XCL_NETWORK=0.
  • The title data root had the first-run setup already done.
  • Played by hand the same way each time: menus, then legal notices, then straight into the story, with no input during the load. Default config, no XCL_HEAP_WINDOWS.
round build last frames watchdog fatal frames → fatal
1 main ~116 s 145.6 s ~29.5 s
2 PR ~124 s 153.4 s ~29.2 s
3 main ~133 s 162.5 s ~29.1 s
4 PR ~148 s 177.1 s ~29.0 s
  • The absolute times move with how fast I got through the menus. The time from the last frame to the fatal is ~29 s in all four, so the window a cold build has to fit in here is about 29 s without presents, not minutes.
  • In the ~30 s before each fatal, the largest compute builds logged are the same in both builds:
    • a 272 KB program, 13.4 / 13.9 s on main and 13.4 / 12.6 s on the PR, unchanged by commit 1;
    • on the PR, a 144 KB one (1.7 s), then 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.
  • main logs only finished builds, so whether the same program was in flight there is not visible.
  • I can't name Config: the Series S title memory for every Series S spelling #48 or Float compares with NaN operands, f64 math past the f32 and int64 ranges #46 (the 272 KB one) in the pack. Both logged hashes give record … not found with --measure-pso on the retail shaders.rpf. That confirms on a title run what @MatyEjsr found above: the log carries a DefaultHasher key over the DXIL, not the record's fnv64.
  • So the 3.7× / 1.6× drops I measured for CS_RTShadowTrace32TemporalHQ and CS_RaytracingResolve hold. 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

  • More runs per side; this is two each.
  • A warm-cache A/B, and a second world load (none of these runs got past the first, so RT builds landing in a later load are not ruled out).
  • XCL_HEAP_WINDOWS=1, and XCL_HUGE_PSO_CONCURRENCY other than the default.

AI use

  • Claude Code (Claude Opus 5.5) prepared the builds and the cold runs, read the logs and the code, and wrote this. I played the four runs. Times and log lines are copied from each run's xcl.log.

bmjask and others added 3 commits November 24, 2026 13:45
Conflicts: pso.rs keeps both console_hlsl (for --export-hlsl) and
main's direct DXIL routing/XCL_DXIL_DUMP; console_translation stays
pub(crate) for --measure-pso. main.rs usage lists both --export-hlsl/
--measure-pso and --direct.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fixes on the huge-pipeline gate and its log lines (PR 1524):
- the start line names the console record by fnv64 of its shader
  container (`record HASH`), the hash --measure-pso and --export-hlsl
  --record-hash take; it was a DefaultHasher key over the DXIL, which no
  tool can look up (MatyEjsr, RodrigoTorreao)
- XCL_PSO_TRACE=1 no longer calls small compiles "huge, ungated here";
  the setting is read once
- driver_cache::keep and the compute PSO log get the time spent in the
  driver alone, not the wait for a slot, so a fast compile that queued
  is not kept as a slow one (gsucristo)
- the mesh pass of a two-pass pipeline logs its own shader bytes, not
  those plus the compute pass's; StreamOut counts shader bytes as
  subobjects are written instead of re-parsing (no silent 0)
- tests: the bypass test holds both lanes and uses sizes relative to
  XCL_HUGE_PSO_BYTES (no deadlock with a small threshold); the
  concurrency test meets on a barrier instead of a sleep
- README: the giant lane can run next to the ordinary slot

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- measure_pso releases its root signature on every path, checks DXC and
  turns the driver caches off before translating, and its GPU test skips
  (instead of failing) without DXC, a usable device or cache control
  (Developer Mode)
- --export-hlsl skips non-compute records silently unless one is asked
  for by --record-hash; a requested record's failure stops the scan
- a single shader file is an input for --export-hlsl / --measure-pso
  instead of being summarised and returning
- both use heap windows with XCL_HEAP_WINDOWS=1, as --precompile
- --export-hlsl, --record-hash and --measure-pso without a value (or
  with another flag in its place) are errors

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gbuyssens

gbuyssens commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Test report and review of ee7f2f3 (base 9e3831e).

Tested

  • RTX 3060 (driver 32.0.16.2101), i5-9600K, 32 GB, Windows 11 Pro 26300, Rust 1.98.0 MSVC, release builds.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug): PR ee7f2f3 785 passed, 1 failed, 41 ignored; main 9e3831e 776 passed, 0 failed, 41 ignored. The failure is shaders::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:
    • main 9e3831e: 1346 frames, peak commit 14573 MB, 0 crashes, 0 device removals
    • PR ee7f2f3, first run after the translator change: 1475 frames, 14643 MB, 0 / 0
    • PR ee7f2f3, second run: 1333 frames, 14568 MB, 0 / 0
    • Frame counts on this title vary by ±10 % between runs of the same build (three main runs gave 1331–1382), so I read this as no regression, not a speedup.
  • Commit 1 (9f65f95) in isolation: I exported the 5 largest compute programs from the title's shaders.rpf with the PR binary and with the PR minus 9f65f95, 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)

  1. The commit guard no longer bounds the driver's memory. big_compile_turn (real.rs:3608) takes a slot, then polls big_compile_commit_free() without reserving anything. On main there was one slot (most: 1). Now BIG_COMPILES and GIANT_COMPILES are separate semaphores, so at least two compiles (N+1 with XCL_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.
  2. Slot wait is recorded as compile time. In translated_compute_pso_once, started (real.rs:3802) is taken before driver_compile_identified waits for its slot, and driver_cache::keep(p, &b, started.elapsed()) stores that value. A fast compile that waited behind a giant one is recorded as slow.
  3. small_and_title_thread_compiles_bypass_the_gate does not test the title-thread bypass. Its "huge on a title thread" case uses usize::MAX / 2, which compile_slots routes to GIANT_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.
  4. XCL_HUGE_PSO_BYTES also 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.
  5. --measure-pso needs Developer Mode. On this machine it exits with cannot disable the driver cache ... (0x887A002D). pso_measurement_compiles_an_exact_synthetic_record asserts 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).
  6. --export-hlsl on a full pack reports 22157 failure(s), all of them non-compute records ("not a console compute shader"). It also passes --windows as is, without the HEAP_WINDOWS bit, so with XCL_HEAP_WINDOWS=1 the 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-pso timings (Developer Mode is off on this machine).
  • AMD / Intel, and any title that hits the giant lane in a 60 s run (no driver compile over the threshold was logged in my runs).

Edited: added the full suite run.

AI use

  • Claude Code (Claude Opus 5.5) ran the builds, smoke runs and the DXC comparison, reviewed the diff with sub-agents, and drafted this comment. I checked each point in the code before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

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):

shaders::tests::pso_measurement_compiles_an_exact_synthetic_record
assertion `left == right` failed: left: 2, right: 0

measure_pso returns 2 because ID3D12Device9::ShaderCacheControl(…, DISABLE) fails on this machine:

xcl shaders --measure-pso: cannot disable the driver cache:
A aplicação pediu uma operação que depende de um componente SDK em falta ou sem correspondência. (0x887A002D)

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_test treatment as the wave64 check, or measure_pso should tolerate the cache-control failure (a cache disable is best-effort for measurement anyway).

@bmjask

bmjask commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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.
  • Alternatively, point the DXIL cache at a fresh empty folder with XCL_DXIL_CACHE=<empty dir>, instead of clearing %LOCALAPPDATA%\xcl\.

2. The GPU driver's shader cache:

  • NVIDIA: NVIDIA Control Panel → Manage 3D settings → Global Settings → Shader Cache Size → Disabled (or set it per program for xcl.exe under Program Settings). Apply, then reboot or at least restart the app. Set it back afterwards; leaving it off slows every game.
  • AMD: AMD Software: Adrenalin Edition → Gaming → Graphics → Advanced → Reset Shader Cache. Do this before each cold run; recent drivers have no permanent off switch.
  • Intel: Intel Graphics Software / Arc Control has no off switch either; clear the Windows DirectX cache below.

3. Windows' DirectX shader cache:

  • Settings → System → Storage → Temporary files → tick DirectX Shader Cache → Remove files.
  • Or run Disk Cleanup (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

bmjask commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Update, head 4143a09: merged current main (c160d86, #1426 direct DXIL), so the conflict is resolved. pso.rs keeps main's direct DXIL routing and XCL_DXIL_DUMP alongside console_hlsl for --export-hlsl. --measure-pso still measures the HLSL path, which is the default; XCL_DIRECT_DXIL is opt-in.

Thanks @MatyEjsr, @RodrigoTorreao and @gsucristo for the reviews and measurements. Fixes in 051d2c8 and 4143a09:

@MatyEjsr (4e31065)

  1. Hash mismatch: fixed. The start line now prints record HASH, which is fnv64 of the console shader container, the hash --measure-pso and --export-hlsl --record-hash look up (and [SHADER] lines print). The old value was a DefaultHasher key over DXIL that no tool could look up. Thanks also to @RodrigoTorreao for confirming that on a title run.
  2. XCL_PSO_TRACE=1 no longer labels small compiles "huge". There is a unit test for the label, and the variable is read once.

@gsucristo (724b9e2 / 3a06645)

  • Wait time no longer leaks into the timing. driver_cache::keep and 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.
  • Bypass test: it now holds both lanes and uses sizes relative to XCL_HUGE_PSO_BYTES, so it can't pass falsely and doesn't deadlock with a small threshold. The concurrency test meets on a Barrier instead of sleeping.
  • Two-pass mesh pass: now logs its own shader bytes. StreamOut counts shader bytes as subobjects are written, so there's no re-parse and no silent 0.
  • measure_pso:
    • releases the root signature on every path;
    • checks DXC and turns off the driver cache before translating;
    • its GPU test skips (rather than fails) without DXC, a usable device, or cache control (Developer Mode).
  • --export-hlsl skips non-compute records silently unless one is requested, and a requested record's failure stops the scan.
  • A single shader file now works as input for both commands.
  • Both commands honour XCL_HEAP_WINDOWS=1 like --precompile.
  • A flag without its value is an error.
  • Giant lane and peak commit: you're right that a ≥ 4 MiB compile can run next to the ordinary slot, so with the default settings 2 can be in flight versus 1 on main. Each gated compile still starts only with 3 GB of commit free. The README now says this explicitly. I kept the separate lane rather than claim it costs nothing.
  • Splitting into three PRs: I've left that to the maintainer.

Performance, stated as measured (all from @RodrigoTorreao, RX 6750 XT; I have not repeated these on NVIDIA):

  • Cache-off --measure-pso, with vs without 9f65f95:
    • CS_RTShadowTrace32TemporalHQ: 230 → 63 s
    • CS_RaytracingResolve: 106 → 68 s
    • smaller programs: within noise (two changed by under 0.5 % DXIL and came out slower, on 2 runs each)
  • Cold watchdog A/B, 2 runs per side: all four runs hit +0x23cf683 about 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.rs is in TRANSLATOR_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, a record … hash from a title log fed to --measure-pso, would be welcome.

@nnonno91

Copy link
Copy Markdown

Independent AMD check of the log-to-CLI workflow at 4143a09e3478d665dc3027171f3383f356fb24b2.

Tested

  • AMD Radeon(TM) Graphics (Ryzen 7 9800X3D integrated GPU, driver 32.0.21042.62), Windows 11 25H2 build 26200.9974 with Developer Mode off, Rust 1.100.0 MSVC, SDK DXC 1.8.2502.11. Unoptimized build with debug info disabled, XCL_ADAPTER='AMD Radeon'.
  • cargo build --workspace --locked passed. cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 870 passed, 0 failed, 42 ignored. The pass count includes two explicit skips: pso_measurement_compiles_an_exact_synthetic_record (cache control unavailable, 0x887A002D) and heap_window_out_of_memory_falls_back_to_the_switch_form (heap windows off). The bundled title passed.
  • With 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 --nocapture gave 1 passed, 0 failed, 0 ignored, 0 skips. The runtime trace named the synthetic record f762fc1473e87d61, 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 0 accepted 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 with XCL_HEAP_WINDOWS=0 or 1). 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 0 reached driver cache control on that same record and exited 2 with the Developer Mode explanation and 0x887A002D. 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.

@bmjask bmjask changed the title Speed up translated pipeline compilation and add PSO measurements Shaders: speed up translated pipeline compiles and add PSO measurements Nov 24, 2026
@raylitebull

Copy link
Copy Markdown
Member

Tested PR head 4143a09 merged onto main (6c89285) on Windows 11 with an AMD Radeon RX 9070 XT (16191 MiB VRAM, RDNA4, native wave64).

Tested

  • Merge: Clean zero-conflict merge of 4143a09 onto 6c89285 (release build).
  • Unit test: shaders::tests::pso_measurement_compiles_an_exact_synthetic_record PASSED (0.10 s; 2312 B DXIL, 12 ms DXC, median 0.006 s).
  • Retail title run (90 s, XCL_NETWORK=0, default pool settings XCL_HUGE_PSO_BYTES=262144 / concurrency 1):
    • Exit: 0x0 (0 crashes, 0 device removals).
    • Frames shown: 2,049 (PresentX 2049, 44 two-second buckets).
    • Stalls: zero long stalls — max consecutive 0-present streak was 1 bucket (<= 2 s).
    • Pipelines & cache: 650 translated pipelines (1,216 DXIL cache hits, 79 misses, 45 coalesced, 34 DXC compiles, 0 failures).
    • Streaming & memory: 39,593 DirectStorage requests (2,547 MB, 0 failed), 19,629 MB peak commit (19,774 MB private, 10,126 MB working set), 8,898 MB process VRAM (10,356 MB adapter VRAM); captured 4K loading frames rendered cleanly with no visual corruption.

Not tested

  • Cold-cache saturation of the >= 256 KB huge-PSO gate (this 90 s run hit 34 normal DXC compiles and did not reach a cold huge-shader storm).
  • Full cargo test --workspace suite or NVIDIA/Intel GPUs on this merged commit.

@raylitebull
raylitebull merged commit 85e3826 into xcl-dev:main Nov 24, 2026
2 of 3 checks passed
@vladbondarenko97

Copy link
Copy Markdown
Contributor

NVIDIA data point for the merged lanes, from a retail run (not --measure-pso): GTA VI 1.0.2.1, main b9b6ea6 (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 #K lines over the run (1494 compiles, 515 s of driver time in total, up to the title's watchdog at 180 s):

DXIL size compiles median max
< 64 KB 1371 0 ms 1.7 s
64–256 KB 101 0.7 s 16.4 s
256–512 KB 17 10.5 s 20.2 s
≥ 512 KB 5 12.4 s 46.0 s (compute, 981 464 B)

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-pso before/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.

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…pub(crate)

Fixes compilation errors on MSVC Windows target:

- D3D12.X: restores pub(crate) unsafe fn create_raw_fence in real.rs required
  by sparse::readback_after_execute (xcl-dev#1732). Creates an unproxied raw
  ID3D12Fence bypassing title vtable hooks so internal queue worker threads under
  Wine/vkd3d-proton signal native fences without hitting proxy mismatches.

- KernelX: restores pub(crate) visibility for commit_sparse in kernelx.rs
  (xcl-dev#549, xcl-dev#1298), required by DirectStorage's lazy MEM_RESERVE sparse
  window allocation in dstorage.rs and placeholder mappings.

- Recompiler: adds #[cfg(test)] gate above mod tests in emit.rs to silence unused
  PRELUDE_MEM import warnings in non-test release builds (xcl-dev#1524).

Assisted-by: Antigravity
anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…driver gave up callback

Eliminates compiler warnings for unused items:

- D3D12.X: removes rb_fence and rb_value from sparse::State and test fixtures
  (xcl-dev#1732). Readback fences are now managed per-queue in RB_QUEUES
  by async readback workers, making the fields on State obsolete.

- D3D12.X: hooks note_driver_gave_up in real::translated_compute_pso_once when
  driver_compile_identified returns E_OUTOFMEMORY after DRIVER_GAVE_UP_AFTER
  (xcl-dev#1665, xcl-dev#1524), ensuring failed massive compute pipelines are
  persisted in used-pipelines.txt (!<key>) and eliminating dead code warnings.

Assisted-by: Antigravity
@bmjask

bmjask commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@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.

wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
…xcl-dev#819)

Conflicts:
- real.rs driver-compile gate: upstream's XCL_HUGE_PSO_BYTES / _CONCURRENCY,
  Slots::most() and GIANT lane (4 MiB) taken; integ's HUGE lane is the same
  4 MiB lane (big_compile_lane now names compile_slots' lanes).
  BIG_DRIVER_COMPILE -> huge_pso_bytes() (also in warm).
  Compute PSO: integ's lane / slotless / pso_async hooks kept, then the
  driver call through driver_compile_identified (gated by its caller) for
  upstream's log lines and driver-only time; the cold retry gated as upstream.
  Graphics: integ's dxil_known, then upstream's gated driver_compile.
  pso_async::build_is_wanted is no longer test-only (upstream's gates use it).
  The two tests that take both real lanes hold BOTH_LANES (opposite orders).
- shaders.rs: runtime_windows() with integ's --used; both sides' helpers and
  tests kept.
- pso.rs: compute_shape and console_hlsl both kept.
- README: both sides' lines kept.

Assisted-by: omp (Claude Opus 5.5)
Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 25, 2026
The huge-pipeline gate (xcl-dev#1524) let a compile on an xcl-pso worker start with
3 GB of commit free, whatever the program's size. The driver's compiler takes
memory in proportion to the program: ~1.5 GB for a 1 MB one (NVIDIA), and an
AMD driver took a process from 34 to 42 GB of commit on a retail title's
13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321). With the giant lane next
to the ordinary ones that compile started at 4 s, in the background, while the
title's world loading took its own 25 GB: on 32 GB of RAM the process ran into
the machine's commit limit at 28 - 34 s, twice with XCL_HUGE_PSO_CONCURRENCY=4
and once with the defaults (a title thread's page could not be committed).

big_compile_commit_needed(bytes) is 3 GB plus 1 GB for every 2 MB of DXIL, and
big_compile_may_start also refuses a background compile that would take more
than a share of the machine's RAM (a quarter; XCL_HUGE_PSO_RAM_SHARE sets the
n of 1/n, 0 leaves the commit free alone to decide, as before): such a program
waits for a bind that wants it (the gate's existing way out) and is built then,
as a title thread would, and the log says so once per program and worker.
Compiles the title waits for, and small ones, are unchanged.

A graphics bind resolves without waiting and did not mark the pipeline wanted,
so a graphics program the share holds back would have stayed a stand-in, its
worker in the gate: `resolve` now calls `want()` too (found, with the test
a_graphics_bind_releases_the_background_ram_share_gate, by WebIdentity1 in
review).

Measured on an RX 7800 XT, 32 GB: with the rule the same runs end at 600 s,
the 13.8 MB program built at 97 s when the title bound it, and a 60 s smoke's
peak commit goes from 84 GB (main) to 27 GB.

Co-Authored-By: WebIdentity1 <WebIdentity1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 25, 2026
The huge-pipeline gate (xcl-dev#1524, headroom by size since xcl-dev#1774) lets a compile on an
xcl-pso worker start when its commit headroom is free. That reading at the start
of a compile says nothing about what the title takes next: a retail title's
13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321) started at 4 s in the
background with 36 GB of commit free - its headroom is 7 GB - and, with the
title's own 25 GB of world loading after it, the AMD driver's ~15 GB for that
compile ran the process into the machine's commit limit at 28 - 34 s on 32 GB of
RAM, three times (twice with XCL_HUGE_PSO_CONCURRENCY=4, once with the defaults:
a title thread's page could not be committed).

A background compile now also needs what it takes (the headroom, or 1 GB per MB
of DXIL when that is more) to be within a share of the machine's RAM (a quarter;
XCL_HUGE_PSO_RAM_SHARE sets the n of 1/n, 0 leaves the commit free alone to
decide, as before) and within the RAM available now (under Wine the commit
reading is the memory available plus the free swap and never falls, as
Royalflamejlh measured in review). Such a program waits for a bind that wants
it (the gate's existing way out) and is built then, as a title thread would,
and the log says so once per program and worker. Compiles the title waits for,
and small ones, are unchanged.

A graphics bind resolves without waiting and did not mark its pipeline wanted,
so a graphics program the share holds back would have stayed a stand-in with
its worker in the gate: `resolve` now calls `want()` too (found, with the test
a_graphics_bind_releases_the_background_ram_share_gate, by WebIdentity1 in
review).

Measured on an RX 7800 XT, 32 GB: with the share the same runs end at 600 s, the
13.8 MB program built at 97 s when the title bound it, and a 60 s smoke's peak
commit goes from 84 GB (main) to 27 GB.

Co-Authored-By: WebIdentity1 <WebIdentity1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 25, 2026
The huge-pipeline gate (xcl-dev#1524, headroom by size since xcl-dev#1774) lets a compile on an
xcl-pso worker start when its commit headroom is free. That reading at the start
of a compile says nothing about what the title takes next: a retail title's
13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321) started at 4 s in the
background with 36 GB of commit free - its headroom is 7 GB - and, with the
title's own 25 GB of world loading after it, the AMD driver's ~15 GB for that
compile ran the process into the machine's commit limit at 28 - 34 s on 32 GB of
RAM, three times (twice with XCL_HUGE_PSO_CONCURRENCY=4, once with the defaults:
a title thread's page could not be committed).

A background compile now also needs what it takes (the headroom, or 1 GB per MB
of DXIL when that is more) to be within a share of the machine's RAM (a quarter;
XCL_HUGE_PSO_RAM_SHARE sets the n of 1/n, 0 leaves the commit free alone to
decide, as before) and within the RAM available now (under Wine the commit
reading is the memory available plus the free swap and never falls, as
Royalflamejlh measured in review). Such a program waits for a bind that wants
it (the gate's existing way out) and is built then, as a title thread would,
and the log says so once per program and worker. Compiles the title waits for,
and small ones, are unchanged.

A graphics bind resolves without waiting and did not mark its pipeline wanted,
so a graphics program the share holds back would have stayed a stand-in with
its worker in the gate: `resolve` now calls `want()` too (found, with the test
a_graphics_bind_releases_the_background_ram_share_gate, by WebIdentity1 in
review).

Every start read the same commit free, which the gated compiles already running
had not taken yet, so with XCL_HUGE_PSO_CONCURRENCY=8 on an RTX 4090 with 47 GB
of RAM (52.4 GB commit limit) 0.76 - 1.06 MB compiles started four at a time,
each "gated (waited 0 ms)", while the system's free commit went 3.8 -> 1.8 ->
0.9 GB and the process 32.8 -> 42.4 GB (found by @S1m0ne1997 on the PR). What
the background compiles in flight take is now kept in a running total: it is
taken off the commit free and added to what the next one takes for the RAM share
and the RAM available. Wanted builds skip that check and are not counted.

Measured on an RX 7800 XT, 32 GB: with the share the same runs end at 600 s, the
13.8 MB program built at 97 s when the title bound it, and a 60 s smoke's peak
commit goes from 84 GB (main) to 27 GB.

Co-Authored-By: WebIdentity1 <WebIdentity1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rednaxeh added a commit to Rednaxeh/xcl that referenced this pull request Nov 25, 2026
The huge-pipeline gate (xcl-dev#1524, headroom by size since xcl-dev#1774) lets a compile on an
xcl-pso worker start when its commit headroom is free. That reading at the start
of a compile says nothing about what the title takes next: a retail title's
13.8 MB compute program (xcl-dev#1332 in the form of xcl-dev#1321) started at 4 s in the
background with 36 GB of commit free - its headroom is 7 GB - and, with the
title's own 25 GB of world loading after it, the AMD driver's ~15 GB for that
compile ran the process into the machine's commit limit at 28 - 34 s on 32 GB of
RAM, three times (twice with XCL_HUGE_PSO_CONCURRENCY=4, once with the defaults:
a title thread's page could not be committed).

A background compile now also needs what it takes (the headroom, or 1 GB per MB
of DXIL when that is more) to be within a share of the machine's RAM (a quarter;
XCL_HUGE_PSO_RAM_SHARE sets the n of 1/n, 0 leaves the commit free alone to
decide, as before) and within the RAM available now (under Wine the commit
reading is the memory available plus the free swap and never falls, as
Royalflamejlh measured in review). Such a program waits for a bind that wants
it (the gate's existing way out) and is built then, as a title thread would,
and the log says so once per program and worker. Compiles the title waits for,
and small ones, are unchanged.

A graphics bind resolves without waiting and did not mark its pipeline wanted,
so a graphics program the share holds back would have stayed a stand-in with
its worker in the gate: `resolve` now calls `want()` too (found, with the test
a_graphics_bind_releases_the_background_ram_share_gate, by WebIdentity1 in
review).

Every start read the same commit free, which the gated compiles already running
had not taken yet, so with XCL_HUGE_PSO_CONCURRENCY=8 on an RTX 4090 with 47 GB
of RAM (52.4 GB commit limit) 0.76 - 1.06 MB compiles started four at a time,
each "gated (waited 0 ms)", while the system's free commit went 3.8 -> 1.8 ->
0.9 GB and the process 32.8 -> 42.4 GB (found by @S1m0ne1997 on the PR). What
the background compiles in flight take is now kept in a running total: it is
taken off the commit free and added to what the next one takes for the RAM share
and the RAM available. Wanted builds skip that check and are not counted.

Measured on an RX 7800 XT, 32 GB: with the share the same runs end at 600 s, the
13.8 MB program built at 97 s when the title bound it, and a 60 s smoke's peak
commit goes from 84 GB (main) to 27 GB.

Co-Authored-By: WebIdentity1 <WebIdentity1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants