Skip to content

Scripts: stop shader precompile at a private commit budget - #1756

Open
NemesisDawn wants to merge 1 commit into
xcl-dev:mainfrom
NemesisDawn:fix/precompile-commit-budget
Open

NemesisDawn wants to merge 1 commit into
xcl-dev:mainfrom
NemesisDawn:fix/precompile-commit-budget

Conversation

@NemesisDawn

@NemesisDawn NemesisDawn commented Nov 24, 2026 •

Copy link
Copy Markdown

Add an opt-in Windows wrapper for offline shader precompilation. It samples the XCL process’s private commit every 100 ms and stops it at a user-set threshold. Completed cache files stay available for the next run. Part of #1657.

What is in it

  • scripts/precompile-budget.ps1 launches and monitors XCL. The README shows how to use it, and scripts/precompile-budget.tests.ps1 exercises it with a native test process.

Tested

  • At f86b011, scripts/precompile-budget.tests.ps1 passed on Windows PowerShell 5.1 and PowerShell 7.6.9. A normal child preserved its arguments and exit code. A child allocating memory stopped with exit code 4 at a 74 MiB sample with a 48 MiB budget, leaving a completed fixture cache file intact.

Not tested

  • Retail shader pack, real XCL cache reuse, and the full Cargo workspace suite on a GPU.

AI use

  • OpenAI Codex (GPT-6, exact variant unavailable) wrote the patch and regression tests, ran the focused checks, and drafted this description.

Sample the offline XCL process and stop it at a user-set threshold.
Keep completed cache files for the next run.

Assisted-by: OpenAI Codex (GPT-6, exact variant unavailable)
@futurepro62

Copy link
Copy Markdown

Tested exact head f86b011, script tests only, since this PR has no test report yet.

Tested

  • Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here).
  • powershell.exe -NoProfile -File scripts/precompile-budget.tests.ps1 at the head: exit 0, Both precompile budget checks passed. (it prints the stop message: XCL precompile stopped at 74 MiB private commit (limit 48 MiB)).
  • The PR's test file against current main's script (266b845): not applicable: precompile-budget.ps1 is new in this PR, so main has nothing for the test to run.

Not tested

  • PowerShell 7, the CI workflow itself, a game (no runtime code changed).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

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 under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@anes66

anes66 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Independent Windows 10 CPU-only check of exact head f86b01177dee524b4382232efb3f220b6bbd2841: the checked-in synthetic wrapper tests passed in Windows PowerShell and PowerShell 7.

Tested

  • Windows 10 Pro 19045, Ryzen 7 9800X3D, Windows PowerShell 5.1.19041.7844 and PowerShell 7.6.9. The two scripts were extracted with git archive; both extracted file hashes match the Git blobs at this commit. The fixture was compiled with the installed .NET Framework C# compiler.
  • powershell.exe -NoProfile -ExecutionPolicy Bypass -File <scripts/precompile-budget.tests.ps1> and the equivalent pwsh.exe command: both exit 0 and print Both precompile budget checks passed.
  • Each shell checks the fast child's exact arguments (including quotes, a trailing backslash and an empty argument) and exit code 23, then a synthetic 64 MiB allocation with a 48 MiB sampling threshold. Both observed 74 MiB at termination, returned budget exit code 4, and preserved the completed fixture cache entry.
  • The initial Windows PowerShell attempt without the process-scoped execution-policy argument was blocked as an unsigned script; no test ran in that attempt. The passing commands above use a test-process-only exception. No persistent execution policy or other system setting changed.

Not tested
Real XCL, a shader pack, cache reuse by XCL, a title, GPU execution, Cargo suite, cancellation/error cleanup paths or a hard memory ceiling. The 74 MiB sample with a 48 MiB threshold confirms the documented sampling overshoot; it is not a hard commit cap.

@RavenCurseBurg

RavenCurseBurg commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Tested cancellation at f86b01177dee524b4382232efb3f220b6bbd2841 on Windows 11 (26100.9711), using the unmodified wrapper and a small synthetic .NET child. The child wrote a completed cache sentinel and its PID, then slept for up to 15 seconds. I verified the live process's executable path before stopping the calling PowerShell pipeline.

Shell Pipeline stop and observed child exit Completed sentinel
Windows PowerShell 5.1.26100.9711 58 ms Original contents
PowerShell 7.6.9 28 ms Original contents

Both runspaces reported Stopped. In both shells the normal short-lived fixture returned its exit code 23, and the missing-input and missing-executable cases returned path errors before launching the child. This checked ordinary pipeline cancellation below a 256 MiB threshold. No live XCL process, shader pack, GPU, retail game, forced host termination or memory-pressure run. OpenAI Codex (GPT-6) ran these checks and wrote this report.

@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head f86b011

#1804 ("Part of #1657" too) works on the same memory problem inside shaders.rs (skips reloading cached PSO blobs); this PR wraps the precompile in an external watchdog instead. Different approaches, not a duplicate.
#1657 was closed on 2026-11-24 after the growth was traced to #1307 and fixed on main (#1321, #1748), so the README's motivation for this wrapper may no longer hold; worth confirming with a run on current main.
precompile-budget.tests.ps1 assigns to $input, which is a PowerShell automatic variable; a different name avoids surprises. The PR conflicts with main's README.
Recommendation: keep open.

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

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.

7 participants