Skip to content

GPU: prevent pipeline starvation under constrained host commit - #3426

Open
dexifried wants to merge 1 commit into
trustno1-coder:mainfrom
dexifried:fix/32gib-pipeline-memory-admission
Open

dexifried wants to merge 1 commit into
trustno1-coder:mainfrom
dexifried:fix/32gib-pipeline-memory-admission

Conversation

@dexifried

Copy link
Copy Markdown

What it changes

On a 32 GiB host with an 8 GiB NVIDIA card, title loading and concurrent pipeline creation compete for commit. In the tested .04 run, the memory guard deferred new compiles while screen-pass waits and missing pipelines left the world black.

  • Treat guard deferrals and driver E_OUTOFMEMORY as retryable instead of recording a permanent refusal; skip geometry-stage fallback on a memory refusal.
  • Stop waiting on a deferred pipeline, avoid synchronous compute compilation during pressure, and limit waits to 100 ms under pressure.
  • Limit general workers to four on limited-RAM hosts and use smaller spare-buffer/cache defaults.
  • On limited-RAM hosts, use current commit rather than hypothetical pagefile growth and trigger critical reclamation at the compiler's protected commit floor.

This retains the existing memory guard rather than lowering or disabling it.

How it was tested

  • Windows, RTX 3070 Ti 8 GB, i7-12700KF, 32 GiB RAM; Series S, 1440p output, DLSS Performance (540p), frame generation off, THIN off, RT off, 30 FPS cap.
  • Before: unmodified v2026.11.29.04, fresh cache, black screen at a 0.5 FPS log sample; 455 MiB free physical RAM and 418 draws/dispatches waiting for pipeline creation.
  • After: v2026.11.29.04 plus these five-file changes and a populated pipeline library. 2,163/2,163 selected pipelines prepared offline, zero unavailable host pipelines or worker crashes in preparation. Verified visible 3D cutscenes; 97 sampled log intervals with at least 500 draws/frame averaged 20.97 FPS (median 20.4). User confirmed playable rendering with occasional white/clay textures. Session was still responding after 17 minutes.
  • Reproduction: use the existing warm --used path with locally recorded pipeline recipes/early list, matching play shader switches and sampler ordering, VICTORY_WARM_SHARED=1, VICTORY_WARM_LIBRARY_THREADS=4, and --jobs 4, with the game closed. No cache included.
  • Targeted victory-gpu tests on the patched .04 tag: residency (8), memguard (7), compilemem (10): 25 passed. Release build passed. The identical patch applies cleanly to current main; staged asset policy passed. Full crate/workspace suite and runtime testing of the rebased head have not been performed.
  • Limitations: this is a combined patch + offline-preparation comparison, not an isolated A/B of each change. Memory pressure, deferred compiles, texture residency problems and long-term stability remain unresolved. Genuine OOM retries need further stress testing; this is not a universal black-screen fix. No shader translation changes.

Checked for overlap

The intent is to offer a small integrated, hardware-tested alternative and reproducible evidence, not claim these individual ideas are new. Happy for maintainers to take only the non-overlapping parts or use the results to evaluate existing PRs. AI-assisted implementation and validation.

@upipibi

upipibi commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Test report for #3426 (head 609376d), merged onto main 41adb55. Synthetic tests only: no title run, no game files, so this does not show the world loading on a 32 GB PC.

Setup: RTX 3070 8 GB, driver 621.40, 32 GB RAM, Windows 11 (10.0.26100), rustc 1.98.1.

The two new tests and the changed worker_count test: 3 passed, 0 failed, 3/3 runs. They are logic tests and make no device.

Negative controls, one line changed each:

Change Test Result
A: memguard::defer_oom no longer checks for E_OUTOFMEMORY (every failure is put off) allocation_failure_is_retryable_but_invalid_argument_is_not fails at memguard.rs:264: !super::defer_oom(&invalid)
B: residency::admission_commit counts page-file growth on limited hosts too constrained_hosts_do_not_spend_unallocated_pagefile_growth fails at residency.rs:434: left 96636764160, right 2147483648

cargo test -p victory-gpu --lib --locked, three runs of each tree in turn

Tree Run 1 Run 2 Run 3
PR 921 passed, 3 failed 922 passed, 2 failed 923 passed, 1 failed
Main 41adb55 919 passed, 3 failed 920 passed, 2 failed 921 passed, 1 failed

Every failure is one main has too: shader_cache::tests::every_switch_of_the_translator_is_in_the_key in all six runs, and host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue, host::card_steps::tests::places_written_after_sending_are_learned and host::menu::tests::a_change_is_saved_at_once_however_the_game_was_started now and then on both trees. None is in this PR's code.

Overlap: #3474 (head 92fa413) is aimed at the same stall and also changes memguard.rs and pipeline/make.rs. A trial merge of the two heads conflicts in crates/victory-gpu/src/pipeline/make.rs, so whichever goes in second needs a rebase. Both make a pipeline that was refused for memory retryable; this one also has limited hosts count only current commit, where #3474 lets one compile through under the floor.

Not tested: the memory guard in a title, and the worker and cache sizes on a limited-RAM host under load.

Tested with the help of Claude Code (Claude Fable 5.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants