Memory: bound queued host work and reclaim idle staging before world-load allocations fail #2629
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?
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-26T04:07:24Z.
Triage request:
goal:world-load(#1833). Let a loader that can finish serially spend longer loading rather than allocate several jobs’ peak scratch space at once. Please start with one measured XCL-owned buffer path, not a replacement allocator or a change to the console memory profile.Why not just set a process cap? In #1566, a 13,824 MB process cap refused required texture pages during startup; the title died twice at 11.7 s. On our 16 GiB Linux / Wine 11.0 / RTX 4060 Laptop GPU (8 GiB), #1831’s isolated enforcement test assigned a 64 MiB job limit but a 128 MiB commit still succeeded. Neither refusal nor unenforced limits provide backpressure. Separately, a contributor on #542 reported nearly identical ~40 GB commit peaks with 4 vs 15 compiler workers, but ~28 GB with three upload/detile changes together. That makes transient copies worth measuring, not proof they dominate on every 16 GiB host.
Proposed first slice
XCL_ACTIVITYtick, expose capacity held by upload/detile staging: reserved but not allocated, active (including fence-pinned), and idle/reusable, with high-water marks. Count backing allocations once, including capacity retained in pools, not views or just payload length. Compare these with process commit, resident memory and local/non-local GPU memory as distinct series. If staging is small at the load peak, publish that result and pick the measured owner instead.XCL_HOST_STAGING_BUDGET_MIB(unset/0: unchanged; positive MiB converted once to bytes). For participating owners, reserved + active + idle must not exceed the configured bytes. Reserve the job’s peak simultaneous input/output/scratch before materializing it. Reuse an idle allocation or drop reconstructible idle backing before asking for more. Hold the charge through completion, including GPU fences and aliases. Never discard dirty guest data or memory still in use. Releasing a buffer means it is reusable or freed, not a claim that OS RSS immediately fell.Fit with existing work. Keep
title_memory_mbguest-visible; #1566/#1831 address whole-process commit, #640/#1773 GPU pages and residency. DirectStorage already hasXCL_DSTORAGE_MEMORY_BUDGET_MIBand ordered retirement: reuse that policy if integrating it later, with both limits checked in one admission decision, not two blocking reservations. Compiler parallelism (#542/#2624) can be tuned independently; opaque DXC/driver allocations are not enforceable staging bytes. This is not a maximum on RSS, title CRT allocations, worker processes or driver memory. If required live data alone exceeds physical RAM, a longer wait is not a fix.What would demonstrate it works?
Maintainer decision requested: does an activity-counter patch for upload/detile staging followed by an opt-in admission patch for the measured owner fit the world-load roadmap?
AI assistance: OpenAI Codex reviewed existing reports and drafted this proposal. The linked Wine cap result is a local fixture; the other XCL load measurements are attributed above. No retail data attached.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-26T04:16:56Z.
Human being here: basically it seems like
xcljust allocates memory when the executable asks for it. Instead we should be able to set some limit of how much memoryxclis allowed to use. Requests beyond this point go into a queue, and are realloc'ed when data in memory is no longer needed. I'm not exactly sure what is being loaded during the game's startup, but I am expecting that some of that data is transient, and does not need to live in memory the whole time.Without
xclenforcing memory limits, the game will always OOM on smaller machines. I am with family for Thanksgiving and running on my gaming laptop with 16GB and this is a hard blocker for running on this machine.Let me know what you think.
Imported from ivall/xcl. Originally posted by razormontana on 2026-11-26T20:12:35Z.
I’d like to take the CPU detiling measurement in #2639, in coordination with the committed-memory work in #2688. On
8b957bec, the owned read fallback allocates a full-size slice or volume buffer, copies only readable committed spans and leaves the gaps zeroed. Detiled output stays alive through the upload fence wait, and an oversized first texture can exceed the 32 MiB guest-byte batch limit. Batch lifetime · CPU backingI’ll report live owned backing bytes for detile output and the source buffers allocated inside
subresources, plus their combined peak, underXCL_ACTIVITY. Borrowed views count as zero. This complements #2862’s GPU staging counters and checks for short-lived peaks within the aggregate Rust heap already sampled for workstream 6. I’ll verify capacities and lifetimes in synthetic serial and parallel cases, including partially committed and oversized inputs, then compare with commit and DXGI usage in a guarded world-load run. The first PR would add measurements only. Earlier Rust heap measurementsAI use
Codex GPT-6.2 traced the allocation path, checked related work and drafted this claim.
Imported from ivall/xcl. Originally posted by kotekompotek on 2026-12-02T16:26:15Z.
Field measurements from a sister translation layer (D3D12-based, copy-architecture shadow memory) fighting the same world-load memory wall on genuinely weak hardware (8 GiB RAM / 2 GiB VRAM), in case the signals transfer:
1. Commit-charge backpressure misfires exactly on weak machines. We triggered reclamation off
CommitTotal/CommitLimitwatermarks first. On the machine that needs it most this never fires: weak machines carry oversized page files because their RAM is small (8 GiB RAM + 28 GiB page file here → ~36 GiB commit limit), so the workload pages itself to a standstill at 28 % of the limit while the watermark sits silent. What actually predicts thrash is physical pressure —GlobalMemoryStatusExullAvailPhysagainstullTotalPhyswith the same high/low hysteresis shape (0.85/0.80 worked as a starting point). After switching the trigger, system commit went from a runaway 10.2 GiB (0.1 fps, 23 s/frame) to a flat 5.0 GiB plateau with stable frame times in the same workload. The process-cap failures you cite rhyme with this: caps measured against the wrong quantity either refuse legitimately-required pages or never engage.2. The churn metric that tells you whether reclamation is helping. Track what fraction of reclaimed resources are re-created "soon" after reclaim. In our menu/loading phase the ratio was ~100 % — everything reclaimed was needed again immediately, so reclamation was pure bandwidth cost with zero sustained savings. If your idle-staging reclaim shows a similar ratio during world-load, the working set genuinely exceeds capacity and the lever has to be reducing what gets staged (serializing loaders, as the triage comment proposes) rather than faster reclaim. The ratio is cheap to instrument and separates "reclaim works" from "reclaim churns" in one number.
3. Idle-grace ordering matters. Resources need an idle timeout before they're reclaim-eligible, but the pressure path will dig past it into recently-used ones when the over-amount is large — which under never-relieving pressure is every frame. Ordering strictly LRU and protecting only fence-pinned work made the difference between stable-churn and death-spiral for us.
Notes with implementation detail: xbox-weak-hw-notes (EVICTION-PHYSICAL-PRESSURE.md and neighbors). Happy to share raw measurements if useful.
Imported from ivall/xcl. Originally posted by kotekompotek on 2026-12-02T18:21:42Z.
@razormontana Coordination welcome. One measurement trap worth knowing before you instrument the fallback path: on machines where the pagefile inflates the commit limit (our 8 GB test host shows a ~36 GB limit), any watermark keyed to commit charge will never fire while physical RAM thrashes. If your detiling measurements include memory-pressure behavior, capture both
GlobalMemoryStatusExphysical availability and commit charge — the divergence between them is itself a useful metric. Our eviction data: pressure watermarks keyed to physical memory cut commit from 10.5 GB runaway to a flat 5 GB in menus, at the cost of high remake churn (83/86 remade soon) when the idle-grace window is too short for the working set. Happy to test your branch on the 8 GB host when you have one — a weak-memory machine is exactly the environment where fallback allocation behavior is decisive.Imported from ivall/xcl. Originally posted by kotekompotek on 2026-12-02T21:31:17Z.
Follow-up measurements from the weak-host trench (8 GiB RAM / 2 GiB VRAM, D3D12 translation layer), now with a full device-death cascade captured twice:
Driver memory is a third domain, invisible to both watermarks under discussion. At the moment of death the process showed working set 1.5 GiB and commit 7.5 GiB of 40 — healthy by physical and commit accounting. Yet the driver was out of memory: pipeline creation failing
E_OUTOFMEMORY, then root-signature creation failing, thenDXGI_ERROR_DEVICE_RESET. The only user-mode-visible signal was DXGIQueryVideoMemoryInfo(in useclimbing to 91% ofbudget). Any reclamation design that wants to survive small-VRAM hosts needs that DXGI ratio as a third input — it's cheap (one call/sec) and it's the only counter that leads the failure instead of lagging it.Eviction lost the race even when it fired correctly. The layer evicts texture copies under budget pressure and we watched it sweep in the final minutes — but stream-in demand outran it because there was no admission control: new textures and pipeline compiles (4-5 s each, driver-side) kept being admitted right up to the wall. Watermark-triggered admission throttling on the producer side may matter as much as reclamation speed on the consumer side.
Full writeup with log excerpts: github.com/kotekompotek/xbox-weak-hw-notes (HYDRA-DEATH-CASCADE.md, BAR-INVERSION-FINDING.md — the second one is about a placement heuristic that backfires when the card is smaller than shared memory, possibly relevant if xcl ever places resources by memory-domain size assumptions).