GPU: cap default pipeline worker count on <=24 GiB RAM hosts #2942

Closed
alexandruiulian201-bot wants to merge 1 commit from upstream-pr/2944 into main
alexandruiulian201-bot commented 2026-11-26 01:08:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-26T01:08:02Z.


Problem

pipeline::make::queue currently spawns (cores / 2).clamp(2, 8) background pipeline workers regardless of installed physical RAM. On 16 GiB RAM systems with 8–16 logical processors, 4–8 concurrent victory-shader translations and driver PSO compiles can exhaust Windows commit memory and trigger E_OUTOFMEMORY during world loading.

Fix

Query installed physical memory via GlobalMemoryStatusEx (Win32_System_SystemInformation is already enabled in crates/victory-gpu/Cargo.toml, so no manifest or lockfile changes are needed) and bound the automatic default via default_workers(cores, total_phys):

<= 18 GiB RAM: cap at 2 workers
<= 26 GiB RAM: cap at 4 workers

26 GiB RAM or failed query: unchanged (cores / 2).clamp(2, 8)

This complements #2250 (VICTORY_PIPELINE_THREADS manual override) by making the out-of-the-box default safe on 16–24 GiB machines without changing behavior on 32+ GiB hosts.

Verification
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default and --all-features): clean
cargo test -p xtask --locked: 6/6 passed (repository_passes_policy ok)
cargo test -p victory-gpu --lib --locked -- pipeline::make::tests:: on GTX 1070: 4/4 passed (default) and 5/5 passed (--features diagnostics)
VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --lib --features diagnostics --locked -- pipeline::make::tests::: 5/5 passed
VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib --features diagnostics --locked -- --test-threads=1: 248/248 passed (1 ignored)

<!-- greyfinch-sync:Marvisak/VIctory:issue:6617162375 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2944). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-26T01:08:02Z. --- Problem pipeline::make::queue currently spawns (cores / 2).clamp(2, 8) background pipeline workers regardless of installed physical RAM. On 16 GiB RAM systems with 8–16 logical processors, 4–8 concurrent victory-shader translations and driver PSO compiles can exhaust Windows commit memory and trigger E_OUTOFMEMORY during world loading. Fix Query installed physical memory via GlobalMemoryStatusEx (Win32_System_SystemInformation is already enabled in crates/victory-gpu/Cargo.toml, so no manifest or lockfile changes are needed) and bound the automatic default via default_workers(cores, total_phys): <= 18 GiB RAM: cap at 2 workers <= 26 GiB RAM: cap at 4 workers > 26 GiB RAM or failed query: unchanged (cores / 2).clamp(2, 8) This complements #2250 (VICTORY_PIPELINE_THREADS manual override) by making the out-of-the-box default safe on 16–24 GiB machines without changing behavior on 32+ GiB hosts. Verification cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default and --all-features): clean cargo test -p xtask --locked: 6/6 passed (repository_passes_policy ok) cargo test -p victory-gpu --lib --locked -- pipeline::make::tests:: on GTX 1070: 4/4 passed (default) and 5/5 passed (--features diagnostics) VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --lib --features diagnostics --locked -- pipeline::make::tests::: 5/5 passed VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib --features diagnostics --locked -- --test-threads=1: 248/248 passed (1 ignored)
fuzeofficlal commented 2026-11-26 02:07:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:21:53Z.


Code review and RTX 5090 + WARP verification at head 85be068a1c80 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/pipeline/make.rs:265-281):
    • Properly Windows-only (pipeline.rs:589); total_physical_memory() zero-initializes MEMORYSTATUSEX with dwLength = size_of::<MEMORYSTATUSEX>() as u32 and returns None on failure.
    • default_workers(cores, total_phys) caps worker count cleanly (<= 18 GiB -> 2, <= 26 GiB -> 4, > 26 GiB / None -> 8) and clamps (cores / 2).clamp(2, cap) safely even for cores <= 1.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings
    • victory-gpu --lib pipeline::: 25/25 passed default on RTX 5090; 28/28 passed (--features diagnostics) on WARP (including default_workers_scales_with_physical_memory and total_physical_memory_reports_nonzero_ram).

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179700091 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2944#issuecomment-7179700091). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:21:53Z. --- Code review and RTX 5090 + WARP verification at head `85be068a1c80` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/pipeline/make.rs:265-281`)**: - Properly Windows-only (`pipeline.rs:589`); `total_physical_memory()` zero-initializes `MEMORYSTATUSEX` with `dwLength = size_of::<MEMORYSTATUSEX>() as u32` and returns `None` on failure. - `default_workers(cores, total_phys)` caps worker count cleanly (`<= 18 GiB -> 2`, `<= 26 GiB -> 4`, `> 26 GiB / None -> 8`) and clamps `(cores / 2).clamp(2, cap)` safely even for `cores <= 1`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): 0 warnings - `victory-gpu --lib pipeline::`: **25/25 passed** default on RTX 5090; **28/28 passed** (`--features diagnostics`) on WARP (including `default_workers_scales_with_physical_memory` and `total_physical_memory_reports_nonzero_ram`). LGTM.
Dukestar69 commented 2026-11-26 03:04:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T02:16:10Z.

Review: APPROVED


Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-gpu --lib pipeline::make::tests: 4 passed, 0 failed (including new default_workers_scales_with_physical_memory and total_physical_memory_reports_nonzero_ram).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Capping default pipeline workers to 2 on <= 18 GiB and 4 on <= 26 GiB while keeping 2..=8 on 32+ GiB hosts is clean and well-tested.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6067663487 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2944#pullrequestreview-6067663487). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T02:16:10Z. **Review:** APPROVED --- Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-gpu --lib pipeline::make::tests`: **4 passed, 0 failed** (including new `default_workers_scales_with_physical_memory` and `total_physical_memory_reports_nonzero_ram`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Capping default pipeline workers to 2 on `<= 18 GiB` and 4 on `<= 26 GiB` while keeping `2..=8` on `32+ GiB` hosts is clean and well-tested. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
kotekompotek commented 2026-11-26 03:04:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:19:12Z.

Review: COMMENTED


Verified: the memory-based cap keeps the old (cores/2).clamp(2,8) behaviour on 32+ GiB hosts, so this only reduces concurrency where RAM is tight. GlobalMemoryStatusEx use is correct (dwLength set, bool checked). Boundary tests cover both the RAM tiers and the core scaling. One thing worth a sentence in the PR body: on a <=18 GiB 32-core host this drops 8->2 workers, which trades pipeline-warmup latency for commit headroom — intended, but reviewers on large-RAM machines won't see the difference.

<!-- greyfinch-sync:Marvisak/VIctory:review:6067691335 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2944#pullrequestreview-6067691335). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T02:19:12Z. **Review:** COMMENTED --- Verified: the memory-based cap keeps the old (cores/2).clamp(2,8) behaviour on 32+ GiB hosts, so this only reduces concurrency where RAM is tight. GlobalMemoryStatusEx use is correct (dwLength set, bool checked). Boundary tests cover both the RAM tiers and the core scaling. One thing worth a sentence in the PR body: on a <=18 GiB 32-core host this drops 8->2 workers, which trades pipeline-warmup latency for commit headroom — intended, but reviewers on large-RAM machines won't see the difference.
Marvisak commented 2026-11-26 05:04:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:28:47Z.


Automated triage for the maintainers.

Needs work. This caps the background pipeline worker count in queue (pipeline/make.rs) by installed RAM via GlobalMemoryStatusEx (2 workers at 18 GiB or less, 4 at 26 GiB or less). The code is sound, but it slows warm-up for most users and gives no evidence of the problem. Please attach a log or reproduction of the E_OUTOFMEMORY on a 16 GiB host and a measurement of peak commit per worker, so the thresholds rest on data; a test that only checks total_physical_memory() is non-zero adds little.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182630775 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2944#issuecomment-7182630775). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T04:28:47Z. --- <!-- victory-triage v1 head=85be068a1c8096ee09d6e1632792b758d4c763a2 verdict=needs-work at=2026-11-26T04:28:41Z --> Automated triage for the maintainers. **Needs work.** This caps the background pipeline worker count in `queue` (`pipeline/make.rs`) by installed RAM via `GlobalMemoryStatusEx` (2 workers at 18 GiB or less, 4 at 26 GiB or less). The code is sound, but it slows warm-up for most users and gives no evidence of the problem. Please attach a log or reproduction of the E_OUTOFMEMORY on a 16 GiB host and a measurement of peak commit per worker, so the thresholds rest on data; a test that only checks `total_physical_memory()` is non-zero adds little. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-26 11:03:32 +00:00
alexandruiulian201-bot commented 2026-11-26 11:04:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-26T10:49:12Z.


Following up on the triage feedback, I measured peak commit per pipeline worker directly on this 15.89 GiB RAM host (Windows 11, i7-7700HQ 4C/8T, NVIDIA GTX 1070 8 GB):

1. Concurrent shader translation + D3D12 PSO creation (victory translate --pipelines --jobs N on the 411 MiB shader archive, 35 s window per run):

Workers Peak Private (MiB) Peak Paged / Commit (MiB) Peak Working Set (MiB) E_OUTOFMEMORY
1 533.9 534.0 687.0 0
2 573.9 574.0 727.7 0
4 540.5 542.4 708.2 0
8 624.0 625.5 787.6 0

(translate --cache over 45 s showed the same range: 521.7 MiB at 1 job up to 682.2 MiB at 8 jobs, 0 OOM.) Incremental peak commit is only ~13–25 MiB per additional concurrent worker.

2. victory run --execute (45 s cold boot with VICTORY_PIPELINE_WORKERS=2 / 4 / 8):

  • 2 workers: 12,619.1 MiB peak commit
  • 4 workers: 12,623.2 MiB peak commit
  • 8 workers: 12,619.0 MiB peak commit
  • (Rising to 14,894.4 MiB peak commit during world gameplay.)

Re-checking earlier 0x8007000E (E_OUTOFMEMORY) warnings in an older Wave64 log also showed they followed first-chance access violations inside nvwgf2umx.dll/nvgpucomp64.dll rather than system commit exhaustion from pipeline worker concurrency.

The triage feedback is right: the 12–15 GiB commit footprint on a 16 GiB host comes from title and host GPU memory, not pipeline worker threads, so capping default workers to 2 on <=18 GiB would slow warm-up for negligible commit savings. Closing this PR — manual tuning via #2250 is the right tool for edge cases.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7189879306 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2944#issuecomment-7189879306). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-26T10:49:12Z. --- Following up on the triage feedback, I measured peak commit per pipeline worker directly on this 15.89 GiB RAM host (Windows 11, i7-7700HQ 4C/8T, NVIDIA GTX 1070 8 GB): **1. Concurrent shader translation + D3D12 PSO creation (`victory translate --pipelines --jobs N` on the 411 MiB shader archive, 35 s window per run):** | Workers | Peak Private (MiB) | Peak Paged / Commit (MiB) | Peak Working Set (MiB) | `E_OUTOFMEMORY` | |---:|---:|---:|---:|---:| | 1 | 533.9 | 534.0 | 687.0 | 0 | | 2 | 573.9 | 574.0 | 727.7 | 0 | | 4 | 540.5 | 542.4 | 708.2 | 0 | | 8 | 624.0 | 625.5 | 787.6 | 0 | (`translate --cache` over 45 s showed the same range: 521.7 MiB at 1 job up to 682.2 MiB at 8 jobs, 0 OOM.) Incremental peak commit is only ~13–25 MiB per additional concurrent worker. **2. `victory run --execute` (45 s cold boot with `VICTORY_PIPELINE_WORKERS=2 / 4 / 8`):** - 2 workers: `12,619.1 MiB` peak commit - 4 workers: `12,623.2 MiB` peak commit - 8 workers: `12,619.0 MiB` peak commit - (Rising to `14,894.4 MiB` peak commit during world gameplay.) Re-checking earlier `0x8007000E` (`E_OUTOFMEMORY`) warnings in an older Wave64 log also showed they followed first-chance access violations inside `nvwgf2umx.dll`/`nvgpucomp64.dll` rather than system commit exhaustion from pipeline worker concurrency. The triage feedback is right: the 12–15 GiB commit footprint on a 16 GiB host comes from title and host GPU memory, not pipeline worker threads, so capping default workers to 2 on `<=18 GiB` would slow warm-up for negligible commit savings. Closing this PR — manual tuning via #2250 is the right tool for edge cases.

Pull request closed

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
Marvisak/VIctory!2942
No description provided.