Reclaim idle snapshot buffers under host memory pressure #2234
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2234
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2234"
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?
@LucaruluDev on GitHub · 2026-11-29 10:52 UTC · original
LucaruluDev:fix/memory-reduction→main· +137 −19 · 2 files · 3 commits · closed without mergingRefs #1620.
What it changes
The snapshot buffer pool in
shadow.rscan retainhundreds of MiB after allocation spikes, even when
smaller requests cannot reuse those buffers due to
the existing 4x capacity filter.
This change:
How it was tested
Hardware: Ryzen 7 9700X, RTX 5070 12 GB,
32 GiB DDR5, Windows 11.
Synthetic allocation spike followed by smaller requests:
All 80 small requests were served from the pool
after reclamation.
Repeated 174 MiB requests under simulated
ordinary memory pressure:
Tests:
No shader changes.
These measurements represent retained vector
capacity, not process working set or committed
memory. Gameplay FPS and frame times have not
been measured.
Requests returning after the idle grace period
may require a new allocation.
Checked for overlap
Related: #1620, #479, #2015.
Inspired by the demand-aware trimming approach in
Marvisak/VIctory#3230, independently implemented
for the current NVIDIA codebase.
AI-assisted implementation and validation using
Claude Code and OpenAI Codex.
@ArturoWolff on GitHub · 2026-11-29 11:35 UTC · original
Thanks for keeping the capacity and resident-memory claims separate. This is a promising idle-memory optimization for smaller hosts. A source review of exact
ba620fe6a2d9e45d13241ace47ef33ad6a92365efound one missed diagnostics caller:shadow.rs:1990–2045changesPOOLfrom the vector toMutex<SnapshotPool>, whoseidleentries ownbytes: Vec<u8>.#[cfg(feature = "diagnostics")]memory()census at 5082–5085 still callspool.len()andpool.iter().map(|v| v.capacity()).SnapshotPooldoes not provide those methods. Accessingpool.idle.len()and summingpool.idle.iter().map(|v| v.bytes.capacity() as u64)would preserve the existing count/capacity telemetry.The default shadow tests do not compile that diagnostics-only path. The exact-head CI job stopped in default Clippy before the all-features gate; I have not established the cause of that earlier failure or run the donor locally.
Our ordinary RTX 4060 / 16 GiB GE-Proton baseline has substantial physical memory pressure, but neither retained engine log measures idle snapshot capacity (the base census is diagnostics-only). The sampled intervals between its ordinary post-pressure sweep-related memory reports reached 45.2 and 61.2 seconds. These are not observed snapshot ages; they do underline the need to measure actual reuse and reclamation cadence on a slow submission path rather than treating the three-second grace interval as a guaranteed trim/reuse latency. Once the diagnostic caller is fixed, the existing pool-capacity census plus a bounded touched-buffer reuse/drop check would help distinguish a capacity result from real RAM/paging savings. No local performance or graphical-fidelity result for this patch yet.
AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
github-bot referenced this pull request2026-11-29 12:10:51 +00:00
@LucaruluDev on GitHub · 2026-11-29 12:37 UTC · original
Thanks for catching this, @ArturoWolff!
Fixed in
a11530f. The diagnostics census now countsidle entries and sums their buffer capacities.
Both E0599 errors are gone. I also checked the
remaining POOL accesses. The reclamation policy
is unchanged.
The diagnostics and all-features builds still
encounter the same nine compiler errors reproduced
on upstream main. The three focused tests passed.
Following your suggestion, I ran a standalone
Windows probe with touched pages and simulated
memory pressure:
The small buffer was successfully reused, and
the checked-out buffer passed the data checks.
I agree that the three-second grace period is
not a guarantee of reclamation latency. Actual
sweep cadence and gameplay performance remain
unmeasured.
Thanks again for the detailed review!
AI-assisted validation using OpenAI Codex.
a11530fa65toa472d23b1d@LucaruluDev on GitHub · 2026-11-30 08:38 UTC · original
I rebased this PR onto
mainat41adb551. The conflict inhost.rswas resolved by retaining upstream's idle-list reclamation and passing the same memory-pressure flag to the snapshot-pool trim.The published tree matches the one already validated. The
shadowsuite passed 77 tests (5 ignored, 0 failures), andcargo check -p victory-gpupassed in release mode and withdiagnosticsand--all-features.The new CI job failed again during Clippy on the pre-existing unused
unwind_copyfunction invictory-loader/src/crash.rs:804. The file is identical on upstreammain. Clippy treated the warning as an error under-D warnings, so the diagnostics and test steps were skipped.@LucaruluDev on GitHub · 2026-11-30 22:07 UTC · original
Thanks for integrating this contribution into main (
2d3ba6a0)!Also, thanks to @ArturoWolff for the detailed review and suggestions that helped improve the patch and its validation.
Since the functionality is now included in main, this PR can be closed.
Happy to keep contributing to the project!
Pull request closed