Skip to content

[upstream #1804] Shaders: --precompile --pipelines skips cached PSOs after canary check - #331

Open
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1804
Open

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1804

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Resumed xcl shaders --precompile --pipelines runs previously fed every already-cached .pso blob back into ID3D12Device::CreateComputePipelineState on a single long-lived device, and precompile() initialized runner::GPU's static ID3D12Device singleton just to query wave32/wave64 flags. Part of xcl-dev#1657 and xcl-dev#1269.

What is in it

  • crates/xcl/src/shaders.rs:
    • Add CacheTrust canary check and has_cached_blob: verify the first existing .pso blob against the active device/driver, then skip CreateComputePipelineState, root-signature lookup, and disk reads for further non-empty cached blobs (falling back to per-blob verification and rebuild if a cached blob is rejected after a driver/adapter change or corruption).
    • Drop cached blob bytes before any fallback uncached compile, and guard RunningSlot and ComputePsoDesc root-signature release with RAII Drop guards.
    • Add resolve_split_flags and query pso::graphics_wave32_for_device / pso::wave32_only_for_device directly from Pipelines::dev instead of initializing runner::GPU's static singleton.
    • Add unit tests: has_cached_blob_requires_non_empty_file, running_slot_releases_on_drop_and_unwind, resolve_split_flags_prefers_explicit_then_device_then_runner, cache_trust_skips_after_canary_hit_and_verifies_all_after_reject.
  • crates/xcl/tests/gpu_compute_e2e.rs: update offline_compute_pipeline_is_reused_by_a_second_process for the new cached-blob accounting while preserving stale/corrupt .pso rebuild coverage.

Tested

  • Hardware: NVIDIA GeForce RTX 3050 6GB Laptop GPU (32.0.16.2124), Intel Core i5-12450HX, 24 GB RAM, Windows 11 Pro (10.0.26300), rustc 1.100.0, Windows SDK 10.0.26100.0 (dxcompiler.dll / dxil.dll 1.9.2602.17), debug tests + release smoke.
  • XCL_ADAPTER="rtx 3050" .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4): 867 passed, 0 failed, 42 ignored (all 4 new unit tests + offline_compute_pipeline_is_reused_by_a_second_process passed).
  • SKIPPED GPU tests on this adapter (3): 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).

Regression run

xcl-smoke v1
commit: 6c89285b8b529bde59cd17a26b911c39912fb677
gpu: NVIDIA GeForce RTX 3050 6GB Laptop GPU
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 281 (PresentX 281)
presents per 2 s (last 3): 17 16 18
device removals: 0
crashes: 0
peak commit: 15401 MB
xcl-smoke v1
commit: 97e501e0dee3cf6e696b0539feb6e00f546afc1c
gpu: NVIDIA GeForce RTX 3050 6GB Laptop GPU
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1503 (PresentX 1503)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14683 MB

(Note: main populated cold caches while the PR run had warm caches; smoke.ps1 does not exercise xcl shaders --precompile --pipelines, which is covered by offline_compute_pipeline_is_reused_by_a_second_process and the new unit tests.)

Not tested

  • Full retail multi-hundred-pipeline --precompile --only cs --pipelines endurance run, AMD / Intel GPUs, XCL_HEAP_WINDOWS=1, and XCL_SAMPLE_* tests.

AI use


Mirror of xcl-dev#1804 (auto-synced, do not edit).

Resumed `xcl shaders --precompile --pipelines` runs previously fed every already-cached `.pso` blob back into `ID3D12Device::CreateComputePipelineState` on the long-lived device, and `precompile()` initialized `runner::GPU`'s static D3D12 device singleton just to query wave32/wave64 flags.

- Verify the first existing `.pso` blob against the active device/driver as a canary (`CacheTrust`): once accepted, skip `CreateComputePipelineState` and disk reads for further non-empty cached blobs; if a cached blob is rejected (stale/corrupt), keep verifying and rebuilding blobs.
- Drop cached bytes before any fallback uncached compile, and guard `RunningSlot` and `ComputePsoDesc` root signature cleanup with RAII Drop guards.
- Query `graphics_wave32_for_device` / `wave32_only_for_device` directly from `Pipelines::dev` instead of initializing `runner::GPU`.

Part of xcl-dev#1657, xcl-dev#1269.
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.

2 participants