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
Contributor

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). Every measured run turns off the 8 MiB DXIL cap of --pipelines (XCL_PIPELINE_MAX_KB=0): a capped program writes no timing line, so the summary would leave out the biggest programs (found by @bmjask in review); the fixture checks the variable for each run. With -ClearNvCache the runs set XCL_PIPELINE_CACHE_OFF=0, so a caller's =1 does not come back through the inherited environment. Wall time is taken from the process's start and exit times and peak commit from PeakPagefileUsage on its handle, so short runs are not under-reported (@RavenCurseBurg's change, co-authored). The fixture runs with its own LOCALAPPDATA and no inherited XCL_PIPELINE_TIMES / XCL_PIPELINE_CACHE_OFF, so its -ClearNvCache case cannot empty a real NVIDIA cache or add rows to a real timing file (found and fixed by @itsSio in review, co-author of the commit). Every measured run starts a copy of -Xcl under a name of its own, next to the original (so it finds the same DXC and Agility SDK folders), and removes it afterwards: the AMD driver keys its shader cache on the exe's file name, so with -ClearNvCache on AMD every run after the first was warm but reported as cold (found and measured on RDNA4 by @bielfreedom in review, co-author of the commit); the fixture checks that each run gets a new name and that no copy is left. -Threads is read as text and split on commas: from cmd or bash, powershell -File ... -Threads 4,8 passes one string, which the [int[]] parameter silently read as 48 threads; the fixture runs that form through -File and checks it gives two runs, and that -Threads 4,x is refused.

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 --no-fail-fast -- --test-threads=4: 1424 passed, 0 failed, 46 ignored (rebased onto main e1d84b7). 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), pso_measurement_compiles_an_exact_synthetic_record (Developer Mode is off) and the D3D12 debug-layer tests.
  • powershell -File scripts\cold-pso-bench.tests.ps1: ok; also run from a caller with a cache folder holding a sentinel, a timing CSV with rows and XCL_PIPELINE_CACHE_OFF=1 set: all three unchanged afterwards (without the fix the run fails on the inherited timing file). With the per-run exe name: the fixture test fails on the previous script (xcl instead of xcl-cold-4-<id>) and passes now, as does the -File -Threads 3,5 case (one run of 35 threads before); a real run on the RTX 4070 (-Limit 12 -ClearNvCache, release build of this head) made 12 of 12 pipelines through the copy and left no copy behind.
  • 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: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1414 (PresentX 1414)
presents per 2 s (last 3): 59 61 60
device removals: 0
crashes: 0
peak commit: 15420 MB

this PR:

xcl-smoke v1
commit: 30a3ef1055ed5da9d04a6ca667996112756486c1
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1552 (PresentX 1553)
presents per 2 s (last 3): 60 60 44
device removals: 0
crashes: 0
peak commit: 17980 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 with the per-run exe name (its effect there is @bielfreedom's measurement with hand-made copies, not a run of this script), 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

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

@itsSio

itsSio commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

As a small follow-up to the two-GPU check, I prepared and verified the fixture-only patch below: route the -ClearNvCache case to a temporary cache with a sentinel and keep inherited timing variables from contaminating fixture output. I won't change the benchmark or open a competing PR.

Tested: At 386e3d479fba8c5f2e543d738b03eb237c97e17a, the isolated fixture passed on Windows 11 build 26200 on both PCs (RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GiB, Rust 1.97.0, DXC 1.9.2609.5; RTX 2080 SUPER 8 GB, Ryzen 5 5600X, 16 GiB, Rust 1.99.1, DXC 1.8.2502.11; driver 610.88). The original inherited-environment run failed on the 2080 SUPER because preparation also wrote to the timing file. The linked report has exact workspace counts and commands.

With this patch applied to the exact head above, powershell -NoProfile -File <caller-check> -Fixture scripts/cold-pso-bench.tests.ps1 passed on both PCs (1 passed, 0 failed, 0 ignored or skipped per PC). The caller check preloads a timing file and cache flag, points the caller at a fake cache with a sentinel, runs the fixture in the same PowerShell process, then checks the caller file, sentinel and environment are unchanged. The fixture checks its own sandbox sentinel was removed.

Not tested: No runtime files changed. No retail smoke or new driver timings; this is a test-script-only patch.

AI use

Ran via Samaritan:

  • OpenCode (GPT-6.2 Sol): diagnosed the fixture behavior, tested the isolation wrapper on both PCs, and prepared this follow-up.
Verified patch for this PR
diff --git a/scripts/cold-pso-bench.tests.ps1 b/scripts/cold-pso-bench.tests.ps1
index e1be6f8..5982e93 100644
--- a/scripts/cold-pso-bench.tests.ps1
+++ b/scripts/cold-pso-bench.tests.ps1
@@ -5,7 +5,17 @@ $ErrorActionPreference = 'Stop'
 $bench = Join-Path $PSScriptRoot 'cold-pso-bench.ps1'
 $fixture = Join-Path ([IO.Path]::GetTempPath()) ('xcl-cold-pso-' + [guid]::NewGuid())
 $null = New-Item -ItemType Directory -Path $fixture
+$savedAppData = $env:LOCALAPPDATA
+$savedTimes = $env:XCL_PIPELINE_TIMES
+$savedCacheOff = $env:XCL_PIPELINE_CACHE_OFF
 try {
+    # The fixture must never clear the user's driver cache or append to a real timing file.
+    $env:LOCALAPPDATA = Join-Path $fixture 'local-appdata'
+    $cache = Join-Path $env:LOCALAPPDATA 'NVIDIA\DXCache'
+    $null = New-Item -ItemType Directory -Path $cache
+    $sentinel = Join-Path $cache 'sentinel'
+    [IO.File]::WriteAllText($sentinel, 'temporary fixture cache')
+    Remove-Item Env:XCL_PIPELINE_TIMES, Env:XCL_PIPELINE_CACHE_OFF -ErrorAction SilentlyContinue
     $xcl = Join-Path $fixture 'xcl.cmd'
     # A pipelines run (XCL_PIPELINE_TIMES set) writes four builds and the environment it saw.
     [IO.File]::WriteAllText($xcl, (@(
@@ -36,7 +46,11 @@ try {
     & $bench -Shaders 'D:\pack' -Threads 6 -Xcl $xcl -Out (Join-Path $fixture 'out2') -ClearNvCache *> $null
     $seen = (Get-Content (Join-Path $fixture 'env-6.txt') -Raw).Trim()
     if ($seen -notmatch '^0 +shaders D:\\pack --precompile --only cs --pipelines$') { throw "-ClearNvCache: caches switch still set: $seen" }
+    if (Test-Path -LiteralPath $sentinel) { throw '-ClearNvCache: temporary cache was not cleared' }
     'cold-pso-bench.ps1: ok'
 } finally {
+    $env:LOCALAPPDATA = $savedAppData
+    $env:XCL_PIPELINE_TIMES = $savedTimes
+    $env:XCL_PIPELINE_CACHE_OFF = $savedCacheOff
     Remove-Item -Recurse -Force $fixture -ErrorAction SilentlyContinue
 }

Follow-up on the revised script (8b69014)

Tested: Clean 8b690141096f61a663500c4dc5e0f47240529d70, Windows 11 Pro build 26200, debug MSVC. cargo build --workspace --locked -j 4 and cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --nocapture both exited 0 on each Windows PC.

System Workspace Runtime skips
RTX 5080 16 GB, NVIDIA 610.88; Ryzen 7 9800X3D, 32 GiB, Rust 1.97.0, DXC 1.9.2609.5 1,155 passed, 0 failed, 46 ignored 25: 20 no native wave64, three unsupported per-lane cases, no heap windows, cache-disable unavailable
RTX 2080 SUPER 8 GB, NVIDIA 610.88; Ryzen 5 5600X, 16 GiB, Rust 1.99.1, DXC 1.8.2502.11 1,155 passed, 0 failed, 46 ignored 27: same plus two missing D3D12 debug-layer cases

The PowerShell fixture passed on both PCs. Then ran the unmodified scripts/cold-pso-bench.ps1 -Shaders <synthetic-records> -Threads 2,4 -Xcl <debug-xcl> -Out <isolated-output> -ClearNvCache -TimeoutMinutes 3 with a disposable LOCALAPPDATA, XCL_DATA_ROOT, and explicit XCL_ADAPTER. Only the disposable NVIDIA cache path was targeted. Each worker count made 12 pipelines, 0 refused, 0 XCL driver-blob reuses, and no per-run executable copies remained.

Adapter 2 workers: wall / summed driver / peak commit 4 workers: wall / summed driver / peak commit
RTX 5080 3.8 s / 5.7 s / 231 MB 2.2 s / 6.4 s / 313 MB
RTX 2080 SUPER 7.2 s / 12.1 s / 229 MB 5.1 s / 15.1 s / 347 MB
Radeon RDNA2 iGPU, driver 32.0.21043.5001 (9800X3D system above) 3.4 s / 6.1 s / 318 MB 2.3 s / 7.1 s / 501 MB

Not tested: Actual implicit driver-cache misses, full AMD workspace, retail smoke, and repeated or larger samples. Fresh executable names and made rows alone do not prove cold cache status; the table is an end-to-end check, not a scaling recommendation.

AI use

Ran via Samaritan:

  • OpenCode (GPT-6.2 Sol): ran and audited the two-PC checks and wrote this follow-up.

Peak commit for runs shorter than the sampling interval

The current once-per-second sampler leaves peak commit at zero if the process exits before the first sample. The script-only patch below reads Windows' lifetime PeakPagefileUsage from the retained process handle after exit, without changing the benchmark's timeout, cache options, or CSV schema.

Tested: Base 8b690141096f61a663500c4dc5e0f47240529d70; candidate is that head plus the diff below. Same Windows, GPU, CPU, RAM, driver, Rust and DXC configurations as above. Ran powershell -NoProfile -File scripts/cold-pso-bench.tests.ps1: strengthened fast-exit assertion failed on the RTX 5080 before the fix and passed on both PCs after it (one fixture run passed per PC, no skips). On each PC ran scripts/cold-pso-bench.ps1 -Shaders <one-record directory> -Threads 2 -Xcl <debug-xcl> -Out <isolated output> -ClearNvCache -TimeoutMinutes 2, with the same synthetic shader, disposable LOCALAPPDATA and XCL data directory. Each baseline and candidate run exited 0 with one pipeline made, zero refused and zero XCL blob reuses. RTX 5080: 0 MB reported → 110 MB; RTX 2080 SUPER: 0 MB reported → 96 MB. These are corrected measurements, not a memory increase or reduction.

Not tested: Retail titles, confirmed cold driver-cache status, or PowerShell 7. No Rust code changed; workspace results above are from the unchanged pinned binary.

AI use

Ran via Samaritan:

  • OpenCode (GPT-6.2 Sol): reproduced the zero reading, implemented the counter and fixture check, ran both PC comparisons, and prepared the diff.
Verified peak-commit patch
diff --git a/scripts/cold-pso-bench.ps1 b/scripts/cold-pso-bench.ps1
index de2678e..1c2734d 100644
--- a/scripts/cold-pso-bench.ps1
+++ b/scripts/cold-pso-bench.ps1
@@ -72,6 +72,35 @@ function Get-Summary($Rows) {
     [pscustomobject]$s
 }
 
+# Windows retains the lifetime peak commit while a handle to the process is open.
+if (-not ('XclBenchmarkMemory' -as [type])) {
+    Add-Type -TypeDefinition @'
+using System;
+using System.Runtime.InteropServices;
+
+public static class XclBenchmarkMemory {
+    [StructLayout(LayoutKind.Sequential)]
+    struct Counters {
+        public uint Size, PageFaults;
+        public UIntPtr PeakWorkingSet, WorkingSet, PeakPagedPool, PagedPool;
+        public UIntPtr PeakNonpagedPool, NonpagedPool, Commit, PeakCommit;
+    }
+
+    [DllImport("psapi.dll", SetLastError = true)]
+    static extern bool GetProcessMemoryInfo(IntPtr process, ref Counters counters, uint size);
+
+    public static ulong PeakCommit(IntPtr process) {
+        var counters = new Counters();
+        counters.Size = (uint)Marshal.SizeOf(typeof(Counters));
+        if (!GetProcessMemoryInfo(process, ref counters, counters.Size)) {
+            throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error());
+        }
+        return counters.PeakCommit.ToUInt64();
+    }
+}
+'@
+}
+
 # One `xcl shaders` run with the given environment; wall and CPU time, peak private commit.
 function Invoke-Xcl([string[]]$Arguments, [hashtable]$Environment, [string]$Exe = $Xcl) {
     $psi = New-Object System.Diagnostics.ProcessStartInfo
@@ -82,14 +111,20 @@ function Invoke-Xcl([string[]]$Arguments, [hashtable]$Environment, [string]$Exe
     $psi.RedirectStandardError = $true
     foreach ($k in $Environment.Keys) { $psi.EnvironmentVariables[$k] = [string]$Environment[$k] }
     $p = [System.Diagnostics.Process]::Start($psi)
-    $stdout = $p.StandardOutput.ReadToEndAsync(); $stderr = $p.StandardError.ReadToEndAsync()
-    $watch = [Diagnostics.Stopwatch]::StartNew(); $peak = 0L
-    while (-not $p.WaitForExit(1000)) {
-        try { $p.Refresh(); $peak = [math]::Max($peak, $p.PrivateMemorySize64) } catch { }
-        if ($watch.Elapsed.TotalMinutes -gt $TimeoutMinutes) { $p.Kill(); throw "xcl ran over $TimeoutMinutes minutes" }
+    try {
+        $handle = $p.Handle
+        $stdout = $p.StandardOutput.ReadToEndAsync(); $stderr = $p.StandardError.ReadToEndAsync()
+        $watch = [Diagnostics.Stopwatch]::StartNew()
+        while (-not $p.WaitForExit(1000)) {
+            if ($watch.Elapsed.TotalMinutes -gt $TimeoutMinutes) { $p.Kill(); throw "xcl ran over $TimeoutMinutes minutes" }
+        }
+        $p.WaitForExit()
+        $watch.Stop()
+        $peak = [XclBenchmarkMemory]::PeakCommit($handle)
+        [pscustomobject]@{ Exit = $p.ExitCode; WallS = [math]::Round($watch.Elapsed.TotalSeconds, 1); CpuS = [math]::Round($p.TotalProcessorTime.TotalSeconds, 1); PeakMB = [math]::Round($peak / 1MB); Out = $stdout.Result + $stderr.Result }
+    } finally {
+        $p.Dispose()
     }
-    $p.WaitForExit()
-    [pscustomobject]@{ Exit = $p.ExitCode; WallS = [math]::Round($watch.Elapsed.TotalSeconds, 1); CpuS = [math]::Round($p.TotalProcessorTime.TotalSeconds, 1); PeakMB = [math]::Round($peak / 1MB); Out = $stdout.Result + $stderr.Result }
 }
 
 $common = @('shaders', $Shaders, '--precompile', '--only', 'cs')
diff --git a/scripts/cold-pso-bench.tests.ps1 b/scripts/cold-pso-bench.tests.ps1
index 0a4d992..2fb2b5e 100644
--- a/scripts/cold-pso-bench.tests.ps1
+++ b/scripts/cold-pso-bench.tests.ps1
@@ -38,7 +38,8 @@ try {
         if ($seen -notmatch "^xcl-cold-$n-[0-9a-f]{8} 0 1 shaders D:\\pack --precompile --only cs --limit 10 --pipelines$") { throw "threads ${n}: exe name, environment or arguments wrong: $seen" }
         $names += ($seen -split ' ')[0]
         # made: 0.1 + 0.3 + 5.0 s; p50 of three is the second, p95 and max the third
-        if ($table -notmatch "\| $n \| [\d.]+ \| [\d.]+ \| \d+ \| 3 \| 1 \| 5\.4 \| 0\.3 \| 5 \| 5 \|") { throw "threads ${n}: summary row wrong:`n$table" }
+        # The immediate-exit fixture still has a nonzero lifetime peak commit.
+        if ($table -notmatch "\| $n \| [\d.]+ \| [\d.]+ \| [1-9]\d* \| 3 \| 1 \| 5\.4 \| 0\.3 \| 5 \| 5 \|") { throw "threads ${n}: summary row wrong:`n$table" }
         foreach ($row in @("\| $n \| < 64 KiB \| 1 \| 0\.1 \|", "\| $n \| 64-256 KiB \| 1 \| 0\.3 \|", "\| $n \| 1-4 MiB \| 1 \| 5 \|")) {
             if ($table -notmatch $row) { throw "threads ${n}: bucket row missing ($row):`n$table" }
         }

@Creaa
Creaa force-pushed the scripts/cold-pso-bench branch from 386e3d4 to b3b962c Compare November 25, 2026 10:37
@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@itsSio thank you, that was a real hazard: the fixture's -ClearNvCache case could empty the caller's NVIDIA cache, and an inherited XCL_PIPELINE_TIMES got rows. Your patch is in, squashed into the PR's commit with you as co-author (b3b962c). I checked it from a caller that has a cache folder with a sentinel, a timing CSV with rows and XCL_PIPELINE_CACHE_OFF=1: all three unchanged afterwards; without the patch the same run fails on the timing file. Smoke rerun on the new head, description updated.

On your cache observation (driver 610.88: a repeat of the same exe ~0.03 s, a new exe name cold again): the RTX 4070 table here was not from a warm cache. Its eight runs used the same exe, the same DXIL and the same compute programs one after another, with the NVIDIA DXCache folder emptied before each, and every run spent 2 115–5 596 s in CreateComputePipelineState (the 1–4 MiB programs 100–430 s each). A run served from the driver's cache would have taken milliseconds, as in your repeat. So on 617.14 the folder held that cache. Whether a driver keeps it elsewhere too is driver-specific; XCL_PIPELINE_CACHE_OFF=1 (Developer Mode) avoids the question.

AI use: Claude Code (Claude Opus 5.5) applied and checked the patch and drafted this reply.

@raylitebull

Copy link
Copy Markdown
Member

Updated review on \�3b962c:\n\n- Folding the \LOCALAPPDATA\ / \XCL_PIPELINE_TIMES\ / \XCL_PIPELINE_CACHE_OFF\ sandbox isolation into \scripts/cold-pso-bench.tests.ps1\ prevents the test fixture from touching the user's live \DXCache\ or timing files; CI (\Build and test\ + \PR description) is green and \CLEAN.\n\nRemaining before merge:\n1. Fresh independent AMD + NVIDIA verification on \�3b962c\ (prior runs were on \386e3d4).\n2. Follow-up or documentation note on @bielfreedom's AMD finding (-ClearNvCache\ reuses \xcl.exe\ without Developer Mode / per-run exe name on AMD).

@tiagonleal

tiagonleal commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

NVIDIA verification of #2129 at 8b690141096f61a663500c4dc5e0f47240529d70, now with Developer Mode on. This replaces my earlier comment on this PR.

Setup: RTX 5070 Ti 16 GB, driver 32.0.16.1742, Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 10.0.26300, Developer Mode on. Release build of 8b69014 (the checkout is clean and at that exact commit).

Tested on 8b69014

  • cargo test --release -p xcl --lib shaders::: 10 passed, 0 failed, 0 ignored, 0 SKIPPED. shaders::tests::pso_measurement_compiles_an_exact_synthetic_record ran and passed (it was SKIPPED in my earlier comment, with Developer Mode off).
  • The unmodified scripts/cold-pso-bench.ps1 in its default mode, end to end: -Shaders <32 small compute records> -Threads 2,8 -Xcl target\release\xcl.exe, no -ClearNvCache, so XCL_PIPELINE_CACHE_OFF=1 was in effect. It printed "implicit D3D and driver caches disabled (XCL_PIPELINE_CACHE_OFF); XCL driver blobs off" and finished with the full table. One run per cell:
threads wall s CPU s peak commit MB made refused driver s (sum) p50 s p95 s max s
2 27.1 49.4 561 32 0 49.7 1.55 3.82 4.00
8 10.6 64.2 1217 32 0 65.9 2.45 4.38 4.69

Per bucket, the same in both runs: 12 programs under 64 KiB (driver sum 2.1 s at 2 threads, 2.7 s at 8) and 20 programs of 64-256 KiB (47.6 s and 63.2 s). All 32 rows were made in both runs, 0 reused, 0 refused. Only my original xcl.exe was left in its folder afterwards (the per-run copy is removed).

  • These numbers are in line with my earlier real runs of the same 32 programs on the same machine with a new exe name per run (2 threads: wall 29.5 s, driver sum 53.8 s; 8 threads: wall 12.3 s, driver sum 73.7 s). That earlier pair was measured on b3b962c, which has the same Rust code as 8b69014.
  • A same-exe-name repeat, from b3b962c: it was mostly warm (22 of 32 pipelines under 0.1 s, driver sum 21.1 s, no new driver cache files) with all 32 rows still made. I did not repeat that on 8b69014.
  • Nothing was run with -ClearNvCache, and I did not delete or change anything in the NVIDIA DXCache or D3DSCache folders. I only listed their files (name, size, write time) around the runs: a 45 s idle window and then a run of the script, twice. In the first pair the idle window changed 0 files and the run window added or changed 12 (10 new files, 2 existing ones changed), all with write times inside the run; the only other processes alive were cargo and rustc. In the second pair another process using the GPU was alive in both windows and files changed in both (5 in the idle one, 14 in the run one), so that pair is inconclusive. So with XCL_PIPELINE_CACHE_OFF=1 I still saw the driver cache folders gain files during a run. I did not find out which file belongs to which pipeline, and I do not know whether it comes from the script, the D3D12 runtime or the driver.

Not tested

  • scripts/cold-pso-bench.tests.ps1 (the fixture) on this run: I did not rerun it with Developer Mode on. My earlier run of it (Developer Mode off, LOCALAPPDATA pointed at a temp folder) passed.
  • A same-name repeat or any comparison against a warm run with Developer Mode on, so I have not checked whether XCL_PIPELINE_CACHE_OFF=1 alone gives the same numbers as a new exe name here. The table above is the first run. A second run of the same input gave 28.8 s / 10.3 s wall at 2 / 8 threads, and a third, with another GPU process alive, 39.4 s / 15.4 s.
  • The rest of cargo test -p xcl --lib (only the shaders:: tests were run); thread counts other than 2 and 8; the large DXIL buckets (this input has only the two smallest); the full pack; AMD; more than one run per cell.

Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).

@Creaa
Creaa force-pushed the scripts/cold-pso-bench branch from b3b962c to 8b69014 Compare November 25, 2026 11:27
@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@bielfreedom thank you, that was a real hole: with -ClearNvCache on AMD every row after the first was a warm run labelled cold, and nothing in the table showed it. Your first suggestion is in, squashed into the PR's commit with you as co-author (8b69014): every measured run starts a copy of -Xcl named <name>-cold-<threads>-<random>.exe and removes it afterwards. The copy sits next to the original rather than in -Out, so it finds the same DXC and Agility SDK folders that XCL looks for beside its exe. It runs whether or not the cache switch is on, since it costs nothing.

Checked here: the fixture test now records the exe name of each run, fails on the previous script and passes now (a new name per run, no copy left). A real -Limit 12 -ClearNvCache run on the RTX 4070 made 12 of 12 pipelines through the copy and left nothing behind. I can't run it on AMD, so the description lists AMD under Not tested and cites your measurement. Smoke and the full suite were rerun on the new head. Also in the same commit: -Threads 4,8 given through powershell -File (cmd, bash) arrived as one string that the [int[]] parameter silently read as 48; it is now split on commas and anything else is refused.

@tiagonleal thanks for the RTX 5070 Ti run: a repeat under the same exe name being mostly warm on NVIDIA too (22 of 32 under 0.1 s, all rows made) is the same hole on the other vendor, and your new-name run matching the first within 1 % is what the per-run copy now does on its own.

-ClearAmdCache, and whether ShaderCacheControl(DISABLE) turns the AMD cache off under Developer Mode, are left out: with a fresh exe name neither is needed for cold numbers.

AI use: Claude Code (Claude Opus 5.5) made the change, ran the checks and drafted this reply.

@adriadam10

Copy link
Copy Markdown

Pascal data point for #2129 (GTX 1050 Ti), script at 8b690141096f61a663500c4dc5e0f47240529d70.

Setup: GTX 1050 Ti 4 GB, driver 32.0.15.8266, Core i5-8400 (6 cores), 16 GB RAM, Windows 11 Pro 26100, Developer Mode off. Release xcl.exe built from b3b962c (b3b962c..8b69014 changes only scripts/cold-pso-bench.ps1 and its test, no Rust file).

Run: cold-pso-bench.ps1 -Shaders <retail shaders pack> -Threads 2,4 -Limit 22300 -ClearNvCache -TimeoutMinutes 60 (143 compute pipelines, the same sample as above), one run per thread count:

threads wall s CPU s peak commit MB made refused driver s (sum) p50 s p95 s max s
2 357.8 718.6 5409 143 0 700.3 0.6 22.07 96.77
4 273.6 961.5 6234 143 0 944.3 0.9 30.81 113.95
threads DXIL size made driver s (sum) p50 s p95 s
2 < 64 KiB 71 13 0.13 0.6
2 64-256 KiB 44 88 1.6 3.87
2 256 KiB-1 MiB 25 378.7 12.84 29.78
2 1-4 MiB 3 220.6 82.6 96.77
4 < 64 KiB 71 18.2 0.16 0.88
4 64-256 KiB 44 127.7 2.36 6.19
4 256 KiB-1 MiB 25 519 17.26 39.9
4 1-4 MiB 3 279.4 108.75 113.95

What it shows on this card: going from 2 to 4 threads cuts the wall time by 24 % but every compile gets about 35 % slower (driver sum 700 → 944 s) and peak commit grows by 0.8 GB. The 3 programs of 1-4 MiB take 83-114 s each and are 31-38 % of all driver time, so on Pascal they alone set the floor for a cold start.

Not tested: thread counts other than 2 and 4; the full pack (the first DXIL pass over all 2 689 compute programs ran at a few per minute on the largest ones, so I stopped it); Developer Mode on; more than one run per cell.

Run and written with Claude Code (Claude Opus 5.5).

@jeroenhaentjens

Copy link
Copy Markdown
Contributor

CPU fixture report and a script-only follow-up for this PR: dcd14b8, based on exact head 8b690141096f61a663500c4dc5e0f47240529d70.

An exit-zero fixture with missing or malformed timing data can still produce a successful benchmark summary on the current script. The patch validates the five CSV fields, rejects missing/empty files and nonfinite/negative durations, and identifies the file and physical line in row errors. Actual zero durations and refused-only/reused-only measurements remain valid. Timing cleanup/read and summary export use literal paths; an append-mode repeat fixture also checks that an output directory containing [] cannot retain the previous run's rows.

Tested

Windows 11 Pro, build 26200, Intel Core i7-9750H; CPU-only .cmd process fixture. Final code and tests are identical to the files tested before committing.

Shell Original script + final regression fixture Follow-up commit
Windows PowerShell 5.1.26100.9818 5 passed / 32 failed 37 passed / 0 failed
PowerShell 7.6.9 5 passed / 32 failed 37 passed / 0 failed

The 37 cases comprise 30 invalid inputs and 7 valid/repeated-run cases; none ignored or skipped. Original environment, percentile/bucket, thread-argument, temporary cache and executable-cleanup checks also pass. Of the 30 invalid inputs, the original script accepted and wrote a summary for 24 on 5.1 and 26 on 7; the remaining cases already threw but lacked file/line diagnostics. Two literal-path cases account for the other baseline failures.

Commands run with both powershell.exe and pwsh.exe:

powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/cold-pso-bench.tests.ps1
pwsh.exe -NoProfile -ExecutionPolicy Bypass -File scripts/cold-pso-bench.tests.ps1
git diff --check

For the baseline, the final fixture was run beside an untouched copy of cold-pso-bench.ps1 extracted from 8b690141; both commands exited 1. With the patch, both exited 0. The fixture's cache deletion stays inside its temporary directory.

Not tested

No new GPU/cold-cache measurement, retail smoke or full Rust-suite run for this script-only follow-up. This does not refresh the runtime PR's merge-validation evidence or prove that a timing file includes every expected pipeline.

AI use

Codex (exact model identifier unavailable), with subagents, wrote the patch, regression fixture and this report and checked the measured results.

@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@jeroenhaentjens thank you, the cases are real: an xcl that exits 0 with a missing or malformed timing file gets a summary today, and a path with [ ] breaks the reads without -LiteralPath. I'd rather keep this PR as it is, though: it is a runtime PR, every push needs a new smoke pair and test reports on the new head, and it already has several reports on 8b69014. Could you open dcd14b8 as its own PR once this one is merged (or stacked on it now, Stacked on #2129)? It reads well as a separate change, and it stays yours. I'll test it on the RTX 4070 when it is up.

AI use: Claude Code (Claude Opus 5.5) drafted this reply.

@IvovdBruggen

Copy link
Copy Markdown

Ampere data point for #2129 (RTX 3080 10 GB), script at 8b690141096f61a663500c4dc5e0f47240529d70, with Developer Mode on.

Setup: NVIDIA GeForce RTX 3080 10 GB, driver 617.42 (32-lane waves only); AMD Ryzen 5 5600 (6 cores, 12 threads); 32 GB RAM; Windows 11 IoT Enterprise LTSC 26100, Developer Mode on. Release build of 8b69014 (clean checkout at that commit), Rust 1.100.0 MSVC, DXC 1.8.2502.11 (Windows SDK 10.0.26100.0).

Tested on 8b69014

  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug): 1155 passed, 0 failed, 46 ignored (lib tests 1099 / 0 / 26). SKIPPED: the wave64 GPU tests (no wave64), the direct-DXIL f16 / f32 per-lane cases refused per gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426, and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows). shaders::tests::pso_measurement_compiles_an_exact_synthetic_record ran and passed.

Run: the unmodified scripts/cold-pso-bench.ps1 -Shaders <retail shaders pack> -Limit 22300 -TimeoutMinutes 60, default mode, so XCL_PIPELINE_CACHE_OFF=1 (implicit D3D and driver caches off, XCL driver blobs off). Same sample as @adriadam10's GTX 1050 Ti run: 143 compute pipelines, bucket counts 71 / 44 / 25 / 3. One invocation with -Threads 4,6,8,12,4, and the 2-thread row from a second invocation with -Threads 2 right after it:

threads wall s CPU s peak commit MB made refused driver s (sum) p50 s p95 s max s
2 279.7 570.8 6708 143 0 547.3 0.39 15.35 74.1
4 194.9 720.7 7751 143 0 699.3 0.45 18.95 101.3
6 153.9 781.9 9235 143 0 759.5 0.46 22.88 108.2
8 143.1 928.8 10441 143 0 907.9 0.56 26.54 123.19
12 135.1 1115 11667 143 0 1128 0.83 34.59 129.52
4 (repeat) 185.1 682.5 7736 143 0 660.7 0.44 19.03 91.19
threads DXIL size made driver s (sum) p50 s p95 s
2 < 64 KiB 71 9.7 0.11 0.36
2 64-256 KiB 44 54.8 1.13 2.78
2 256 KiB-1 MiB 25 299.8 9.1 20.5
2 1-4 MiB 3 183 57.2 74.1
6 < 64 KiB 71 10.9 0.12 0.42
6 64-256 KiB 44 82.5 1.5 4.4
6 256 KiB-1 MiB 25 430 13.55 27.29
6 1-4 MiB 3 236 64.11 108.2
12 < 64 KiB 71 18 0.18 0.8
12 64-256 KiB 44 174.5 3.44 8.47
12 256 KiB-1 MiB 25 655.6 21.02 41.82
12 1-4 MiB 3 279.9 76.43 129.52

What it shows on this machine:

  • Wall time stops improving at about 6 threads (154 s; 135 s at 12). From 6 to 12 threads the summed driver time rises 49 % and peak commit by 2.4 GB, as on @Creaa's RTX 4070: the 6-core CPU is the limit.
  • The 4-thread repeat (185 s wall, 661 s driver) is within 5–6 % of the first 4-thread run, so the runs were not served from a warm cache.
  • Against the GTX 1050 Ti on the same sample: 2 threads 280 vs 358 s wall, 4 threads 195 vs 274 s.
  • The 3 programs of 1–4 MiB take 57–130 s each and are 27–34 % of the summed driver time.
  • As @tiagonleal saw, the NVIDIA DXCache and D3DSCache folders still gained or changed files with XCL_PIPELINE_CACHE_OFF=1: 32 files over the 4,6,8,12,4 invocation. I only listed them (name, size, write time); I did not find out which run or pipeline wrote them.

Not tested: -ClearNvCache; scripts/cold-pso-bench.tests.ps1; thread counts 10, 16, 20 and 24; the 67-record corpus of the PR description and the full pack; more than one run per cell except 4 threads; AMD.

Run and written with Claude Code (Claude Opus 5.5).

@RavenCurseBurg

RavenCurseBurg commented Nov 25, 2026 •

Copy link
Copy Markdown

Retested the incorporated change on 30a3ef1055ed5da9d04a6ca667996112756486c1. scripts/cold-pso-bench.tests.ps1 passed on Windows PowerShell 5.1 and PowerShell 7.6.9, including the child environment checks. I also reran the same three stand-in workloads as below in each shell. All six CSV rows reported 25 MiB, including the children that exited before one second. All six peak and wall-time readings covered the child's own measurements within CSV rounding. Windows 11 26100.9711, i7-13700, synthetic workloads. OpenAI Codex (GPT-6) ran the checks. Author’s adoption note.

Short-process measurement on 8b690141096f61a663500c4dc5e0f47240529d70. I reproduced the remaining review observation. A small stand-in process committed 12 MiB, touched it, released it, and wrote its own peak and elapsed time. I ran scripts/cold-pso-bench.ps1 -Shaders synthetic -Threads 1,2,3 -Xcl <stand-in.exe> -Out <private-directory> with a short hold, an early release followed by a one-second wait, and an immediate release.

  • In both shells the original CSV reported 0, 13, 0 MiB; the child observed peaks between 23.8 and 25.2 MiB. In the short-hold case the CSV reported 0.2 s while the child had already lived over 0.30 s.
  • Candidate and regression. It reads Windows’ lifetime peak commit on the retained child handle and calculates wall time from process start and exit timestamps. The candidate reported 25, 25, 24 MiB in each shell. All six wall times and peaks covered the child's observations within the CSV’s rounding precision. Windows counter definition.
  • scripts/cold-pso-bench.tests.ps1 passed in Windows PowerShell 5.1 and PowerShell 7.6.9. The new short-child assertion failed on the original script in each shell. I also combined this commit with the earlier child-environment candidate (1af753b); they merged cleanly and the combined fixture passed in both shells.

Windows 11 26100.9711, Core i7-13700. Synthetic process only; no GPU workload or real shader timings. OpenAI Codex (GPT-6) implemented the candidate and ran these checks.

Earlier checks on the child environment and on the CSV follow-up

I independently tested @jeroenhaentjens's script-only follow-up on top of 8b69014. Reusing an output directory exposed one more case: after a successful run I supplied a malformed line for the second thread count. The script correctly rejected line 3 of the replacement times-3.csv, but the previous run's summary.csv was still there, byte-for-byte unchanged.

Five-line follow-up and regression, based directly on the linked CSV patch for its author to use separately. After preparation succeeds, the script removes the superseded summary before replacing timing files. If preparation fails, the previous summary remains available. A valid retry writes a new summary.

  • Used a small synthetic executable to supply 20 made, one refused and one reused record per thread setting (1 and 3). The 20 durations were 1–20 seconds in reverse order. The reported sum/p50/p95/max were 210/10/19/20 seconds. All five size buckets matched at the 64 KiB, 256 KiB, 1 MiB and 4 MiB boundaries. These numbers validate the calculation; they are fixture data.
  • scripts/cold-pso-bench.tests.ps1 with the added valid-then-invalid case gave 37 passes and that one failure on dcd14b8; the new commit passed all 38 cases in both Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. I also verified the failed preparation, malformed measurement and valid retry in both shells. Driver cache testing in the existing suite used its private fixture directory.

Windows 11 build 26100.9711, i7-13700. No real shader pack, GPU workload or driver timings. OpenAI Codex (GPT-6) ran the checks and prepared the incremental change.

Follow-up on the benchmark environment review. On 8b690141096f61a663500c4dc5e0f47240529d70 a synthetic child honoring the 8192 KiB cap omitted its 9 MiB row. With only the cap corrected, the -ClearNvCache child still saw the caller’s XCL_PIPELINE_CACHE_OFF=1 in both shells. Candidate for the two child settings.

I ran scripts/cold-pso-bench.tests.ps1 in Windows PowerShell 5.1 and PowerShell 7.6.9. Both modes included the fourth made row with the fix. The default-mode table showed 5.6 s summed and 0.2 s p50 from synthetic timings. The cache-folder mode selected CACHE_OFF=0; both caller settings survived. All cache operations used a private fixture directory. No driver timing or memory measurement was taken.

I also tried the candidate together with #2495 at bbcfc381. The production script merged cleanly. In the fixture I kept the checked cache and cleanup paths from #2495 and the environment setup and restoration from this candidate. Both shells then passed the 39 CSV cases, preparation preservation and both replacement/retry checks. Windows 11 26100.9711, i7-13700. OpenAI Codex (GPT-6) prepared the candidate and ran these checks.

@jeroenhaentjens

Copy link
Copy Markdown
Contributor

@Creaa @RavenCurseBurg published the separate follow-up as draft #2495, stacked on this PR as requested. Only top commit f4ac6cd belongs to the follow-up.

I reproduced the stale-summary case on dcd14b8 plus the supplied regression: 37 passed / 1 failed in both Windows PowerShell 5.1 and PowerShell 7. Incorporated the fix with RavenCurseBurg credited as co-author, and added valid-retry and byte-for-byte preparation-failure preservation checks. Final result in both shells: 39 timing cases passed, 0 failed, plus the preparation check.

Full workspace build passes; tests on the exact final head: 1154 passed, 1 failed, 46 ignored, 25 explicit skips. The sole failure is the adapter-selection test fixed by #2318, absent from this parent. The draft documents the inherited shaders.rs conflict and smoke requirement while #2129 remains pending. No real shader-pack or performance result is claimed.

AI use: OpenAI Codex (GPT-6; exact deployment variant unavailable), including an independent subagent diff review.

jeroenhaentjens added a commit to jeroenhaentjens/xcl that referenced this pull request Nov 25, 2026
Validate timing rows and report file/line errors instead of publishing
misleading zero-cost results. Use literal output paths. After preparation
succeeds, remove the old summary before replacing timings; a failed
preparation preserves the previous complete result.

Stop before measuring if a locked or read-only timing file cannot be
removed. Otherwise an exit-zero producer can leave old readable rows and
publish them as a fresh measurement. Adopt RavenCurseBurg's two fixes and
extend their regressions with no-start, byte preservation and fresh-retry
checks.

Windows PowerShell 5.1 and PowerShell 7 each pass all 39 timing cases,
preparation preservation and both replacement/retry cases. With the prior
production script, both new replacement cases fail in each shell.

Stacked on xcl-dev#2129. Part of xcl-dev#2088.
Source: RavenCurseBurg@4b190ba
Source: RavenCurseBurg@91e1e60

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Assisted-by: OpenAI Codex (GPT-6; exact deployment variant unavailable)

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 benchmark validity: cold-pso-bench.ps1 never sets XCL_PIPELINE_MAX_KB=0, so the default 8 MiB cap makes make_with_cache_path return before emitting XCL_PIPELINE_TIMES. The script can claim every compute pipeline while omitting all >8 MiB programs from summaries. Disable the cap and test capped fixture. P2: -ClearNvCache inherits XCL_PIPELINE_CACHE_OFF=1 because child environment is unsanitized, potentially disabling caches/refusing Developer Mode; remove/sanitize it and test inherited state. Short runs can also under-report wall/peak memory due stopwatch/sampling placement.

@Creaa
Creaa force-pushed the scripts/cold-pso-bench branch from 8b69014 to 510f768 Compare November 25, 2026 22:15
@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@bmjask thanks, right: with the default cap a program over 8 MiB returned before its timing line, so the summary dropped exactly the biggest ones without a word. Fixed in 510f768 (squashed into the PR's commit): every measured run sets XCL_PIPELINE_MAX_KB=0, and the fixture now records that variable for each run and fails on the previous script (its value was empty there). The branch is also rebased onto main e1d84b7 (the conflict in shaders.rs was main's new cache_dir field and counters next to times); smoke pair and full suite rerun on the new head, numbers in the description.

AI use: Claude Code (Claude Opus 5.5) made the change, ran the checks and drafted this reply.

xcl-dev#2088)

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.

The fixture test runs with its own LOCALAPPDATA and without inherited XCL_PIPELINE_TIMES / XCL_PIPELINE_CACHE_OFF, so -ClearNvCache never empties a real NVIDIA cache and no real timing file gets rows (found and fixed by itsSio in review).

Every measured run starts a copy of the exe under a name of its own, next to the original, and removes it afterwards: the AMD driver keys its shader cache on the exe's file name, so with -ClearNvCache on AMD the second run of a sweep was served warm and reported as cold (found and measured on RDNA4 by bielfreedom in review).

-Threads is read as text and split on commas: from cmd or bash, `powershell -File ... -Threads 4,8` passes one string "4,8", which an [int[]] parameter silently read as 48 threads; anything that is not a thread count is refused.

Every measured run also turns off the 8 MiB DXIL cap of --pipelines (XCL_PIPELINE_MAX_KB=0): a capped program returns before writing its timing line, so the summary silently left out the biggest programs (found by bmjask in review).

With -ClearNvCache the runs set XCL_PIPELINE_CACHE_OFF=0 rather than leaving it out, so a caller's =1 does not turn the switch back on; and wall time and peak commit come from the process itself (start and exit times, PeakPagefileUsage on its handle), since a child shorter than the one-second sampling showed 0 MB (both found by bmjask in review; the measurement change is RavenCurseBurg's).

Co-Authored-By: itsSio <31954644+itsSio@users.noreply.github.com>
Co-Authored-By: bielfreedom <341226708+bielfreedom@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
@Creaa
Creaa force-pushed the scripts/cold-pso-bench branch from 510f768 to 30a3ef1 Compare November 25, 2026 22:23
@Creaa

Creaa commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@bmjask the other two points are in now too (my previous reply only covered the cap, sorry):

  • P2: with -ClearNvCache every run sets XCL_PIPELINE_CACHE_OFF=0 instead of leaving it out, so a caller's =1 no longer turns the switch back on. The fixture now runs -ClearNvCache with XCL_PIPELINE_CACHE_OFF=1 in the caller's environment, checks that the child saw 0 and that the caller's value is unchanged; it fails on the previous script.
  • P3: wall time now comes from the process's start and exit times and peak commit from PeakPagefileUsage on its handle, so a child shorter than the one-second sampling no longer shows 0 MB. This is @RavenCurseBurg's change from their comment above, taken as it is with credit (Co-Authored-By); the fixture checks that every row has a peak.

Squashed into the PR's commit, now 30a3ef1; smoke pair and full suite rerun on it, numbers in the description.

AI use: Claude Code (Claude Opus 5.5) made the P2 change, took in the P3 commit, ran the checks and drafted this reply.

@KOLESNiii KOLESNiii mentioned this pull request Nov 25, 2026
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.