Skip to content

Shaders: share compiled DXIL across pipeline builds - #2085

Open
rison1337 wants to merge 1 commit into
xcl-dev:mainfrom
rison1337:perf/share-compiled-dxil
Open

rison1337 wants to merge 1 commit into
xcl-dev:mainfrom
rison1337:perf/share-compiled-dxil

Conversation

@rison1337

Copy link
Copy Markdown

The translated shader cache owns an Arc<Compiled>, but console_to_dxil_in clones its DXIL and samplers before returning. Repeated pipeline builds therefore allocate and copy bytecode that is already cached. Return the shared owner and keep it alive while the driver consumes the bytecode.

What is in it

  • Return Arc<Compiled> from the console-to-DXIL entry points.
  • Borrow compute and graphics bytecode during PSO creation. Keep the merged graphics sampler list owned by its caller and preserve the two-pass pixel-shader ownership.
  • Add a regression test that checks repeated public shader requests reuse the same DXIL buffer and preserve its contents.

Tested

  • AMD Ryzen 5 7500F, NVIDIA RTX 4060 8 GB, NVIDIA 615.78.08, CachyOS Linux 7.3.0-2-cachyos, rustc 1.99.1.
  • Cross-built Windows x86_64-pc-windows-gnullvm binaries on Linux. Release build succeeded.
  • Ran the library tests under gpu::recomp::pso:: using Proton Experimental Wine, DXC 1.9.2609.5 and vkd3d-proton 3.2.0 with the compatibility patch from Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257. 17 passed, 0 failed, 1 ignored. The ignored test is the existing opt-in benchmark.
  • Ran retail_vs_ps_through_the_pso_hook_render_and_read_back under the same environment with a local shader pack. 1 passed, 0 failed. Checked 435 pixels inside and 3501 outside the triangle. No GPU skips in these focused runs.
  • Ran the existing repeated-request benchmark separately. Its small shader remained within measurement noise. End-to-end loading and FPS impact are unmeasured.

Regression run

Paired retail smoke runs on main and this head commit remain to be collected.

Not tested

  • Native Windows and AMD.
  • The complete workspace GPU suite on this change.
  • The required paired main/head retail smoke runs.

AI use

Codex (gpt-6.1-sol) prepared the code, regression test and description and ran the listed Linux checks.

Return the cached Arc<Compiled> to pipeline builders so repeated shader requests reuse the compiled storage. Keep the VS and PS owners alive while the driver consumes their bytecode.

Assisted-by: Codex (gpt-6.1-sol)
@JJAutoCompare

Copy link
Copy Markdown

PR #2085 native Windows compatibility check

Tested

  • PR #2085 was open at e56e7f57b430e9e30a173f59d2cfbd1f1941f647 before and after the run. The assigned checkout was clean and detached at that SHA both times. The PR description reports Wine testing, and the live discussion contained no independent native Windows report for this head.
  • STOR-WINLAB, Windows 11 Enterprise Evaluation x64 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175 installed. Rust 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc), Cargo 1.100.0 (3acc79c0c), MSVC 19.44.35230.0, linker 14.44.35230.0. The test log confirms DXC and DXIL 1.9.2609.5 loaded from the assigned XCL_DXC_DIR.
  • 1 passed, 0 failed, 0 ignored, 0 skipped. Cargo exited 0. The harness selected one test, filtered out 1,124, and finished in 0.06 s. There were no SKIPPED markers. The fixture uses CPU/DXC and has no optional GPU path.
  • The checked-in test requested the same synthetic compute shader twice through console_to_dxil. Both requests succeeded and the assertions verified identical DXIL bytes, identical static sampler lists, and the same DXIL buffer pointer while both results were live. The fresh shader cache produced a 2,308-byte DXIL container and a translated cache record with a byte-for-byte matching payload and zero static samplers.
cargo test --locked -p xcl --lib -- gpu::recomp::pso::compile_time_bench::repeated_console_shader_requests_share_dxil --exact --nocapture --test-threads=1

The run used the unoptimized test profile with CARGO_PROFILE_DEV_DEBUG=0, CARGO_PROFILE_TEST_DEBUG=0, CARGO_BUILD_JOBS=2, and CARGO_INCREMENTAL=0. It reused L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target. TEMP, TMP, and an initially empty XCL_DXIL_CACHE were scoped to this run directory under L:/XclTooling/pr2085. The command, stdout, stderr, exit status, environment, and final verification logs are alongside this report. The assigned checkout and target slot are released.

Not tested

  • Nonempty static sampler lists, GPU dispatch, driver PSO creation, retail titles or smoke runs, the rest of the suite, and earlier revisions.

AI use

  • T3 Code / Codex (gpt-6.2-sol) ran the checked-in test, inspected the assertions and artifacts, and wrote this report.

@Anon64

Anon64 commented Nov 25, 2026

Copy link
Copy Markdown

Regression run for this PR: head e56e7f5, based on main cbc296a. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, back to back with the main run.

main cbc296a:

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1490 (PresentX 1491)
presents per 2 s (last 3): 49 13 1
device removals: 0
crashes: 0
peak commit: 24762 MB

this PR:

xcl-smoke v1
commit: e56e7f57b430e9e30a173f59d2cfbd1f1941f647
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1510 (PresentX 1510)
presents per 2 s (last 3): 51 12 2
device removals: 0
crashes: 0
peak commit: 24915 MB

No device removals or crashes; 101 % of main's frames, 100 % of its peak commit.

Not tested: the whole suite; world loading; whether these 60 s build pipelines that share DXIL.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

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.

3 participants