Shaders: trace offline precompile phases #2210

Open
ettehn wants to merge 1 commit from upstream-pr/2220 into main
ettehn commented 2026-11-25 10:15:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-25T10:15:51Z.


Part of #2088. XCL_PSO_TRACE=1 traces shader precompile, including split compute PSOs. Rebased onto main 8b957bec. The shared precompile path retains startup adapter selection, progress and cancellation, and initial whole-form builds for split compute.

What is in it

  • Pair start/end logs for input read and scan, CLI setup, compute translation, driver-cache read, slot acquisition, and driver pipeline creation with or without a cached blob. Include elapsed time, process private commit and the shader hash where available.
  • Keep split pieces under the parent shader's record hash while reporting each piece's own DXIL size. --export-hlsl also traces translation.

Tested

  • Head af21d7773852abf88b1c1b8c423c133c8378518b on Windows 11 25H2 build 26200.9974, Ryzen 9 8945HX, RTX 5070 Ti Laptop (621.24), Rust 1.97.1 MSVC, SDK DXC 1.8.2502.11.
  • cargo build --workspace --locked --offline -j 2 passed. cargo test -p xcl --lib shaders:: -- --test-threads=1 --nocapture reported 10 passed and 0 failures. The retail-pack sample explicitly skipped because XCL_SAMPLE_RPF was unset.
  • cargo test -p xcl --test e2e --test shaders_e2e --test launcher_e2e -- --test-threads=1 --nocapture passed 19/19. The synthetic title completed with zero title failures and reused the same HWND for shader preparation and the swap chain.
  • A synthetic compute record made one GPU pipeline with zero refusals in each trace-off, cold trace-on and warm trace-on run. Tracing off emitted no phase lines. Each trace-on run had six matched phase pairs, and the warm run reported one driver-blob hit. Cold refers to the XCL cache.

Regression run

Paired retail smoke on this head and its current base is pending. The earlier 20-second startup pair was 101 frames at b49be183 and 102 at 419431cf, with zero crashes and device removals in both.

Not tested

  • Whole workspace test suite, retail startup or world loading, AMD, and native wave64 on this head.

AI use

  • OpenAI Codex (GPT-6.2 Sol) assisted with implementation, rebasing, Windows verification and the PR description.
  • OpenAI Codex assisted with this conflict resolution and the new Windows verification.
Test evidence from superseded revisions
  • Windows 11 25H2 build 26200.9974, Ryzen 9 8945HX, RTX 5070 Ti Laptop (driver 621.24), Rust 1.97.1 MSVC, Windows SDK DXC 1.8.2502.11.
  • cargo build --workspace --offline --locked -j 2 passed. cargo test --workspace --offline --locked -j 2 --no-fail-fast -- --test-threads=1 --nocapture: 1,431 passed, 4 failed, 47 ignored, with 25 explicit GPU skips. Four DXIL fuzz seeds (70, 545, 1019, 1507) also returned 0x8007000E at CreateComputePipelineState on clean main b49be183.
  • The 10 focused shader tests passed. With tracing enabled, the split-compute GPU fixture recorded 21 matched phase pairs across cold builds and blob reuse. Tracing off emitted none.
  • A synthetic CLI record built one PSO with zero refusals in each run. Trace-off emitted no phase lines. Trace-on identified a cold creation and then a separate warm run with a driver-blob hit.
  • Independent reports on the earlier 17090008 revision: NVIDIA, AMD.

Same retail title, 20 seconds each, separate initially empty XCL data and DXIL caches, networking off and no scripted input. The main result is the same clean baseline used for #2409.

Main:

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

PR:

xcl-smoke v1
commit: 419431cf03c24b05fad17f884823f2a1f83c1914
gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU
title: RetailTitle
seconds: 20
exit: 0x0
frames shown: 102 (PresentX 102)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 10964 MB
<!-- greyfinch-sync:ivall/xcl:issue:5489351228 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2220). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-25T10:15:51Z. --- Part of #2088. `XCL_PSO_TRACE=1` traces shader precompile, including split compute PSOs. Rebased onto `main` `8b957bec`. The shared precompile path retains startup adapter selection, progress and cancellation, and initial whole-form builds for split compute. **What is in it** - Pair start/end logs for input read and scan, CLI setup, compute translation, driver-cache read, slot acquisition, and driver pipeline creation with or without a cached blob. Include elapsed time, process private commit and the shader hash where available. - Keep split pieces under the parent shader's record hash while reporting each piece's own DXIL size. `--export-hlsl` also traces translation. **Tested** - Head `af21d7773852abf88b1c1b8c423c133c8378518b` on Windows 11 25H2 build 26200.9974, Ryzen 9 8945HX, RTX 5070 Ti Laptop (621.24), Rust 1.97.1 MSVC, SDK DXC 1.8.2502.11. - `cargo build --workspace --locked --offline -j 2` passed. `cargo test -p xcl --lib shaders:: -- --test-threads=1 --nocapture` reported 10 passed and 0 failures. The retail-pack sample explicitly skipped because `XCL_SAMPLE_RPF` was unset. - `cargo test -p xcl --test e2e --test shaders_e2e --test launcher_e2e -- --test-threads=1 --nocapture` passed 19/19. The synthetic title completed with zero title failures and reused the same HWND for shader preparation and the swap chain. - A synthetic compute record made one GPU pipeline with zero refusals in each trace-off, cold trace-on and warm trace-on run. Tracing off emitted no phase lines. Each trace-on run had six matched phase pairs, and the warm run reported one driver-blob hit. Cold refers to the XCL cache. **Regression run** Paired retail smoke on this head and its current base is pending. The earlier 20-second startup pair was 101 frames at `b49be183` and 102 at `419431cf`, with zero crashes and device removals in both. **Not tested** - Whole workspace test suite, retail startup or world loading, AMD, and native wave64 on this head. **AI use** - OpenAI Codex (GPT-6.2 Sol) assisted with implementation, rebasing, Windows verification and the PR description. - OpenAI Codex assisted with this conflict resolution and the new Windows verification. <details> <summary>Test evidence from superseded revisions</summary> - Windows 11 25H2 build 26200.9974, Ryzen 9 8945HX, RTX 5070 Ti Laptop (driver 621.24), Rust 1.97.1 MSVC, Windows SDK DXC 1.8.2502.11. - `cargo build --workspace --offline --locked -j 2` passed. `cargo test --workspace --offline --locked -j 2 --no-fail-fast -- --test-threads=1 --nocapture`: 1,431 passed, 4 failed, 47 ignored, with 25 explicit GPU skips. Four DXIL fuzz seeds (70, 545, 1019, 1507) also returned `0x8007000E` at `CreateComputePipelineState` on clean `main` `b49be183`. - The 10 focused shader tests passed. With tracing enabled, the split-compute GPU fixture recorded 21 matched phase pairs across cold builds and blob reuse. Tracing off emitted none. - A synthetic CLI record built one PSO with zero refusals in each run. Trace-off emitted no phase lines. Trace-on identified a cold creation and then a separate warm run with a driver-blob hit. - Independent reports on the earlier `17090008` revision: [NVIDIA](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7160614148), [AMD](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7160588778). Same retail title, 20 seconds each, separate initially empty XCL data and DXIL caches, networking off and no scripted input. The main result is the same clean baseline used for #2409. Main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU title: RetailTitle seconds: 20 exit: 0x0 frames shown: 101 (PresentX 101) presents per 2 s (last 3): 0 0 1 device removals: 0 crashes: 0 peak commit: 10971 MB ``` PR: ``` xcl-smoke v1 commit: 419431cf03c24b05fad17f884823f2a1f83c1914 gpu: NVIDIA GeForce RTX 5070 Ti Laptop GPU title: RetailTitle seconds: 20 exit: 0x0 frames shown: 102 (PresentX 102) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 10964 MB ``` </details>
luckyteagirl commented 2026-11-25 11:09:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T11:06:09Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7160588778 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7160588778). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T11:06:09Z. --- 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.
itsSio commented 2026-11-25 11:09:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by itsSio on 2026-11-25T11:07:11Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7160614148 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7160614148). Originally posted by [itsSio](https://github.com/itsSio) on 2026-11-25T11:07:11Z. --- **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.
Foniass commented 2026-12-01 07:36:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:36:32Z.


Triage (#1607) – head af21d77

No open or merged PR traces precompile phases. #2208 changes the same Pipelines::make signature for a different purpose (device-removal reporting), so these two PRs will conflict but do not overlap. The amd-dev merges (#3547/#3554) add a separate process_memory() for --measure-pso. That code could be shared with ShaderPhase::log but is not the same change. The title-similar #2704 is unrelated.
No problems found in the diff: tracing is off unless XCL_PSO_TRACE=1, and the record hash is computed only when it is on. The PR description check is failing.
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:7304265455 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2220#issuecomment-7304265455). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:36:32Z. --- **Triage (#1607)** – head af21d77 No open or merged PR traces precompile phases. #2208 changes the same `Pipelines::make` signature for a different purpose (device-removal reporting), so these two PRs will conflict but do not overlap. The amd-dev merges (#3547/#3554) add a separate `process_memory()` for `--measure-pso`. That code could be shared with `ShaderPhase::log` but is not the same change. The title-similar #2704 is unrelated. No problems found in the diff: tracing is off unless `XCL_PSO_TRACE=1`, and the record hash is computed only when it is on. The `PR description` check is failing. 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/2220:upstream-pr/2220'
git switch 'upstream-pr/2220'

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/2220'
git switch 'upstream-pr/2220'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2220'
git switch 'upstream-pr/2220'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2220'
git switch 'main'
git merge --squash 'upstream-pr/2220'
git switch 'main'
git merge --ff-only 'upstream-pr/2220'
git switch 'main'
git merge 'upstream-pr/2220'
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!2210
No description provided.