Shaders: trace offline precompile phases #2220

Open
github-bot wants to merge 1 commit from github-bot/gh-2220 into main AGit
Owner

@⁠ettehn on GitHub · 2026-11-25 10:15 UTC · original
ettehn:codex/offline-precompile-trace → main · +87 −13 · 2 files · 1 commits · open

Part of #2088. XCL_PSO_TRACE=1 now covers offline shader precompile, where the runtime PSO trace cannot show whether a worker is still translating, waiting for a slot, or inside the driver.

What is in it

  • Pair start/end logs for shader input read and scan, CLI setup, compute translation, driver-cache read, compile-slot acquisition, and driver creation with or without a cached blob. --export-hlsl also traces translation. Each span reports elapsed time and process private commit, with a record hash where available. Document the opt-in trace in the README.

Tested

  • The rebased release build at dc673d70 created one synthetic compute PSO with zero refusals in each run with XCL_PSO_TRACE=0 and 1 (separate empty caches, RTX 5070 Ti Laptop GPU, driver 621.24). Off emitted zero phase lines. On emitted six matched start/end pairs.
  • On the rebased commit, cargo test --offline --locked --release -p xcl --test shaders_e2e -- --test-threads=1: 6 passed, 0 failed, 0 ignored.

Earlier validation on 17090008:

  • Windows 11 build 26200.9974, Ryzen 9 8945HX, GeForce RTX 5070 Ti Laptop GPU (621.24), Rust 1.97.1 MSVC, debug build, DXC 1.8.2502.11.

  • cargo test --offline --locked -p xcl --test shaders_e2e -- --test-threads=1: 4 passed, 0 failed, 0 ignored.

  • cargo test --offline --locked -p xcl --lib shaders:: -- --test-threads=1 --nocapture: 9 passed, 0 failed, 0 ignored, no SKIPPED markers on NVIDIA. Includes the stale-driver-blob case and a read-only parse of the first 300 records of a retail shader pack.

  • xcl shaders <synthetic directory> --precompile --limit 1 --only cs --split 1 --windows 4 --pipelines: two fresh XCL caches, XCL_PSO_TRACE=0 and 1. Each run created one pipeline and reported zero errors. The first emitted no phase lines; the second emitted six matched start/end pairs, including the driver call without a blob.

  • cargo test --offline --locked --workspace --no-run: all workspace test binaries built at 17090008.

  • NVIDIA driver-cache check with the same synthetic input: a valid blob produced a cache hit with one driver call. Replacing it with an invalid blob produced a miss and separate traced calls with and without a blob. XCL saved the rebuilt blob, and a third run reused it with one driver call. All three runs created one pipeline with zero refusals.

  • Filtered Windows library run with XCL_ADAPTER=warp and one test thread: harness reported 763 passed, 0 failed, 7 ignored, 354 filtered out. The pass count includes 62 GPU SKIPPED notices and 3 reported missing-sample skips. Filters excluded hle::d3d12x::, hle::mfplat::, gpu::recomp::tests::, and gpu::agility:: because those areas include direct hardware-device paths. This run does not satisfy the full hardware suite requirement.

  • Independent NVIDIA validation by @⁠itsSio on exact head 17090008: the full workspace suite reported 1,154 passed, 0 failed, 46 ignored on each of RTX 5080 and RTX 2080 SUPER, with 25 and 27 explicit runtime skips respectively. Both also produced six matched phase pairs with tracing enabled and zero with tracing disabled while creating one PSO in either mode.

  • Independent AMD validation by @⁠luckyteagirl on exact head 17090008: RX 6800M created the one offline compute PSO with eight matched phase pairs (including pack read and scan), and the paired 12-second title smoke completed with 89 versus 93 frames and no crashes or device removals. The full AMD suite reported 993 passed, 161 failed, 46 ignored, and six explicit skips. The failures included a D3D12 device suspension. No matched full-suite AMD baseline established whether those failures are specific to this change.

Regression run

Same retail title, 20 seconds each, separate initially empty XCL data and DXIL caches, networking off, one DXC thread, no scripted input. Scope: startup only.

Main:

xcl-smoke v1
commit: 06c9f5505f63f10c5ec49ef932d75b2c28177324
gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU
title: RetailTitle
seconds: 20
exit: 0x0
frames shown: 93 (PresentX 93)
presents per 2 s (last 3): 0 1 0
device removals: 0
crashes: 0
peak commit: 11476 MB

PR head:

xcl-smoke v1
commit: dc673d702e632f1ad0fdfa985169a09e5a270d2d
gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU
title: RetailTitle
seconds: 20
exit: 0x0
frames shown: 92 (PresentX 92)
presents per 2 s (last 3): 0 1 0
device removals: 0
crashes: 0
peak commit: 11426 MB

Not tested

  • The full hardware workspace suite on the rebased head.
  • Full hardware suite on the author’s machine, world loading or gameplay, and a matched full-suite AMD baseline.

AI use

  • OpenAI Codex (GPT-6.2 Sol) wrote the diagnostic and PR description and ran the Windows checks.
**@⁠ettehn** on GitHub · 2026-11-25 10:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/2220) `ettehn:codex/offline-precompile-trace` → `main` · +87 −13 · 2 files · 1 commits · open Part of #2088. `XCL_PSO_TRACE=1` now covers offline shader precompile, where the runtime PSO trace cannot show whether a worker is still translating, waiting for a slot, or inside the driver. **What is in it** - Pair start/end logs for shader input read and scan, CLI setup, compute translation, driver-cache read, compile-slot acquisition, and driver creation with or without a cached blob. `--export-hlsl` also traces translation. Each span reports elapsed time and process private commit, with a record hash where available. Document the opt-in trace in the README. **Tested** - The rebased release build at `dc673d70` created one synthetic compute PSO with zero refusals in each run with `XCL_PSO_TRACE=0` and `1` (separate empty caches, RTX 5070 Ti Laptop GPU, driver 621.24). Off emitted zero phase lines. On emitted six matched start/end pairs. - On the rebased commit, `cargo test --offline --locked --release -p xcl --test shaders_e2e -- --test-threads=1`: 6 passed, 0 failed, 0 ignored. Earlier validation on `17090008`: - Windows 11 build 26200.9974, Ryzen 9 8945HX, GeForce RTX 5070 Ti Laptop GPU (621.24), Rust 1.97.1 MSVC, debug build, DXC 1.8.2502.11. - `cargo test --offline --locked -p xcl --test shaders_e2e -- --test-threads=1`: 4 passed, 0 failed, 0 ignored. - `cargo test --offline --locked -p xcl --lib shaders:: -- --test-threads=1 --nocapture`: 9 passed, 0 failed, 0 ignored, no SKIPPED markers on NVIDIA. Includes the stale-driver-blob case and a read-only parse of the first 300 records of a retail shader pack. - `xcl shaders <synthetic directory> --precompile --limit 1 --only cs --split 1 --windows 4 --pipelines`: two fresh XCL caches, `XCL_PSO_TRACE=0` and `1`. Each run created one pipeline and reported zero errors. The first emitted no phase lines; the second emitted six matched start/end pairs, including the driver call without a blob. - `cargo test --offline --locked --workspace --no-run`: all workspace test binaries built at `17090008`. - NVIDIA driver-cache check with the same synthetic input: a valid blob produced a cache hit with one driver call. Replacing it with an invalid blob produced a miss and separate traced calls with and without a blob. XCL saved the rebuilt blob, and a third run reused it with one driver call. All three runs created one pipeline with zero refusals. - Filtered Windows library run with `XCL_ADAPTER=warp` and one test thread: harness reported 763 passed, 0 failed, 7 ignored, 354 filtered out. The pass count includes 62 GPU SKIPPED notices and 3 reported missing-sample skips. Filters excluded `hle::d3d12x::`, `hle::mfplat::`, `gpu::recomp::tests::`, and `gpu::agility::` because those areas include direct hardware-device paths. This run does not satisfy the full hardware suite requirement. - [Independent NVIDIA validation by @⁠itsSio](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2220) on exact head `17090008`: the full workspace suite reported 1,154 passed, 0 failed, 46 ignored on each of RTX 5080 and RTX 2080 SUPER, with 25 and 27 explicit runtime skips respectively. Both also produced six matched phase pairs with tracing enabled and zero with tracing disabled while creating one PSO in either mode. - [Independent AMD validation by @⁠luckyteagirl](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2220) on exact head `17090008`: RX 6800M created the one offline compute PSO with eight matched phase pairs (including pack read and scan), and the paired 12-second title smoke completed with 89 versus 93 frames and no crashes or device removals. The full AMD suite reported 993 passed, 161 failed, 46 ignored, and six explicit skips. The failures included a D3D12 device suspension. No matched full-suite AMD baseline established whether those failures are specific to this change. **Regression run** Same retail title, 20 seconds each, separate initially empty XCL data and DXIL caches, networking off, one DXC thread, no scripted input. Scope: startup only. Main: ``` xcl-smoke v1 commit: 06c9f5505f63f10c5ec49ef932d75b2c28177324 gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU title: RetailTitle seconds: 20 exit: 0x0 frames shown: 93 (PresentX 93) presents per 2 s (last 3): 0 1 0 device removals: 0 crashes: 0 peak commit: 11476 MB ``` PR head: ``` xcl-smoke v1 commit: dc673d702e632f1ad0fdfa985169a09e5a270d2d gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU title: RetailTitle seconds: 20 exit: 0x0 frames shown: 92 (PresentX 92) presents per 2 s (last 3): 0 1 0 device removals: 0 crashes: 0 peak commit: 11426 MB ``` **Not tested** - The full hardware workspace suite on the rebased head. - Full hardware suite on the author’s machine, world loading or gameplay, and a matched full-suite AMD baseline. **AI use** - OpenAI Codex (GPT-6.2 Sol) wrote the diagnostic and PR description and ran the Windows checks.
Extend XCL_PSO_TRACE to identify whether offline precompile is in translation, waiting for a slot, reading the driver cache, or inside pipeline creation. Pair the boundaries by span and include process private commit for diagnosing stalled workers.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:23:38 +00:00
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 11:06 UTC · original

Independent AMD verification on exact, clean PR head 170900080083670abdf688c35cbe9c3f49898aa6 against current main 568e7db7729c8fa6c8f0f4b32d798faaf11462bb.

Environment: Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5. XCL_ADAPTER=6800M.

Tests: On the PR head, cargo test --locked -p xcl --lib -j 2 shaders:: -- --test-threads=1 --show-output gave 9 passed, 0 failed, 0 ignored; one passing test printed SKIPPED because Windows Developer Mode is required to disable the driver cache. cargo build --locked --workspace -j 2 and cargo build --release --locked -p xcl -j 2 passed. After the workspace build, cargo test --locked --workspace --no-fail-fast -- --test-threads=4 reached all 21 targets: 993 passed, 161 failed, 46 ignored, six explicit SKIPPED lines. The broad RX 6800M failure cluster includes D3D12 device suspension (0x887A0005); this is not a green full suite. My first attempt had one additional e2e failure solely because I had not built the test-title binaries; the build plus the final full rerun removed it.

Offline trace: I used the locally owned retail shader pack and set XCL_PSO_TRACE=1, XCL_DXC_THREADS=1, fresh XCL_DATA_ROOT / XCL_DXIL_CACHE, and --precompile --only cs --split 1 --windows 4 --pipelines --limit 22158. The limit is the first compute record's position in this stage-ordered pack, so this processed earlier non-compute records and compiled one compute shader. Result: 1 compiled, 1 GPU pipeline made, 0 errors, 0 refusals. The log has eight start/end pairs with matching span IDs: input-read, pack-scan, precompile-init, precompile-translate, precompile-pipeline, pipeline-cache-read, pipeline-slot, and pipeline-create-without-blob. The largest private-commit sample on those phase lines was 443 MiB. A separate XCL_PSO_TRACE=0 short control emitted no phase lines; that short control contained no compute record, so it does not compare pipeline creation time. No pack content or shader blob is attached.

Paired guarded retail smoke: Release binaries, same locally owned title (title: 2ef5fd64), 12 seconds each, default HLSL path, tracing off, networking off, separate fresh data and DXIL caches; neither run hit the external memory guard. The title reached menu frames; this does not test offline precompile in the runtime.

Main:

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 12
exit: 0x0
frames shown: 89 (PresentX 89)
presents per 2 s (last 3): 1 29 60
device removals: 0
crashes: 0
peak commit: 8155 MB

PR head:

xcl-smoke v1
commit: 170900080083670abdf688c35cbe9c3f49898aa6
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 12
exit: 0x0
frames shown: 93 (PresentX 93)
presents per 2 s (last 3): 1 32 60
device removals: 0
crashes: 0
peak commit: 8174 MB

AI assistance: OpenAI Codex (GPT-6; exact variant not exposed) ran the isolated checks, verified the logs and revisions, and drafted this comment.

**@⁠luckyteagirl** on GitHub · 2026-11-25 11:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7160588778) Independent AMD verification on exact, clean PR head `170900080083670abdf688c35cbe9c3f49898aa6` against current `main` `568e7db7729c8fa6c8f0f4b32d798faaf11462bb`. **Environment:** Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver `30.0.13002.13003`, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5. `XCL_ADAPTER=6800M`. **Tests:** On the PR head, `cargo test --locked -p xcl --lib -j 2 shaders:: -- --test-threads=1 --show-output` gave **9 passed, 0 failed, 0 ignored**; one passing test printed `SKIPPED` because Windows Developer Mode is required to disable the driver cache. `cargo build --locked --workspace -j 2` and `cargo build --release --locked -p xcl -j 2` passed. After the workspace build, `cargo test --locked --workspace --no-fail-fast -- --test-threads=4` reached all 21 targets: **993 passed, 161 failed, 46 ignored**, six explicit SKIPPED lines. The broad RX 6800M failure cluster includes D3D12 device suspension (`0x887A0005`); this is **not** a green full suite. My first attempt had one additional e2e failure solely because I had not built the test-title binaries; the build plus the final full rerun removed it. **Offline trace:** I used the locally owned retail shader pack and set `XCL_PSO_TRACE=1`, `XCL_DXC_THREADS=1`, fresh `XCL_DATA_ROOT` / `XCL_DXIL_CACHE`, and `--precompile --only cs --split 1 --windows 4 --pipelines --limit 22158`. The limit is the first compute record's position in this stage-ordered pack, so this processed earlier non-compute records and compiled **one** compute shader. Result: **1 compiled, 1 GPU pipeline made, 0 errors, 0 refusals**. The log has eight start/end pairs with matching span IDs: `input-read`, `pack-scan`, `precompile-init`, `precompile-translate`, `precompile-pipeline`, `pipeline-cache-read`, `pipeline-slot`, and `pipeline-create-without-blob`. The largest private-commit sample on those phase lines was 443 MiB. A separate `XCL_PSO_TRACE=0` short control emitted no phase lines; that short control contained no compute record, so it does not compare pipeline creation time. No pack content or shader blob is attached. **Paired guarded retail smoke:** Release binaries, same locally owned title (`title: 2ef5fd64`), 12 seconds each, default HLSL path, tracing off, networking off, separate fresh data and DXIL caches; neither run hit the external memory guard. The title reached menu frames; this does not test offline precompile in the runtime. Main: ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 12 exit: 0x0 frames shown: 89 (PresentX 89) presents per 2 s (last 3): 1 29 60 device removals: 0 crashes: 0 peak commit: 8155 MB ``` PR head: ``` xcl-smoke v1 commit: 170900080083670abdf688c35cbe9c3f49898aa6 gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 12 exit: 0x0 frames shown: 93 (PresentX 93) presents per 2 s (last 3): 1 32 60 device removals: 0 crashes: 0 peak commit: 8174 MB ``` **AI assistance:** OpenAI Codex (GPT-6; exact variant not exposed) ran the isolated checks, verified the logs and revisions, and drafted this comment.
Author
Owner

@⁠itsSio on GitHub · 2026-11-25 11:07 UTC · original

Tested

Independent Windows hardware verification on clean head 170900080083670abdf688c35cbe9c3f49898aa6. Both: Windows 11 Pro build 26200, NVIDIA driver 610.88, debug MSVC. cargo build --workspace --locked -j 4 exited 0 on both.

cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --nocapture:

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

On each PC: xcl shaders <one-record directory> --precompile --only cs --split 1 --windows 4 --pipelines, one DXC worker and one pipeline worker, separate fresh XCL DXIL caches, XCL_PSO_DISK_CACHE=0, XCL_PIPELINE_CACHE_OFF=0, and XCL_PSO_TRACE=0 then 1. Same synthetic compute record 66310f0085ef8698; 10,056 bytes DXIL on RTX 5080 and 10,060 on RTX 2080 SUPER. Each launch exited 0 and made one PSO, zero refusals. Tracing off yielded zero phase lines; tracing on yielded six matched start/end pairs on each GPU: initialization, translation, precompile pipeline, cache read, slot acquisition, and pipeline-create-without-blob. This controls for the pipeline creation taking place in both modes.

Not tested: Retail smoke in our runs, AMD, packed-input read/scan, driver-blob hit/fallback, or cold performance. The driver's implicit cache was not disabled; the trace durations are not cold-build measurements.

AI use

Ran via Samaritan:

  • OpenCode (GPT-6.2 Sol): planned and ran the two-PC tests, audited the logs and trace pairs, and drafted this report.
**@⁠itsSio** on GitHub · 2026-11-25 11:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7160614148) **Tested** Independent Windows hardware verification on clean head `170900080083670abdf688c35cbe9c3f49898aa6`. Both: Windows 11 Pro build 26200, NVIDIA driver 610.88, debug MSVC. `cargo build --workspace --locked -j 4` exited 0 on both. `cargo test --workspace --locked -j 4 --no-fail-fast -- --test-threads=4 --nocapture`: | System | Suite | Runtime skips | |---|---|---| | RTX 5080 16 GB, Ryzen 7 9800X3D, 32 GiB, Rust 1.97.0, DXC 1.9.2609.5 | 1154 passed, 0 failed, 46 ignored | 25: 20 no native wave64, 3 unsupported per-lane cases, no heap windows, cache-off unavailable | | RTX 2080 SUPER 8 GB, Ryzen 5 5600X, 16 GiB, Rust 1.99.1, DXC 1.8.2502.11 | 1154 passed, 0 failed, 46 ignored | 27: same reasons plus two missing D3D12 debug-layer cases | On each PC: `xcl shaders <one-record directory> --precompile --only cs --split 1 --windows 4 --pipelines`, one DXC worker and one pipeline worker, separate fresh XCL DXIL caches, `XCL_PSO_DISK_CACHE=0`, `XCL_PIPELINE_CACHE_OFF=0`, and `XCL_PSO_TRACE=0` then `1`. Same synthetic compute record `66310f0085ef8698`; 10,056 bytes DXIL on RTX 5080 and 10,060 on RTX 2080 SUPER. Each launch exited 0 and made **one PSO, zero refusals**. Tracing off yielded zero phase lines; tracing on yielded six matched start/end pairs on each GPU: initialization, translation, precompile pipeline, cache read, slot acquisition, and `pipeline-create-without-blob`. This controls for the pipeline creation taking place in both modes. **Not tested:** Retail smoke in our runs, AMD, packed-input read/scan, driver-blob hit/fallback, or cold performance. The driver's implicit cache was not disabled; the trace durations are not cold-build measurements. **AI use** Ran via Samaritan: - OpenCode (GPT-6.2 Sol): planned and ran the two-PC tests, audited the logs and trace pairs, and drafted this report.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/shaders.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2220/head:github-bot/gh-2220'
git switch 'github-bot/gh-2220'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2220'
git switch 'github-bot/gh-2220'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2220'
git switch 'github-bot/gh-2220'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2220'
git switch 'main'
git merge --squash 'github-bot/gh-2220'
git switch 'main'
git merge --ff-only 'github-bot/gh-2220'
git switch 'main'
git merge 'github-bot/gh-2220'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.