victory-gpu: throttle pipeline workers and pause prewarming under commit pressure #1173

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

@⁠belalhama on GitHub · 2026-11-28 14:52 UTC · original
belalhama:commit-pressure-pipeline-throttling → main · +222 −17 · 3 files · 1 commits · open

Summary

On 32 GiB RAM hosts (especially with small default Windows pagefiles), parallel background compilation of speculative EARLY and slow pipelines can exhaust Windows commit headroom during loading screens and scene transitions (E_OUTOFMEMORY / Windows Event 2004, as noted in docs/windows-memory.md).

This PR makes the pipeline worker pool commit-aware and pauses speculative prewarming when host memory or commit headroom drops:

  • 32 ms physical & commit sampling (crates/victory-gpu/src/residency.rs):
    • sample_memory() now samples both ullAvailPhys and ullAvailPageFile every 32 ms and updates HEADROOM and PRESSURED, keeping memory pressure state accurate even during multi-second loading frames between submissions.
    • Added pipeline_policy() and pipeline_limits():
      • On <= 32 GiB hosts with moderate headroom (commit <= 6 GiB or physical <= 4 GiB), caps active general pipeline workers at half the pool ((workers / 2).max(2)).
      • Under host memory pressure (commit <= 4 GiB or physical <= 3 GiB), caps active general workers at 2 and pauses speculative EARLY / slow prewarming.
      • Under critical commit (< 1,536 MiB) or recent E_OUTOFMEMORY refusal, caps active general workers at 1 (for explicitly requested draws only) and pauses speculative prewarming.
    • Calls pipeline::wake_workers() whenever memory pressure clears.
  • Dynamic worker & prewarm gating (crates/victory-gpu/src/pipeline/make.rs, crates/victory-gpu/src/pipeline.rs):
    • Tracks ctive_now for general workers in Queue::pop_with().
    • Dedicated SCREEN_WORKERS (first-scene lighting and bake passes) remain unthrottled, and any EARLY pipeline promoted to REQUESTED by an active draw runs immediately even while speculative prewarming is paused.

Testing

  • Added unit tests
    esidency::tests::pipeline_policy_throttles_workers_and_pauses_prewarm_under_pressure and pipeline::make::tests::pressure_pauses_prewarming_and_caps_active_general_workers.
  • Verified cargo test -p victory-gpu --lib residency (4/4 passed) and cargo test -p victory-gpu --lib pipeline::make::tests (9/9 passed).
**@⁠belalhama** on GitHub · 2026-11-28 14:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1173) `belalhama:commit-pressure-pipeline-throttling` → `main` · +222 −17 · 3 files · 1 commits · open ### Summary On 32 GiB RAM hosts (especially with small default Windows pagefiles), parallel background compilation of speculative EARLY and slow pipelines can exhaust Windows commit headroom during loading screens and scene transitions (E_OUTOFMEMORY / Windows Event 2004, as noted in docs/windows-memory.md). This PR makes the pipeline worker pool commit-aware and pauses speculative prewarming when host memory or commit headroom drops: - **32 ms physical & commit sampling (crates/victory-gpu/src/residency.rs)**: - sample_memory() now samples both ullAvailPhys and ullAvailPageFile every 32 ms and updates HEADROOM and PRESSURED, keeping memory pressure state accurate even during multi-second loading frames between submissions. - Added pipeline_policy() and pipeline_limits(): - On <= 32 GiB hosts with moderate headroom (commit <= 6 GiB or physical <= 4 GiB), caps active general pipeline workers at half the pool ((workers / 2).max(2)). - Under host memory pressure (commit <= 4 GiB or physical <= 3 GiB), caps active general workers at 2 and pauses speculative EARLY / slow prewarming. - Under critical commit (< 1,536 MiB) or recent E_OUTOFMEMORY refusal, caps active general workers at 1 (for explicitly requested draws only) and pauses speculative prewarming. - Calls pipeline::wake_workers() whenever memory pressure clears. - **Dynamic worker & prewarm gating (crates/victory-gpu/src/pipeline/make.rs, crates/victory-gpu/src/pipeline.rs)**: - Tracks ctive_now for general workers in Queue::pop_with(). - Dedicated SCREEN_WORKERS (first-scene lighting and bake passes) remain unthrottled, and any EARLY pipeline promoted to REQUESTED by an active draw runs immediately even while speculative prewarming is paused. ### Testing - Added unit tests esidency::tests::pipeline_policy_throttles_workers_and_pauses_prewarm_under_pressure and pipeline::make::tests::pressure_pauses_prewarming_and_caps_active_general_workers. - Verified cargo test -p victory-gpu --lib residency (4/4 passed) and cargo test -p victory-gpu --lib pipeline::make::tests (9/9 passed).
- Sample both available physical RAM and Windows commit headroom every 32 ms in residency::sample_memory so pressure state stays current during long loading frames between submissions.

- Add residency::pipeline_policy / pipeline_limits to dynamically cap active general pipeline compiler workers and pause speculative EARLY/slow prewarming while pressured.

- Track active general workers in pipeline::make::Queue::pop_with while keeping dedicated screen-pass workers and draw-promoted REQUESTED pipelines unblocked, waking workers automatically when memory pressure clears.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:55:15 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline/make.rs
  • crates/victory-gpu/src/residency.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/1173/head:github-bot/gh-1173'
git switch 'github-bot/gh-1173'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1173'
git switch 'github-bot/gh-1173'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1173'
git switch 'github-bot/gh-1173'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1173'
git switch 'main'
git merge --squash 'github-bot/gh-1173'
git switch 'main'
git merge --ff-only 'github-bot/gh-1173'
git switch 'main'
git merge 'github-bot/gh-1173'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1173
No description provided.