GPU: throttle pipeline workers and pause early prewarming when commit headroom is low #777
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!777
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@im-a-cat on GitHub · 2026-11-25 07:21 UTC · original
im-a-cat:fix/pipeline-commit-headroom→main· +162 −11 · 2 files · 1 commits · openWhy
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
@hxghr6 on GitHub · 2026-11-25 12:16 UTC · original
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.
@ -290,2 +381,4 @@queue.active += 1;return (p, ActiveGuard);}queue = AVAILABLE.wait(queue).unwrap_or_else(|e| e.into_inner());@Flyander on GitHub · 2026-11-25 20:19 UTC · original
If 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.