Skip to content

Scripts: cold driver benchmark of compute pipelines over thread counts (#2088) - #2129

Open
Creaa wants to merge 1 commit into
xcl-dev:mainfrom
Creaa:scripts/cold-pso-bench
Open

Creaa wants to merge 1 commit into
xcl-dev:mainfrom
Creaa:scripts/cold-pso-bench

Conversation

@Creaa

@Creaa Creaa commented Nov 25, 2026

Copy link
Copy Markdown

A reproducible cold benchmark of the compute-pipeline pass, for workstream 6 of #2088: every compute pipeline of a fixed input made again at each thread count with no warm cache, and a table of what each thread count costs. Part of #2088.

scripts/cold-pso-bench.ps1 fills a DXIL cache once (DXC, not timed), then for each thread count runs xcl shaders <input> --precompile --only cs --pipelines with XCL's driver blobs off (XCL_PSO_DISK_CACHE=0) and either the implicit D3D and driver shader caches off (XCL_PIPELINE_CACHE_OFF=1, needs Developer Mode) or the NVIDIA DXCache folder emptied (-ClearNvCache). It prints wall and CPU time, peak commit, pipelines made/refused, summed driver time and p50/p95/max per pipeline, the same per DXIL size bucket, and writes summary.csv.

What is in it

  • crates/xcl/src/shaders.rs: XCL_PIPELINE_TIMES=<file> writes one CSV line per pipeline of --pipelines (DXIL hash and bytes, made/reused/refused, slot wait ms, ms inside CreateComputePipelineState); XCL_PIPELINE_CACHE_OFF=1 turns the implicit caches off for the pass or refuses to run, through the helper --measure-pso already used (taken out of it and shared); the setup error no longer says "no GPU device" when the cause is the cache switch. Test: pipeline_timing_lines_name_the_dxil_outcome_and_both_times.
  • scripts/cold-pso-bench.ps1 and scripts/cold-pso-bench.tests.ps1 (fixture xcl.cmd: the environment and arguments of each run, the summary and bucket rows).

Tested

  • RTX 4070 12 GB (driver 617.14, 32-lane waves, split wave64), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2602.17; debug for the tests, release for the benchmark and the smoke runs.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 1155 passed, 0 failed, 46 ignored. SKIPPED: the wave64 GPU tests (no wave64), the direct-DXIL f16/f32 cases refused per gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows) and pso_measurement_compiles_an_exact_synthetic_record (Developer Mode is off here).
  • powershell -File scripts\cold-pso-bench.tests.ps1: ok.
  • The benchmark itself, 67 compute programs (every 40th of a retail pack's 2 689, as single records in a folder), -ClearNvCache, one run per thread count:
threads wall s CPU s peak commit MB made driver s (sum) p50 s p95 s max s
4 558 2079 5 516 67 2 115 2.21 145 226
6 430 2202 6 246 67 2 314 2.50 153 255
8 424 2346 7 405 67 2 930 4.10 175 326
10 426 2339 9 273 67 3 401 5.30 226 354
12 415 2371 11 072 67 3 986 6.08 271 385
16 428 2406 12 013 67 5 126 8.25 323 428
20 433 2393 12 938 67 5 550 10.61 336 432
24 427 2352 13 570 67 5 596 12.24 336 427

By DXIL size at 4 / 12 / 24 threads, summed driver s: < 64 KiB (23 programs) 2.4 / 5.1 / 5.9; 64–256 KiB (23) 65 / 160 / 323; 256 KiB–1 MiB (9) 461 / 888 / 1 403; 1–4 MiB (12) 1 586 / 2 933 / 3 865.

On this machine the wall time stops improving at about 6 threads and the CPU time stays at ~2 100–2 400 s whatever the thread count: one process gets about 5.5 cores' worth of driver work. More threads only stretch each compile (p50 ×5.5, max ×1.9 from 4 to 24) and raise peak commit 2.5×. One run per thread count; the 12 programs of 1–4 MiB are most of the time.

Regression run

main:

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1495 (PresentX 1495)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 17499 MB

this PR:

xcl-smoke v1
commit: 386e3d479fba8c5f2e543d738b03eb237c97e17a
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1544 (PresentX 1545)
presents per 2 s (last 3): 60 60 48
device removals: 0
crashes: 0
peak commit: 17933 MB

The title run does not reach the changed code (xcl shaders only); it is the regression check the PR checks ask for.

Not tested

  • XCL_PIPELINE_CACHE_OFF=1 on hardware: Developer Mode is off here, so the numbers above use -ClearNvCache (NVIDIA's DXCache folder emptied before each run). Only its refusal path ran (the --measure-pso test's skip shows the same error).
  • AMD, other NVIDIA GPUs and drivers, a CPU with fewer cores, repeated runs per thread count.

AI use

  • Claude Code (Claude Opus 5.5) wrote the code, the script, the tests, ran the benchmark and the smoke pair on my machine, and drafted this description; I checked it.

🤖 Generated with Claude Code

xcl-dev#2088)

xcl-dev#2088 asks for reliable cold NVIDIA measurements of the compute-pipeline
pass at 4 to 24 workers. scripts/cold-pso-bench.ps1 fills a DXIL cache once
(DXC, not timed), then makes every compute pipeline of the same input again
for each thread count with XCL's driver blobs off and either the implicit D3D
and driver shader caches off (XCL_PIPELINE_CACHE_OFF=1, Developer Mode) or the
NVIDIA DXCache folder emptied (-ClearNvCache), and tabulates wall and CPU
time, peak commit, summed driver time and p50/p95/max per pipeline, also per
DXIL size bucket.

xcl shaders --pipelines gets the two switches it needs:
- XCL_PIPELINE_TIMES=<file>: one CSV line per pipeline (DXIL hash and bytes,
  made/reused/refused, slot wait and time in CreateComputePipelineState);
- XCL_PIPELINE_CACHE_OFF=1: the pass turns the implicit caches off through
  the helper --measure-pso already used (now shared), or refuses to run.

On an RTX 4070 (617.14, i7-13700F), 67 compute programs (every 40th of a
retail pack), cold: wall time 558 s at 4 threads, 430 s at 6 and 415-432 s
from 8 to 24, CPU time ~2100-2400 s throughout, while summed driver time grew
2.6x and peak commit 5.5 -> 13.6 GB.

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

Copy link
Copy Markdown
Contributor

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

Thanks!

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@bielfreedom

Copy link
Copy Markdown

AMD RDNA4 run of cold-pso-bench.ps1: on AMD Windows the script's two modes either refuse to run or give warm numbers labelled cold. A per-run exe name keeps every run cold.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11 without Developer Mode.
  • Build: this PR at 386e3d4, release.
  • Input: retail pack, -Limit 22300 (143 compute pipelines).

1. Default mode (XCL_PIPELINE_CACHE_OFF=1) without Developer Mode: the script stops on the first thread count with
no pipelines can be made: cannot disable the driver cache (Windows Developer Mode is required): ... (0x887A002D).
That is the intended refusal, and it works.

2. -ClearNvCache on AMD: the second run at the same thread count is warm but reported as cold.
-Threads 4,4 -ClearNvCache:

run wall s CPU s peak commit MB made driver s (sum) p95 s max s
1st, 4 threads 129.8 487.1 11,247 143 471.6 23.71 37.16
2nd, 4 threads 1.8 19.3 554 143 0.1 0 0.01
  • All 143 rows say made, not reused, so nothing in the table shows that run 2 hit a cache.
  • The cause is the AMD driver's own shader cache, which -ClearNvCache doesn't touch. As I measured for A26, it is keyed on the exe's file name (not the path, not the binary). Every run here uses the same xcl.exe.
  • So any multi-thread-count sweep on AMD with -ClearNvCache gives one cold row and warm rows after it.

3. A fresh exe name per run keeps AMD cold. I copied xcl.exe to a new name for each run and passed it with -Xcl; still -ClearNvCache, 4 threads:

run exe wall s driver s (sum) p95 s max s
1 xcl_bench_amd_1.exe 130.5 474.9 23.64 37.29
2 xcl_bench_amd_2.exe 130.8 476.9 23.89 37.53

Both match the first cold run above (471.6 s) within 1 %.

Suggestion

  • When the cache switch is off, copy -Xcl to a unique name per run (for example xcl-cold-<threads>-<n>.exe in $Out, with its DLLs). Run that copy. That covers AMD without Developer Mode, and it costs nothing on NVIDIA.
  • Alternatively, an -ClearAmdCache switch that empties %LOCALAPPDATA%\AMD\DxcCache would work, but it drops other applications' entries, just like -ClearNvCache does. I haven't tested whether deleting that folder alone is enough.
  • Also worth checking: whether ShaderCacheControl(DISABLE) actually turns the AMD driver's cache off when Developer Mode is on. I couldn't test that here.

Not tested

  • Developer Mode on AMD.
  • Thread counts other than 4.
  • The full pack.
  • RDNA2 and RDNA3.

AI use: Claude Code (Claude Opus 5.5) ran the script and drafted this. Counts and timings only, no game data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants