Multi-second freezes: title thread between submissions with the GPU idle, host memory grows to ~23 GB (RTX 5070 Ti Laptop, v1.1.2+#185) #330
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#330
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?
@mwjdgfwhhc-spec on GitHub · 2026-12-05 23:15 UTC · original
Multi-second freezes during play: title thread between submissions with the GPU idle, host private memory grows to ~23 GB
Summary
On this machine the game freezes for 0.5–27 s during normal play. During a freeze the layer reports the title's submitting thread between submissions for the whole stall, GPU utilisation 0 %, no pipeline being made, no layer threads waiting, and the guards/journal locks free. Host private memory climbs from ~15 GB to ~23 GB over ~20 minutes on a 31 GB machine, and the pagefile peak reaches ~11 GB. When a stall passes ~30 s, the title's own watchdog fires and the process dies with an access violation write to 0x0 at
larp-image+0x23cf683(backtrace through+0x2215c35, the 30 s watchdog).This looks like host paging / memory growth, matching the maintainer's comment on #120 ("host paging under memory pressure"), but it is not fixed by
--card-budgetalone. Reducing host memory and freeing system RAM did largely remove the multi-second stalls in a short session (see "What helped").System
Build and configuration
1ccd55e) plus PR #185 (deb2a0d), built from source.Host::new(pick the DXGI adapter with the largestDedicatedVideoMemory). StockD3D12CreateDevice(None)selected the Intel iGPU here (wave lanes min=8 max=32), which refused thousands of PSOs (barycentrics/typed-64 atomics unsupported) and removed the device; with the patch the device is the RTX (min=32 max=32, 0 mesh refusals). This patch is separate from the freeze issue and can be reported separately if wanted.--stream-budget 2500 --card-budget 10240,LARP_RT_POSITIONS_MB=512,LARP_PIPELINE_WAIT_MS=8,LARP_PRELOAD_THREADS=max, texture detail one level down, noLARP_RT_WHOLE.Symptom in the log
Stall report (20 s):
At the same time
nvidia-smishows GPU 0 %, VRAM under the 10,240 MB budget. The layer's own accounting for the stall windows iscopies 0.0 ms / 0.2–0.3 MB,0.0 ms on the GPU,2–13 ms preparing,0 being made,0 indirect.The crash when a stall exceeds 30 s:
+0x2215c35is the title's 30 s hang watchdog (as documented under+0x2215c35indocs/troubleshooting-and-crashes.md); the handler writes to a null pointer. This matches the report just added to #59 (list end-marker0xFFFFused as an index when the title's memory pool is ~95 % full), and the diagnostic switches in PR #140 (LARP_TITLE_WATCHDOG=0,LARP_STACKS_AT_KILL=1).Measurements
All fps/frame numbers from
times between presentslines; memory from a 2–5 s system sampler.Before any mitigations (v1.1.2, no card budget, Firefox open)
Peak VRAM 10,767 / 12,227 MiB, process private 23.2 GB, free physical RAM 1.6–2.1 GB, pagefile peak 11 GB. Private memory grew 15.3 → 23.6 GB during a 20-minute session.
--card-budget 10240aloneVRAM fell to a peak of 9,656 MiB (under budget) with no VRAM-exhaustion signature, but the freezes were not reduced (18 windows >300 ms / 21.9 min; 2 frames >10 s, largest 27.4 s). Host private memory still rose to ~23.6 GB.
After host-memory reductions and freeing system RAM (v1.1.2 + #185)
Changes: texture detail one level down,
LARP_RT_POSITIONS_MB=512(it is host memory; default 512), noLARP_RT_WHOLE, Firefox closed (~10 GB freed), same card/stream budgets.Version comparison (same machine/save)
v1.1.1 removed 11,210 lazily-compiled quad-mask variants from startup (413 now; 81,296 blobs loaded from cache), which removed the pipeline-compile stalls; the remaining stalls are not pipeline creation.
What was ruled out for the remaining stalls
0 being made, nopipeline/shader_replacerecords inside the stalls;LARP_PIPELINE_WAIT_MS=8already active.0.0 ms on the GPUduring the largest stalls.--card-budget 10240VRAM never exceeded 9,656 MiB, and the freezes did not change.What helped
Open item: a fixed 32 GB pagefile on the NVMe is configured and awaits a reboot; the above session still ran with the system-managed file.
Question
+0x2215c35 → +0x23cf683crash exactly the pool-exhaustion/0xFFFF-index path from #59, and isPR #140'sLARP_TITLE_WATCHDOG=0the intended mitigation until a fix?Logs and the 2–5 s system sampler CSV (memory, page faults, disk, GPU) are available and can be attached or zipped with
larp zip-logsif useful.References
0xFFFFindex theory)--card-budget, host paging comment)LARP_TITLE_WATCHDOG=0,LARP_STACKS_AT_KILL)@gamingwithhomie on GitHub · 2026-12-05 23:51 UTC · original
Suspicion to test: you name v1.1.2+#185 - the perf PRs are individually toggleable (see docs/environment-variables.md perf flags, each
=0disables one). If the freezes + 23 GB host growth vanish with the #185 flags off, tell us which one; that isolates it. Also attach zip-logs from a freeze run (per-second memory counters are in play.log).@Proudnoob4 on GitHub · 2026-12-06 00:48 UTC · original
A measured lead on the growth and the late slowdown.
Setup: RTX 4080, i5-13600K, 32 GB, Win10 19045, Series X. Diagnostics build (
--features diagnostics, socopystatprints its debug memory lines). About 18 min of manual play.1. Where the memory is (
copystat"memory map", 00:22 → 00:39):2. A table that only grows, with a hard cap (
larp-gpudescriptor.rs, the same on maina8ad2c1):descriptor.rs:566expects "hundreds of thousands in a session".SHAPES = 1 << (62 - PLACED_ADDRESS_BITS)= 4,194,304. At the measured rate the table is full after about 32 minutes of play.Views::shapereturnsNone(:754). Every view with a new shape then becomes a table entry under the globalVIEWSlock.words_fortakes that lock again for the entry, andshape_numberhas already taken it once for the shape. That is two passes under one lock that every recording thread shares.3. The timing it would explain. On a release build of the same tree, CPU "preparing" per 1,000 draws rose steadily over a 38-min session: 1.02 ms at 0-5 min, 1.24 at 20, 1.66 at 30, 1.95 ms at 35. Median fps went from 34.5 to 21.7. That is the "fine for the first half, then stutter" several of us report.
What would settle it: which of the 28 shape words vary between the millions of shapes. A
Shapeis the 14-word resource description plus the view's descriptor without its address words (shape_of,:700). If a per-view value (an element count, an offset, a size) differs for most views, almost every view gets its own shape. Then a wider shape field, or a shape without that word, would keep the table from filling.We'll sample the shapes and post which words differ, then test a fix on a 38-min route replay. If someone already knows why the title produces so many distinct buffer-view shapes, that would save a step.
@mwjdgfwhhc-spec on GitHub · 2026-12-06 01:24 UTC · original
Ran the toggle test you asked for, plus a diagnostics build with the memory census on. Short version: the growth is not from the #185/#306 perf flags, and it is not in the pools the census tracks by name — it is in write-combined host allocations in the 32/64/128 MB size class.
Isolation (all four
=0, log confirmson=false):LARP_OPT_LIST_REUSE,LARP_OPT_COPY_BATCH,LARP_OPT_RELEASE_HELD,LARP_OPT_VIEW_MIRRORoff, 23 min of play → private 8.4 → 23.7 GB, free RAM 10.9 → 3.1 GB, pagefile 2.7 GB of 44 GB, VRAM 0.9 → 9.7 GB. Frames: 12 over 1 s, 4 over 5 s, worst 7.88 s. The growth also reproduces on stock v1.1.6, which has those PRs merged (11.8 → 20.3 GB, worst frame 29.97 s). So the flags are not it.Census (
--profile diag --features diagnostics,LARP_LOG=info,larp_gpu::copystat=debug, 18 min): private 7.6 → 22.35 GB, free 12.3 → 4.4 GB.The write-combined growth is the same size class as the placed-texture heaps ("host textures cut from D3D12 Memory Allocator's heaps of 64 MB"), and nothing brought it back down.
Full tables and the raw first/last census and memory-map lines: https://gist.github.com/mwjdgfwhhc-spec/40b9c23b20aa97644bd63117bfdc3a83
Three questions:
--stream-budget 2500(below the title's 3977) the intended mitigation? The only session on this machine that did not grow was at 2500: v1.1.2+#185, 11 min, 7.8–8.6 GB private, 0 frames over 1 s (worst 416 ms). Every run at or above the title's own budget grew to 20–23 GB and froze. Correlation, not proof.LARP_TITLE_WATCHDOG=0was set ("watchdog is told to quit"), yet the run that ended in a GPU device removal (0x887A0005, 32 lists in flight) still recorded0xc0000005write0x0at+0x23cf683via+0x2215c35. Does the switch only cover the heartbeat path, not the device-removed path?larp-logs-1796520174.zip(4.4 MB, full tracing + census) is ready. GitHub's API cannot attach binaries fromgh, so say the word and it can be attached through the web UI, or grab anything you need from the gist.Machine, for the record: RTX 5070 Ti Laptop 12,227 MiB (driver 621.47), Core Ultra 9 275HX, 31.4 GB, Win 11 26200; v1.1.6 + PR #408 (
132ab794, on maind2a79ddincluding #140), Series S 1080p, DLSS perf, FG 2x,--card-budget 10240, RT pool 512 MB,--stream-budget 4500(the log notes this is not below the title's own 3977).@vanya890 on GitHub · 2026-12-06 01:40 UTC · original
I checked the current
mainimplementation (459db13) rather than relying on the older line numbers. The 4,194,304-shape cap is real, but there is an important distinction in the lookup path:SHAPE_NUMBERScache, then in the lock-freeSHAPE_INDEX(which has2 * SHAPESslots).VIEWSmutex is reached only when a shape is new and absent from that index.SHAPESreaches its cap,Views::shapereturnsNone;words_forthen falls back toVIEWS.entry(view). So the proposed lock-contention effect is plausible for new/unrepresentable placed views after the cap, but it does not put every existing shape lookup under the mutex. The 4.19M cap is also not the same as the 8.39M-slot index becoming full.There is already a direct diagnostic for this: diagnostics builds report
placed views' shapes numbered per framesplit into thread-local, indexed, and locked lookups (descriptor::shapes_line).views_kept()also reports the current shape count. A capture showing those counters as the count approaches 4.19M, alongside the write-combined allocation census, would tell us whether the lock fallback actually spikes at the same time as the freezes. Until that is measured, I would keep the shape-cap theory separate from the observed write-combined growth rather than treating either as the established root cause.@ItsTobix on GitHub · 2026-12-06 02:06 UTC · original · edited 2026-12-06 02:08 UTC
Same growth here on AMD, on stock v1.1.6-amd (
bin\larp.exeSHA-256F14B3B357F84E8670B5CB43C6A49C3EA9B8C59F17BCAB3C68427CB69B028AE11), so it's not NVIDIA- or laptop-specific.Setup: RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 5 9600X, 32 GB RAM (31 GB usable), game on a SATA SSD, Windows 11.
series-x, 3840x2160, frame rate 40, stream budget default, wave 64,LARP_BYTE_VIEWS=0,LARP_LEAVE_OUT=4cc64e0e379e2541(workaround for #151).Logged once a minute (
PrivateMemorySize64/WorkingSet64, free RAM,\Memory\Pages Input/sec):Possibly useful: the growth started exactly with this line (minute 12, logged only once in the run):
Before it, memory was flat for 11 minutes. After it, it grew ~0.5–1 GB/min. I don't know if a held list also keeps the write-combined copies alive, but the timing matches.
@Proudnoob4 on GitHub · 2026-12-06 02:15 UTC · original
Thanks, that's a fair correction. Here's what our run's
shapes_linegives, and one point in the code path.Before the cap (
placed views' shapes numbered per frame, 18 min of the same run):So existing shapes are lock-free, as you say. At this rate, 100+ new shapes still go through the lock every frame (~130k/min).
After the cap, reuse goes under the lock too. In
shape_number, aNonefromViews::shapereturns before anything is stored inSHAPE_NUMBERS, and nothing is written toSHAPE_INDEX. So a view whose shape could not be numbered is never found lock-free afterwards. Every later use of it, every frame, does all of this:VIEWSinViews::shape(returnsNoneagain);VIEWSagain inwords_for→entry.The number of such views in use only grows after the cap, so the cost would climb, not stay flat. That's still a reading of the code, not a measurement.
Next run: a diagnostics build that adds three things to
shapes_line:SHAPES;We'll play past the cap on it and post the counters next to the freezes and the write-combined census, as you suggested. The per-word counts should show what makes this title's views distinct: whether a size or count word takes thousands of values.
@Proudnoob4 on GitHub · 2026-12-06 03:16 UTC · original
Follow-up with the counters @vanya890 asked for: one 40-min manual session on a diagnostics build (same machine: RTX 4080, i5-13600K, 32 GB, Win10, Series X). The build adds three counters to
shapes_line: refused lookups, the shape count, and distinct values per shape word. Two-minute bins, busy windows only (>=3000 draws):What this changes from my first comment:
The cap is not the cliff. The shape table filled at 03:04, but fps had already fallen before that, and there was no step at the moment it filled. Preparing time per 1k draws stayed at 3.2–6.6 ms (median of each bin) the whole session, so most of the fps loss follows the draw count. The diagnostics logging also inflates the per-draw cost: it writes 1.6 M XMA debug lines in this run alone. So I can't claim a per-draw slowdown from this run.
After the cap, refused views go into the view table, and that grows too. "Of the view table's entries … views of placed memory" went 0 → 3.25 M in 8 minutes. That is a second unbounded structure, reached only after the cap.
Memory pressure is the clearer signal. larp's private bytes grew 22.7 → 31.9 GB. The working set stayed at ~15–16 GB and free RAM at 0.5–4 GB. The resident part of file mappings fell 11.4 → 5.1 GB as Windows evicted them. Hard faults reached 7–10k/s in the last 6 minutes, and the slow XMA passes peak in the same bins (268, 178, 226 per 2 min). That supports your paging explanation for the late audio.
What grew after the world loaded (02:38 → 03:12), from the
copystatmemory map:The process heap's growth tracks the shapes and the later view-table entries, at roughly 260–270 bytes each. That is an inference from the timing, not a measurement.
Which shape words vary: 7 of the 29 take 4096+ distinct values (the counter stops counting at 4096): w2, w5 and w14 of the resource words, and view words 3, 4, 6 and 9 (w18, w19, w21, w24). The other words take at most 75 values. Those seven are what make nearly every view a new shape.
Next on our side: find what those seven words hold, and test a bounded shapes/view table on a release build, judged by RAM and hard faults over a 40-min session.