Scripts: measure NVIDIA PSOs with a temporary cache-off profile #1839

Open
Daydream3r wants to merge 2 commits from upstream-pr/1849 into main
Daydream3r commented 2026-11-24 21:46:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Daydream3r on 2026-11-24T21:46:24Z.


Stacked on #1802; only the top commit 2cc2ba1 belongs to this PR. Part of #1269. Updated to #1802's current patch 3eaf978, rebased unchanged onto main 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 as e58293b (git range-diff reports an identical parent patch).

On RTX 5070 Ti, successful ShaderCacheControl calls still allowed repeated PSO creation to collapse from seconds to milliseconds. This wrapper associates a unique sibling exe with a temporary NVIDIA application profile whose shader disk cache is off, runs the measurement, and removes the profile and exe afterwards. It leaves other profiles and shared cache files alone.

What is in it

  • Parent #1802: exact-record HLSL/direct benchmark with JSON and explicit cache-control limitations, retaining its original author's patch.
  • This PR's commit: scripts/measure-nvidia-pso.ps1, four profile-lifetime checks, usage documentation and NVAPI ABI-reference attribution. No Rust runtime change in our own commit; the full diff includes the parent.
  • Rebase replaces the obsolete parent version, resolving its README/shaders conflicts with main. The wrapper/test code is unchanged; only surrounding README context changed.

Tested

  • RTX 5070 Ti 16 GB, NVIDIA 621.01; Ryzen 7 9800X3D, 64 GB RAM; Windows 11 Pro 25H2 26200.6584; Rust 1.100.0 MSVC, DXC/DXIL 1.9.2609.5. Release measurement/smoke, debug tests.
  • cargo build --release --workspace --locked: passed on clean main and clean head 2cc2ba1ac89b53e3e025ea273e29e4c5d45f92c4.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: head 1246 passed, 4 failed, 46 ignored; clean main 1246 passed, same 4 failed, 46 ignored; both exit 101. The four failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}, CreateComputePipelineState 0x8007000E. Optional XCL_SAMPLE_* inputs unset.
  • Identical 26 explicit SKIPPED lines: 20 no native wave64, 3 refused per-lane forms (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32), 2 missing D3D12 debug-layer checks, 1 no heap windows. These skips are not coverage.
  • scripts/test-measure-nvidia-pso.ps1: 4 checks passed in Windows PowerShell 5.1 and 4 in PowerShell 7.
  • Real wrapper compatibility checks on record 1404420b38db8597, -Repeat 2, 4 windows / split wave64: PowerShell 7 -Backend direct exited 0 (262000 B DXIL; driver 2.3939078 / 2.4177889 s); PowerShell 5.1 -Backend hlsl exited 0 (395152 B DXIL; 3.916841 / 5.0216012 s). Both returned the expected backend/adapter/count JSON and cache_control=temporary_nvidia_profile_off; cold_compile_verified=false remains intact. These are compatibility checks, not interleaved cold/performance proof.
  • Real missing-record failure returned nonzero and cleaned up. Independent NVAPI lookups verified all three temporary profiles absent; each unique probe exe was absent too.
  • git diff --check: passed.

Regression run
Official scripts/smoke.ps1, same retail package 1.0.2.1, 60 s, no input, isolated copies of the same saved data/cache seed, networking off. Head run performed after pushing the new commit. Startup/menu coverage only.

main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: NVIDIA GeForce RTX 5070 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1590 (PresentX 1590)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15927 MB

head:

xcl-smoke v1
commit: 2cc2ba1ac89b53e3e025ea273e29e4c5d45f92c4
gpu: NVIDIA GeForce RTX 5070 Ti
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17191 MB

Not tested
Other NVIDIA GPUs/drivers, AMD/Intel/native wave64, Linux/Wine, full-pack throughput, world rendering or shader GPU-output parity. The four baseline GPU-fuzz failures remain. A forcibly terminated PowerShell host cannot execute finally; the printed unique profile name permits manual cleanup. Requires permission to save an NVIDIA application profile and #1802's support; drop/rebase the parent after it merges.

AI use
Codex desktop, GPT-6 (exact variant not exposed): our original implementation/tests/measurements, updating the dependency and rebasing, actual local builds/tests/measurements/smoke and this description. Parent #1802 retains its original author and unchanged patch.

<!-- greyfinch-sync:ivall/xcl:issue:5480870854 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1849). Originally posted by [Daydream3r](https://github.com/Daydream3r) on 2026-11-24T21:46:24Z. --- Stacked on #1802; only the top commit `2cc2ba1` belongs to this PR. Part of #1269. Updated to #1802's current patch `3eaf978`, rebased unchanged onto `main 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6` as `e58293b` (`git range-diff` reports an identical parent patch). On RTX 5070 Ti, successful `ShaderCacheControl` calls still allowed repeated PSO creation to collapse from seconds to milliseconds. This wrapper associates a unique sibling exe with a temporary NVIDIA application profile whose shader disk cache is off, runs the measurement, and removes the profile and exe afterwards. It leaves other profiles and shared cache files alone. **What is in it** - Parent #1802: exact-record HLSL/direct benchmark with JSON and explicit cache-control limitations, retaining its original author's patch. - This PR's commit: `scripts/measure-nvidia-pso.ps1`, four profile-lifetime checks, usage documentation and NVAPI ABI-reference attribution. No Rust runtime change in our own commit; the full diff includes the parent. - Rebase replaces the obsolete parent version, resolving its README/shaders conflicts with main. The wrapper/test code is unchanged; only surrounding README context changed. **Tested** - RTX 5070 Ti 16 GB, NVIDIA 621.01; Ryzen 7 9800X3D, 64 GB RAM; Windows 11 Pro 25H2 26200.6584; Rust 1.100.0 MSVC, DXC/DXIL 1.9.2609.5. Release measurement/smoke, debug tests. - `cargo build --release --workspace --locked`: passed on clean main and clean head `2cc2ba1ac89b53e3e025ea273e29e4c5d45f92c4`. - `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: head **1246 passed, 4 failed, 46 ignored**; clean main **1246 passed, same 4 failed, 46 ignored**; both exit 101. The four failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0,1,2,3}`, `CreateComputePipelineState 0x8007000E`. Optional `XCL_SAMPLE_*` inputs unset. - Identical 26 explicit SKIPPED lines: 20 no native wave64, 3 refused per-lane forms (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32), 2 missing D3D12 debug-layer checks, 1 no heap windows. These skips are not coverage. - `scripts/test-measure-nvidia-pso.ps1`: **4 checks passed** in Windows PowerShell 5.1 and **4** in PowerShell 7. - Real wrapper compatibility checks on record `1404420b38db8597`, `-Repeat 2`, 4 windows / split wave64: PowerShell 7 `-Backend direct` exited 0 (262000 B DXIL; driver 2.3939078 / 2.4177889 s); PowerShell 5.1 `-Backend hlsl` exited 0 (395152 B DXIL; 3.916841 / 5.0216012 s). Both returned the expected backend/adapter/count JSON and `cache_control=temporary_nvidia_profile_off`; `cold_compile_verified=false` remains intact. These are compatibility checks, not interleaved cold/performance proof. - Real missing-record failure returned nonzero and cleaned up. Independent NVAPI lookups verified all **three** temporary profiles absent; each unique probe exe was absent too. - `git diff --check`: passed. **Regression run** Official `scripts/smoke.ps1`, same retail package 1.0.2.1, 60 s, no input, isolated copies of the same saved data/cache seed, networking off. Head run performed after pushing the new commit. Startup/menu coverage only. main: ``` xcl-smoke v1 commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 gpu: NVIDIA GeForce RTX 5070 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1590 (PresentX 1590) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15927 MB ``` head: ``` xcl-smoke v1 commit: 2cc2ba1ac89b53e3e025ea273e29e4c5d45f92c4 gpu: NVIDIA GeForce RTX 5070 Ti title: retail-title seconds: 60 exit: 0x0 frames shown: 1630 (PresentX 1630) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17191 MB ``` **Not tested** Other NVIDIA GPUs/drivers, AMD/Intel/native wave64, Linux/Wine, full-pack throughput, world rendering or shader GPU-output parity. The four baseline GPU-fuzz failures remain. A forcibly terminated PowerShell host cannot execute `finally`; the printed unique profile name permits manual cleanup. Requires permission to save an NVIDIA application profile and #1802's support; drop/rebase the parent after it merges. **AI use** Codex desktop, GPT-6 (exact variant not exposed): our original implementation/tests/measurements, updating the dependency and rebasing, actual local builds/tests/measurements/smoke and this description. Parent #1802 retains its original author and unchanged patch.
DavidM1911 commented 2026-11-25 02:08:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T01:15:38Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7149366762 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1849#issuecomment-7149366762). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T01:15:38Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
RavenCurseBurg commented 2026-11-25 18:04:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T17:36:21Z.


CPU-only wrapper check of 2cc2ba1ac89b53e3e025ea273e29e4c5d45f92c4 on Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. The four scripts/test-measure-nvidia-pso.ps1 lifetime checks passed per shell.

I also ran the full scripts/measure-nvidia-pso.ps1 -Pack <fixture> -Hash 1122334455667788 -Xcl <stand-in> -Backend <backend> -Repeat <count> entry point with an in-process profile test double and a native executable that recorded its arguments. Nine scenarios passed per shell:

  • HLSL with one sample and direct with two samples preserved the child arguments, including a pack path with spaces and brackets, returned the expected timing-array length, kept cold_compile_verified=false, and added the cache-control field.
  • Child exit 23, invalid JSON, wrong backend, wrong sample count and wrong adapter all surfaced errors and called profile cleanup. A create failure never launched the child; a remove failure named the exact temporary profile.
  • Across all scenarios each generated profile name was unique, the copied executable disappeared, and the source executable's hash was unchanged.

Windows 11 26100.9711, i7-13700, RTX 4060. The profile provider and timing data were simulated. No NVIDIA profile was created, no caches were touched, and no cold-compile timing was measured. OpenAI Codex (GPT-6) ran the checks and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7169742244 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1849#issuecomment-7169742244). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T17:36:21Z. --- CPU-only wrapper check of `2cc2ba1ac89b53e3e025ea273e29e4c5d45f92c4` on Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. The four `scripts/test-measure-nvidia-pso.ps1` lifetime checks passed per shell. I also ran the full `scripts/measure-nvidia-pso.ps1 -Pack <fixture> -Hash 1122334455667788 -Xcl <stand-in> -Backend <backend> -Repeat <count>` entry point with an in-process profile test double and a native executable that recorded its arguments. Nine scenarios passed per shell: - HLSL with one sample and direct with two samples preserved the child arguments, including a pack path with spaces and brackets, returned the expected timing-array length, kept `cold_compile_verified=false`, and added the cache-control field. - Child exit 23, invalid JSON, wrong backend, wrong sample count and wrong adapter all surfaced errors and called profile cleanup. A create failure never launched the child; a remove failure named the exact temporary profile. - Across all scenarios each generated profile name was unique, the copied executable disappeared, and the source executable's hash was unchanged. Windows 11 26100.9711, i7-13700, RTX 4060. The profile provider and timing data were simulated. No NVIDIA profile was created, no caches were touched, and no cold-compile timing was measured. OpenAI Codex (GPT-6) ran the checks and prepared this report.
DavidM1911 commented 2026-11-26 07:03:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T06:28:09Z.


Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7184458838 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1849#issuecomment-7184458838). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T06:28:09Z. --- Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
Foniass commented 2026-12-01 06:59:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:59:04Z.


Triage (#1607) – head 2cc2ba1

This PR is stacked on #1802. Its diff includes #1802's --measure-pso --backend/--json patch (the Rust changes in shaders.rs / pso.rs / main.rs), and only the top commit 2cc2ba1 is its own: scripts/measure-nvidia-pso.ps1, its test, README usage and the NVAPI row in THIRD_PARTY.md. That is a stack, not a duplicate. The parent copy in this branch is older than #1802's current head (f2fbd8a, which now defaults --backend to the runtime's XCL_DIRECT_DXIL choice), and the branch conflicts with main. It should be rebased onto #1802's current head once #1802 lands. No problems found in the script's profile create/remove lifetime.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303508725 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1849#issuecomment-7303508725). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:59:04Z. --- **Triage (#1607)** – head 2cc2ba1 This PR is stacked on #1802. Its diff includes #1802's `--measure-pso --backend/--json` patch (the Rust changes in `shaders.rs` / `pso.rs` / `main.rs`), and only the top commit 2cc2ba1 is its own: `scripts/measure-nvidia-pso.ps1`, its test, README usage and the NVAPI row in THIRD_PARTY.md. That is a stack, not a duplicate. The parent copy in this branch is older than #1802's current head (f2fbd8a, which now defaults `--backend` to the runtime's `XCL_DIRECT_DXIL` choice), and the branch conflicts with main. It should be rebased onto #1802's current head once #1802 lands. No problems found in the script's profile create/remove lifetime. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1849:upstream-pr/1849'
git switch 'upstream-pr/1849'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1849'
git switch 'upstream-pr/1849'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1849'
git switch 'upstream-pr/1849'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1849'
git switch 'main'
git merge --squash 'upstream-pr/1849'
git switch 'main'
git merge --ff-only 'upstream-pr/1849'
git switch 'main'
git merge 'upstream-pr/1849'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1839
No description provided.