Shaders: precompile a bounded recorded startup prefix #3182

Merged
bmjask merged 2 commits from upstream-pr/3182 into main 2026-11-28 16:59:49 +00:00
bmjask commented 2026-11-28 16:32:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-28T16:32:08Z.


Part of #2088. This adds an opt-in offline command that consumes the ordered manifest and prepares only the compute pipelines first used through a measured present. It resolves the complete prefix before GPU work and refuses prefixes over 500 pipelines, so missing or oversized history cannot silently become a partial or unbounded startup build.

Stacked on #3175 and #3181; only commit 971f857b belongs here. Supersedes #2104 on current main; credit to @RandomGithub12309 for the original implementation.

What is in it

  • shaders/milestone.rs: parse ordered v1 history, select deduplicated compute keys through an exact present, resolve all records first, enforce the 500-pipeline limit, then use the existing translator/pipeline/blob path
  • shaders.rs: structured CLI parsing and compatibility checks for --pso-manifest FILE --through-present N
  • README.md: document the opt-in command and its fail-closed behavior

Tested

  • Windows 11 Pro; Intel Core i9-12900K; NVIDIA GeForce RTX 4090 driver 610.88; Rust 1.100.0; debug tests and release smoke build
  • cargo test -p xcl --lib shaders::milestone::tests -- --test-threads=1: 5 passed, 0 failed
  • cargo build --workspace: passed
  • cargo test --workspace -- --test-threads=4: 2152 passed, 0 failed, 48 ignored; 26 runtime GPU skips (wave64 unavailable, unsupported instruction cases, missing dxil.dll, and heap windows unavailable)

Regression run
Main (db3921dcc69a32be381a17b6a81c944617338c9f):

xcl-smoke v1
commit: db3921dcc69a32be381a17b6a81c944617338c9f
gpu: NVIDIA GeForce RTX 4090
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1418 (PresentX 1418)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14703 MB

This PR (971f857bc01115d93ee080ead4f07f8fe898e07b):

xcl-smoke v1
commit: 971f857bc01115d93ee080ead4f07f8fe898e07b
gpu: NVIDIA GeForce RTX 4090
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1446 (PresentX 1446)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15055 MB

Not tested

  • AMD or Intel GPUs
  • A real-title milestone build: validation used synthetic records and did not launch a corpus preparation sweep
  • Graphics/mesh PSOs, automatic launch gating, elapsed-time budgets, or region prediction; this PR is the bounded compute-only offline slice
  • Cold compile speedup; no startup speedup is claimed by this opt-in command alone

AI use
Codex with GPT-5 adapted #2104 to the current structured CLI, added the 500-pipeline fail-closed bound and test, ran the reported build/tests/smoke, and prepared this PR.

<!-- greyfinch-sync:ivall/xcl:issue:5542308439 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3182). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-28T16:32:08Z. --- Part of #2088. This adds an opt-in offline command that consumes the ordered manifest and prepares only the compute pipelines first used through a measured present. It resolves the complete prefix before GPU work and refuses prefixes over 500 pipelines, so missing or oversized history cannot silently become a partial or unbounded startup build. Stacked on #3175 and #3181; only commit `971f857b` belongs here. Supersedes #2104 on current `main`; credit to @RandomGithub12309 for the original implementation. **What is in it** - `shaders/milestone.rs`: parse ordered v1 history, select deduplicated compute keys through an exact present, resolve all records first, enforce the 500-pipeline limit, then use the existing translator/pipeline/blob path - `shaders.rs`: structured CLI parsing and compatibility checks for `--pso-manifest FILE --through-present N` - `README.md`: document the opt-in command and its fail-closed behavior **Tested** - Windows 11 Pro; Intel Core i9-12900K; NVIDIA GeForce RTX 4090 driver 610.88; Rust 1.100.0; debug tests and release smoke build - `cargo test -p xcl --lib shaders::milestone::tests -- --test-threads=1`: 5 passed, 0 failed - `cargo build --workspace`: passed - `cargo test --workspace -- --test-threads=4`: 2152 passed, 0 failed, 48 ignored; 26 runtime GPU skips (wave64 unavailable, unsupported instruction cases, missing `dxil.dll`, and heap windows unavailable) **Regression run** Main (`db3921dcc69a32be381a17b6a81c944617338c9f`): ``` xcl-smoke v1 commit: db3921dcc69a32be381a17b6a81c944617338c9f gpu: NVIDIA GeForce RTX 4090 title: retail-title seconds: 60 exit: 0x0 frames shown: 1418 (PresentX 1418) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14703 MB ``` This PR (`971f857bc01115d93ee080ead4f07f8fe898e07b`): ``` xcl-smoke v1 commit: 971f857bc01115d93ee080ead4f07f8fe898e07b gpu: NVIDIA GeForce RTX 4090 title: retail-title seconds: 60 exit: 0x0 frames shown: 1446 (PresentX 1446) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15055 MB ``` **Not tested** - AMD or Intel GPUs - A real-title milestone build: validation used synthetic records and did not launch a corpus preparation sweep - Graphics/mesh PSOs, automatic launch gating, elapsed-time budgets, or region prediction; this PR is the bounded compute-only offline slice - Cold compile speedup; no startup speedup is claimed by this opt-in command alone **AI use** Codex with GPT-5 adapted #2104 to the current structured CLI, added the 500-pipeline fail-closed bound and test, ran the reported build/tests/smoke, and prepared this PR.
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!3182
No description provided.