fix(gpu): cap default pipeline workers by RAM (#520) #528
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/gamingwithhomie--larp!528
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-528"
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?
@Skid-ster on GitHub · 2026-12-06 01:54 UTC · original
Skid-ster:fix/ram-aware-pipeline-workers→main· +42 −1 · 2 files · 1 commits · openSummary
Cap the default host pipeline worker count by total RAM, so first-run pipeline compilation on 16/32 GiB PCs no longer starts a dozen in-process DXIL compiles at once and runs the machine out of memory.
Problem
worker_count()defaults to 3/4 of logical CPUs (2..24) with no regard for RAM. Each worker runs a host compile on its own thread, so on a 16-thread PC 12 compiles are in flight at once. Issue #520 reports exactly the failure this leads to: RAM climbs throughout the initial pipeline compilation until, at 60,622/60,623 pipelines, Windows becomes unresponsive and the whole PC crashes (32 GiB system).Related finding: the release package's
bin\launch.ps1(packaging-only, not in this repo) deletes everyenv:LARP_*variable before startinglarp.exe, so loweringLARP_PRELOAD_THREADSin a shell has no effect when launching viaseries-s.cmd— which likely explains why the #520 reporter's attempts to lower it did not help. This PR fixes the binary-side default so safety no longer depends on the variable reaching the process; the packaging script should ideally preserve allow-listed tuning variables too (filed here as context, not changed here).Change
crates/larp-gpu/src/host.rs: addtotal_physical_ram()next to the existingavailable_physical_ram(), using the sameGlobalMemoryStatusExpattern (ullTotalPhys).crates/larp-gpu/src/pipeline/make.rs: add a pureworkers_for_ram()helper and apply it inworker_count()only whenLARP_PRELOAD_THREADS/LARP_PRELOAD_CPUis unset:low/medium/high/max/numeric) are completely unchanged.workers_for_ram_caps_small_memory_pcscovering the 8/16/32/64 GiB boundaries, the unknown-RAM case, and a below-cap count.Testing
rust-toolchain.toml). Please run:cargo test -p larp-gpu pipeline::makecargo build --release -p larpGlobalMemoryStatusExcode inhost.rsverbatim, but that is not a substitute for compiling it.@Skid-ster on GitHub · 2026-12-06 02:41 UTC · original
Overnight build/test results for commit
76069e5ee6:cargo test -p larp-gpu pipeline::make— 2 passed, 0 failed (parse_wait_budget_handles_opt_in_values,workers_for_ram_caps_small_memory_pcs); 37 filtered out.cargo build --release -p larp— succeeded in 16m56s (rustc/cargo 1.98.1 as pinned byrust-toolchain.toml,CARGO_BUILD_JOBS=4). Warnings only, all pre-existing and in untouched files: unused import / dead code incrates/larp-hle/src/modules/gameinput/playstation.rs, and dead code inapps/larp/src/host_name.rsandapps/larp/src/mods.rs.larp.exeinto a local CNF package copy;larp.exe nv-profileruns and reports the 1024 MiB shader-heap profile.Marking ready for review.
@dekulruno on GitHub · 2026-12-06 02:59 UTC · original
I have this same failure on 64gb memory so it seems to affect above 32gb also.
@christopear on GitHub · 2026-12-06 03:06 UTC · original
One packaging interaction for the Linux release. With the current wrapper, the proposed RAM cap is bypassed even when the user has set no override.
I compared the v1.1.6 FULL package's run.sh with linux-test at 0436029. They match. The script computes a CPU default, clamps it to 4–18, and exports it as LARP_PRELOAD_THREADS. The Rust selector then sees an explicit value.
I ran the launcher's
--print-envpath with nproc reporting 16 and passed its selected value to the worker selection code from76069e5e. I fixed the CPU and RAM probes at 16 logical CPUs and 16 GiB for this test.For packaging, leaving the worker variable unset unless configured would let the binary apply the RAM cap and honor the older alias. That would also change the wrapper's existing 4–18 limits, so worth deciding explicitly. The print-env output could say “automatic” when unset.
Separately, an empty or unrecognized value passed directly to the binary also returned 12. It falls back to the default formula but skips the cap because the variable exists. Applying the cap whenever parsing falls back to automatic selection would cover that case without changing valid overrides.
This measures selection only. It doesn't establish the cause of any particular OOM, especially on machines above the proposed thresholds.
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.