Skip to content

Shaders: --precompile --used-only builds only the pipelines a title used - #1982

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
Eterst:shaders/precompile-used-only
Nov 25, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
Eterst:shaders/precompile-used-only

Conversation

@Eterst

@Eterst Eterst commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

xcl shaders <pack> --precompile --pipelines --used-only builds only the compute programs whose pipeline an earlier run of the title used. A retail pack's ~2 700 compute programs take a 32-lane NVIDIA card's driver hours, most of them programs the title never binds in the part it reached. The runtime already notes every pipeline a title uses by a hash of its shaders (used-pipelines.txt beside the DXIL cache, read by pso_async to build them ahead in the next run); this reads the same file and computes the same key. Part of #1269.

What is in it

  • crates/xcl/src/shaders.rs: --used-only, used_compute (the pipeline key of a compute program as the runtime makes it, real::shaders_key of the one shader), the count of programs passed over in the summary; test used_only_keeps_the_compute_programs_an_earlier_run_used.
  • crates/xcl/src/hle/d3d12x/pso_async.rs: earlier_used_keys() reads used-pipelines.txt with the existing parser.
  • crates/xcl/src/hle/d3d12x/real.rs: shaders_key is pub(crate).
  • README.md: the option, next to --pipelines.

Tested

  • NVIDIA GeForce RTX 4070 SUPER 12 GB (driver 616.92, 32-lane waves), Ryzen 7 5700X, 32 GB; Windows 10 22H2 (19045); Rust 1.100.0 MSVC; debug for the suite, release for the smoke run and the precompile.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 on 354ce0c: 975 passed, 1 failed, 45 ignored; the failure is hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory, which fails now and then on main too on this machine (3 of 8 parallel main runs); cargo test -p xcl --lib -- --test-threads=4 again: 927 passed, 0 failed, 25 ignored. SKIPPED on this adapter: the same no-wave64 GPU tests as on main.
  • A retail pack with the used-pipelines.txt of a few title runs (1 221 keys), XCL_DIRECT_DXIL=1: 824 compute programs built, 1 865 passed over, 0 errors in 43 min. The title then made its compute pipelines from those driver blobs.

Regression run

main:

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: NVIDIA GeForce RTX 4070 SUPER
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1515 (PresentX 1515)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16570 MB

this PR:

xcl-smoke v1
commit: 354ce0c7189d0820ddf7d05bc5c662013ff7a5f4
gpu: NVIDIA GeForce RTX 4070 SUPER
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1589 (PresentX 1589)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15602 MB

Not tested

  • AMD and Intel GPUs; Wine.
  • The runtime is unchanged apart from shaders_key becoming pub(crate); the smoke runs do not use the new option.
  • Programs a title reaches only later are not in used-pipelines.txt until a run reaches them; a full --precompile still builds everything.

AI use

  • Claude Code (Claude Opus 5.5): wrote the option, the test and this description, and ran the tests, the precompile and the smoke runs.

🤖 Generated with Claude Code

A retail pack's ~2 700 compute programs take a 32-lane NVIDIA card's driver hours to build,
most of them programs the title never binds in the part it reached. The runtime already
notes every pipeline a title uses by a hash of its shaders (`used-pipelines.txt` beside the
DXIL cache, read by `pso_async` to build them ahead next run). `--used-only` reads that file
and passes over every compute program whose pipeline key (`real::shaders_key` of the one
shader, as the runtime makes it) is not in it.

Measured on a retail pack with the list of a few runs (1 221 keys): 824 compute programs
built, 1 865 passed over.

Test: used_only_keeps_the_compute_programs_an_earlier_run_used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Eterst
Eterst marked this pull request as ready for review November 25, 2026 00:26
@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 354ce0c (on its base 689f2db).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 966 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: used_only_keeps_the_compute_programs_an_earlier_run_used.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 975 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@raylitebull

Copy link
Copy Markdown
Member

Code review on 354ce0c:

  • pso_async::earlier_used_keys() (used-pipelines.txt), exposing real::shaders_key (pub(crate)), and filtering compute precompilation via used_compute when --used-only is set (used_only_keeps_the_compute_programs_an_earlier_run_used) are clean and well-scoped.
  • Diff audited and CI workflow approved (currently running).

Remaining before merge: Build and test (Windows, no GPU) finishing green plus an AMD verification pass on 354ce0c.

@JJAutoCompare

Copy link
Copy Markdown

PR #1982 test report

xcl-dev/xcl — Shaders: --precompile --used-only builds only the pipelines a title used.

  • Tested detached head 354ce0c7189d0820ddf7d05bc5c662013ff7a5f4, fetched from refs/pull/1982/head on origin.
  • Fetched origin/main at 86719eec1e9fc4c36c5fb568ec4951fd47a31b88. git merge-tree --write-tree origin/main HEAD exited 0 and produced tree 995d6d1a3b7265a83eb20460ccc3a5374e91969a. The tracked checkout was clean.
  • I initialized the assigned L:\XclTooling\neon-slot-3 slot because it lacked a Git checkout. The run used the slot's target, temp and DXIL cache directories.

Tested

  • STOR-WINLAB, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175, DoublePrecisionFloatShaderOps=0, wave range 8–32), Windows 11 Enterprise Evaluation build 26200.9974, DXC/DXIL 1.9.2609.5. rustc -V reported rustc 1.100.0 (0ef1bc386 2026-11-09). Cargo dev/test profiles, unoptimized with debug symbols and incremental compilation disabled.
  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the GPU lock.
  • cargo test -p xcl --lib <filter> -- --show-output ran each of used_only_keeps_the_compute_programs_an_earlier_run_used, the_keys_of_a_file_are_read_and_other_lines_passed_over and a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use outside the lock. Each returned 1 passed, 0 failed, 0 ignored and 0 skipped.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output ran once under Invoke-ArcTest.ps1 with process-local execution policy Bypass and XCL_ADAPTER=A770. Cargo exit 101. Across 19 test binaries and one doc-test target, Cargo reported 951 passed, 25 failed, 45 ignored. The 951 include 15 tests that emitted 25 SKIPPED notices. The skipped tests and subcases do not count as coverage. The two failing targets were xcl --lib (24) and xcl --test e2e (1).
  • Full log at L:\XclTooling\neon-slot-3\tmp\pr1982-suite.log.

Failures

  • CreateComputePipelineState returned 0x80070057 in 20 tests.
    • gpu::dxil::fuzz_tests — fuzz_validate_and_gpu_0 (seed 2), fuzz_validate_and_gpu_1 (506), fuzz_validate_and_gpu_2 (1003), fuzz_validate_and_gpu_3 (1501).
    • gpu::dxil::ops_tests — doubles_match_cpu, groupshared_barrier_and_atomics_run.
    • gpu::dxil::round_tests — gpu_direct_f32_round_modes_static, gpu_direct_f32_round_modes_dynamic_and_denormals.
    • gpu::recomp::lower_dxil::tests — f64_programs_on_the_gpu.
    • gpu::recomp::tests — gpu_clamp_and_omod_per_instruction, gpu_f64_literal_high_word, gpu_f64_compares_with_nan, gpu_f64_class_compare, gpu_f64_roots, gpu_f64_math_random, gpu_f64_rounding_and_conversions, gpu_frexp_f64_exp_and_mant, gpu_float_compares_random, gpu_ldexp_f64, gpu_rndne_f64.
  • gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction — v_fma_f32 overflow control returned bits 2139095040, expected 1946157055.
  • gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips — pixel (0,0) measured 25.609375, expected 26.
  • gpu::recomp::tests::gpu_valu_16_and_64_bit — lane 0 v_add_f16 failed the high-half preservation assertion.
  • gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions — pixel 0 min/sum reduction returned [2, 217, 2], expected [2, 216, 2].
  • e2e::test_title_runs_and_game_folder_is_untouched — dynamic depth bias (RSSetDepthBiasX(-1000.5), Split wave64: masks read only lane by lane stay in their half #94) produced a blue top-right pixel, expected green.

SKIPPED notices

  • SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
  • SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
  • SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
  • SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))
  • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))
  • SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
  • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
  • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
  • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
  • SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
  • SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
  • SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
  • SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

Not tested

  • Retail-title --precompile --used-only behavior and the required scripts/smoke.ps1 -Game <folder> comparison between main and PR head. Main was checked for mergeability only, so the test failures have no same-run baseline.
  • AMD/NVIDIA, wave64 hardware, and optional XCL_SAMPLE_* paths. No sample variables were set for this run.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against pr1982-suite.log and published this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

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.

5 participants