GPU: throttle pipeline workers and pause early prewarming when commit headroom is low #777
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/777"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by im-a-cat on 2026-11-25T07:21:19Z.
Why
During scene transitions on 32 GB Windows systems (reported in #771), the title hits
std::alloc::rust_oom(0xc0000409) without any GPU hang or TDR right during a burst of shader/pipeline compilation. Running up to 8 concurrentHostPipeline::newworkers while also queueing speculativeEARLYprewarm pipelines multiplies transient compiler/driver commit allocations just when virtual commit charge (GlobalMemoryStatusEx::ullAvailPageFile) is nearly exhausted.What
crates/victory-gpu/src/host.rs:memory_status()helper aroundGlobalMemoryStatusExand addsavailable_commit_ram()(ullAvailPageFile) alongsideavailable_physical_ram()(ullAvailPhys).crates/victory-gpu/src/pipeline/make.rs:commit_budget(base_workers, avail_commit_bytes, avail_phys_bytes, floor_mb)helper controlled byVICTORY_PIPELINE_COMMIT_MB(default2048MiB;0disables commit throttling):>= 4 GiBavailable commit and>= 2 GiBavailable physical RAM at the default2048MiB floor): full worker parallelism and speculativeEARLYprewarming, unchanged frommain.< 4 GiBcommit or< 2 GiBphysical RAM): pauses speculativeEARLYprewarm queueing/popping and caps concurrentHostPipeline::newworkers to at most 2 (REQUESTEDdraw pipelines still run immediately).< 2 GiBcommit): serializes pipeline compilation to 1 worker and skipsEARLYprewarm.Queue(protected byQUEUE+AVAILABLE, released via an RAIIActiveGuardon completion/drop so counts stay balanced and sleeping workers wake viaAVAILABLE.notify_all()).pipeline::make::tests:commit_budget_throttles_workers_and_early_under_pressureearly_pipelines_are_deferred_when_only_requested_allowedVerification
cargo xtask policy:asset policy: 171 files okcargo clippy -p victory-gpu --lib --tests --features diagnostics: clean inhost.rsandpipeline/make.rs(only pre-existingdraw.rs/indirect.rslints onmain)cargo test --workspace --locked: all non-ignored unit/integration tests pass (0failures across every crate, including the 2 newpipeline::make::testscases).Mitigates #771
Imported from fxceless/victory-fork. Originally posted by hxghr6 on 2026-11-25T12:16:07Z.
A data point from an RX 9070 XT (Windows 11, 31 GB RAM, page file managed by Windows, AMD driver 32.0.31044.16) on what limiting the pipeline workers by commit headroom does at the world load. I tried two forms of the same idea on
main310c6eb(not this PR's code), each run into the world with scripted keys and a cold driver shader cache (a freshVICTORY_SHADER_LOOP_LIMIT), sampling the process and the system's commit every 10 s:With and without the limit the system's commit stayed within 1 to 2 GB of its limit while the page file grew it from 38 GB to 56-58 GB, and the process grew by the same 20 GB in about two minutes. So on this machine the commit is taken by the world load itself, not by how many compiles run at once; serializing compiles alone did not keep the headroom, and serializing them fully made the world wait minutes for its pipelines. Four device removals at the same point, all without a limit, made the 1-at-a-time run's survival suggestive but not proof. Offline, the biggest compute pipeline (
39f0e9aeb156a61c) peaks at 2 GB for a single compile on this driver.That is one run of each limited form against four without a limit (the table's first row is the one of those four whose system commit was sampled), so take it as indicative.
Imported from fxceless/victory-fork. Originally posted by Flyander on 2026-11-25T20:19:34Z.
Review: COMMENTED
On RTX 5070 Ti / Windows 11 with 32 GiB RAM, a separate run of current main spent several minutes around 0.8–3 GiB of commit headroom during world entry, then recovered as work drained. I found one scheduler edge case worth covering before relying on prewarm to resume after that transition.
Imported from fxceless/victory-fork. Originally posted by Flyander on 2026-11-25T20:19:34Z.
Code review location:
crates/victory-gpu/src/pipeline/make.rs; line 384If pressure pauses EARLY work while there are queued EARLY jobs and no active workers, all workers go into this unconditional wait. An increase in host memory headroom does not notify
AVAILABLE, so those jobs stay queued until another pipeline happens to be requested. This leaves a quiet part of loading unable to prewarm. A boundedwait_timeoutonly when real EARLY work is deferred and no worker is active would recheck headroom while leaving the empty queue on the existing blocking wait. The existing queue test callspop_with(true)directly, so it does not cover the sleeping workers.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.