Feature request: opt-in host-RAM budget with loading backpressure and reclaim #3012
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#3012
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@pickles976 on GitHub · 2026-11-26 03:25 UTC · original
Problem
On a 16 GiB Linux/Wine laptop (RTX 4060 Laptop 8 GiB), a guarded Series S title load on VIctory #2972 head
7e769e07e274reached the account picker and loading art but not controllable gameplay. A 130 s scheduled trial stopped at 86.25 s when systemMemAvailablefell to 1,979 MiB, below a 2,048 MiB safety floor; it started at 13,297 MiB available. The Wine scope was using 7,450 MiB (anon 2,787 MiB), GPU usage peaked at 3,113 MiB; the external guard deliberately killed the process (137), so this is not a title crash. An earlier 95 s trial had a different starting available RAM and is not a matched improvement claim.A hard per-scope
MemoryMax=9GandMemorySwapMax=512Mprevent an unbounded host OOM but do not turn required allocations into longer loading: when reclaim fails they deny allocations/kill the scope. XCL has a separate opt-in Windows Job Object commit-cap proposal (#1831 over there) that, in Wine 11.0 on this machine, reports successful job assignment while allowing a 128 MiB committed allocation under a 64 MiB cap. Neither guest-visible console memory budgets nor an OS hard cap implement loading backpressure.Distinct request
Please consider an opt-in, configurable budget for host-owned reclaimable/in-flight RAM (for example
VICTORY_HOST_RAM_BUDGET_MIB, disabled unless set), not a promise of an exact total-process RSS limit. Before admitting staging, shadow snapshots/host copies, DirectStorage intermediate buffers and concurrent decompression/compile work: account live and in-flight bytes; trim idle pools/caches; allow queued work to wait for released capacity and wake on completion. Keep title-required pinned/live allocations intact. If a required request cannot fit (or no release can make progress), return a specific diagnostic/failure rather than wait forever, discard content, or silently claim the process stays under the cap. Do not hold queue/graphics locks while waiting. Track/counter host-owned bytes separately from unaccounted title, Wine and driver memory; report both process/scope and global available memory so the config’s guarantee is explicit. Keep OS guard as the outer safety fuse.This is not a duplicate of #471 (commit-limit crash attribution), #407/#880 (in-place memory design), or #2764 (settings/profile recommendation). Existing PR #2972 trims idle staging/scratch and evicts host textures on DXGI non-local pressure, but its texture eviction is per presented frame and its 64-submission trim need not run during a stalled load; #2981 reuses bounded decompressor scratch; neither implements an app-wide admission budget. #471 notes DirectStorage
intermediate_sizeis not limited. Those mechanisms are natural integration points, not alternative duplicate proposals.Verification criteria
No title assets or unredacted logs attached; local measurements are from the user-owned machine. AI assistance: OpenAI Codex (GPT-6 Sol) reviewed the local test evidence and drafted this request; the user explicitly asked for the issue.
@Marvisak on GitHub · 2026-11-26 03:45 UTC · original · edited 2026-11-26 06:45 UTC
Automated triage for the maintainers.
Labelled as a request. Bounding the host memory VIctory itself holds fits the project's scope (it applies to Windows hosts as much as to the Wine run measured here).
mainhas no host RAM budget setting today. The related open work is theGPU-HOST-MEMORYtask in the #1633 table, PR #2972 (trims idle staging and evicts host textures under pressure) and PR #2981 (bounded decompressor scratch), with #471 for the unbounded DirectStorage intermediate size.New since the last triage: a per-owner measurement on
main63bcca4(RTX 4060 Laptop, Wine, a log-only probe) found the copies of title memory outside buffers (LOOSEincrates/victory-gpu/src/shadow.rs) the largest growing owner, from 256 to 2,012 MiB during loading, while texture staging stayed at 32 MiB. That matches the documented shortcut next toLOOSEinshadow.rs: copies of windows are never freed, and keying them to the title's allocations is left to do. Open PR #2856 (reuse an already-covering window) was measured on top and still reached 2,604 MiB of retained windows before the same memory guard stopped the run, so reuse alone does not bound it; retiring stale windows safely is the open part.Generated by Claude Code
@pickles976 on GitHub · 2026-11-26 04:14 UTC · original · edited 2026-11-26 07:02 UTC
Measurements in response to the triage request: loose shadow windows are the largest growing owner among the CPU-backed pools sampled in this run; idle texture staging/snapshot pools are not. This narrows a first target, not a complete RAM census or a demonstrated reclamation fix.
Provenance and guard
main63bcca43c6+ local log-only probe, no contributor PRs integrated. Windows-MSVC release,--features diagnostics, Rust 1.98.1; fresh compilation from this checkout confirmed. The probe does not change allocation, scheduling, reclamation or inputs; its sampling/logging has overhead.VICTORY_KEYS=20:Enter: picker followed by loading artwork; screenshot at ~70 s still artwork, no controllable world.Owner snapshots from the same load
All figures below MiB, capacities rather than physical residency. Menu sample UTC 04:12:17; late-loading sample 04:13:15 on 2026-11-26, shortly before guard stop.
shadow::LOOSEbacking, sum of keyed window lengthsshadow::BUFFERSregistered copies, size rounded to 64 KiBshadow::ARENAbackingtexture::CHUNKSbackingDirectStorage's existing scheduler meter, with
staged/stagingadded to its 5 s line: 1.33 MiB maximum observed staged, 32 MiB configured staging, zerostaging_waitson the sampled lines. This meter coversstaging_bytes()(buffered file source bytes), not decompressor output/scratch or every intermediate allocation, and periodic samples can miss transient peaks.The last existing texture diagnostic (04:13:16) reported 2,537 decimal MB host textures, 318 MB used by lists. Its texture census split GPU-written bytes as 297 / 1,977 / 0 MB (used by lists / only viewed by heap slots / neither); title-memory textures 20 / 44 / 0 MB. DXGI reported 3,053 MB local and 3,232 MB non-local usage. These are separate accounting views, not additive with the table or scope memory; heap-slot-only does not mean safe to destroy. The logged working set was 8,820 MB, while Wine's process-commit field was 2,790 MB: do not equate either with the Linux scope meter.
Method and limits
A local diagnostics-only thread, started once at host-device creation, samples every 2 s independently of presentation. It uses separate
try_lockcalls, skipping unavailable owners rather than blocking or nesting owner locks. It sumsPOOLVec capacities, registered shadow lengths,LOOSEkey lengths, arena bufferGetDesc().Widthand free runs, staging chunk count × CHUNK, and standalone staging sizes. ExistingHEAP_BYTESand list-upload counters are also logged. No title data is read by this probe.37 periodic samples; 35 successful loose-map samples, with the last loose sample at 04:13:15 (later lock contention is missing data, not zero). The registry census excludes unregistered copies still held by lists. Active snapshot capacity, decompressor scratch, compiler caches by owner, guest backing and Wine/driver allocation attribution remain unmeasured. An additional external file/shmem breakdown sampler produced no rows; only the working guard's scope-total/anon columns are claimed. This is neither a complete process ledger nor proof that 2,012 MiB is immediately reclaimable.
Suggested first owner work
On this main revision,
shadow.rsdescribesLOOSEas copies of windows that are never freed and suggests keying them to title allocations. The measured rise here is 1,756 MiB between the two snapshots, whereas texture staging stays at 32 MiB. Please prioritize checking loose-window overlap/reuse and tying cached window ownership to guest allocation generations/lifetimes; retirement must preserve views, pending GPU writes and command-list/fence references. A cap that waits without a path to retire those strong references would just turn memory pressure into a stuck load. Do not simply evict all windows or enable unsafe in-place memory on this discrete GPU.A focused regression should stream/reuse/release guest ranges while a list retains an older generation, verify its data through completion, then show backing stops growing after safe retirement. Repeat these same counters for the guarded title comparison; distinguish a reduced shadow peak from actually reaching gameplay.
Local evidence:
main-63bcca4-memory-probe-build.log,20261126T041203Z-console.log,20261126T041203Z-resources.csv; startup control20261126T041119Z-*. Logs/screenshots remain local; no title assets attached. AI assistance: OpenAI Codex instrumented, ran and summarized the measurements on the user's machine.Physical-accounting follow-through: mixed in-place stack (2026-11-26)
This is not another main-only measurement:
3ed7d725f6895fe1a235eb6fa8ff2485261ca151(#2945 stack) plus #211229decb3719142296cad124453a3b8651068f22f6GPU-write notification logic and local read-only ownership probes. Exact pin/alias tests and mixed-stack provenance are in #2945. Fixed256KiB loose windows, default1MiB in-place floor, explicitVICTORY_IN_PLACE=1.Extended the local guard's cgroup sampler with
memory.stat file/shmem/kernel, retaining all old columns and safety cutoffs. A real16MiB private +32MiB shared touched-mapping CLI check produced21.0MiB anon/32.1MiB file including32.0MiB shmem/0.3MiB kernel. Shmem is a subset of file, not another additive bucket.Fresh29.45s diagnostics release; account input20s; actual84s screenshot still loading artwork. Run stopped at100s wall limit, exit137, not the RAM threshold. Minimum available RAM2265.7MiB, GPU peak3369MiB, scope peak7684.1MiB, available disk minimum19.762GiB. No gameplay/FPS claim. Three compute PSOs still refused0x80070057.
The largest measured category late in loading is shared-memory-backed file pages, not anonymous memory alone. This is cgroup accounting, not attribution to a particular allocator, guest/Wine/driver owner, or proof of reclaimability. Samples are not atomic and totals need not exactly reconcile. Logical shadow spans cannot be subtracted from these figures as unique physical allocations. Next useful attribution is scope-process mappings/backing objects, rather than assuming all4.2GiB shmem belongs to loose copies.
Artifacts
.compat-runtime/logs/20261126T064510Z-{console.log,resources.csv,guard-events.jsonl}andmenu-20261126T064634382643Z.png. Same Wine11.0 / NVIDIA590.48.1 / RTX4060 Laptop8GiB /16GiB RAM and diagnostic relaxed vkd3d-proton3.2.02576c0b4adfae4a+(assertions disabled; allocator/list vtable identity checks removed, null checks retained), not stock-runtime certification. Unchanged GPU6000MiB / available-RAM2048MiB / available-disk10GiB guards,9GiB cgroup/512MiB swap caps. No code PR/push.Backing-object attribution follow-through (2026-11-26)
Same verified mixed-stack diagnostics executable as above, no title-code change/source switch, now with read-only external scope-process snapshots at20/80s. The helper groups
smapsby pathname/permissions, records proportional PSS, and deduplicates regular backing objects by device/inode across all file descriptors. Real fixture proof: two resident aliases of one32MiB memfd give64MiB RSS but32MiB PSS; four handles identify one32MiB backing object. It never suspends or writes target processes.Both title snapshots covered13 processes with zero read errors, taking0.152s/0.479s. Raw paths remain local. The large objects are unlinked Wine
tmpmap-*section backings; this launcher's/tmpis a private tmpfs, not disk storage. The largest object's handles are held by wineserver and the title-host process. File size stayed3977MiB while allocated blocks grew722.56→3533.61MiB.At80s the host process also had1928.34MiB PSS in
/dev/nvidiactlmappings and2561.30MiB in anonymousrw-pmappings. The largest Wine section had17529 mapped segments acrossrw-s/r--s, with overlapping views; its mapped PSS was1484.20MiB, not its3533.61MiB allocated backing. This is why summed RSS or mapped PSS alone cannot be used as a census of the backing object's charge. Non-atomic accounting and allocated-block metadata are not, by themselves, a guarantee of residency or reclaimability.Source mechanism: this tree's production
XMemAllocatePhysicalPagescreates a pagefile-backed section (xmem.rs:494, SEC_COMMIT on Wine);mapinstalls its slices throughMapViewOfFile3(:814). That is consistent with these section backings. The exact FD→XMem allocation association has not been traced, and I am not claiming that every committed guest page is disposable host cache. Do not delete Wine temporary paths or indiscriminately reclaim these pages; they are already unlinked and may be live/pinned/aliased.The100s run ended on the wall guard/137. Verified80s loading artwork, no world/gameplay. Minimum available RAM2297.1MiB, GPU peak3369MiB, scope peak8349.2MiB, available disk minimum19.680GiB; same three compute PSO refusals remain. Logs
.compat-runtime/logs/20261126T065607Z-*, notablymaps-20s.json/maps-80s.json; screenshotmenu-20261126T065728250015Z.png. Same diagnostic-relaxed-vkd3d caveat and unchanged resource limits as above. This is new ownership evidence, not a successful load or a memory-saving claim.@pickles976 on GitHub · 2026-11-26 04:17 UTC · original
Existing candidate for the measured loose-window owner: #2856 reuses an already-covering window. Its isolated lookup fixture passed on this RTX 4060 Laptop/Wine host with local test-only changes requiring all three allocations/lookups to succeed: #2856 . This verifies covering-window identity and the noncovered case, not shader execution or reduced retail RAM. The main owner measurement above did not include #2856; keep this distinct from reclamation/admission, since retained windows are still not freed. AI-assisted verification (OpenAI Codex).
@pickles976 on GitHub · 2026-11-26 04:21 UTC · original
Measured follow-up: main + #2856 covering-window reuse still hits the unchanged free-RAM guard before gameplay on this RTX 4060 Laptop / 16 GiB Wine host. 7,707 covering hits, but retained loose backing reached 2,604 MiB; stop at 90.14 s / 1,960.5 MiB MemAvailable. At ~72 s, loose backing was 1,940 MiB vs baseline 2,012 MiB. Cache/background conditions differ, so later termination is not a proven speed/memory benefit. Full provenance and comparison: #2856 . This strengthens the need to distinguish required/live shadows from stale retained windows before specifying reclamation/admission policy; reuse alone did not satisfy the loading gate. AI-assisted local verification (OpenAI Codex).