BUG:victory-gpu: Placed-view shape cap (2^22) causes unbounded VIEWS leak & multi-second write-lock freezes (Root cause, verified fix on my fork + Agent prompt) #333
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 PastiiJay/klbf-lab. Originally posted by 3sssm0keee on 2026-11-30T06:55:31Z.
Context & Note to the Team
Hi team,
I've been debugging and tuning a local fork/branch based on VIctory on my own Windows setup (AMD RX 9070 XT 16 GB, 32 GB RAM). During extended gameplay sessions (30–55 minutes), I ran into two severe issues that turned out to share a single root cause in
victory-gpu/src/descriptor.rs:1.5 s→3.7 s→9.3 s), each coinciding with a sudden multi-GiB private commit jump (+1 GiB/+2 GiB/+4.25 GiB) and a sharp drop in working set, followed by heavy late-session FPS degradation.Because the relevant code in
descriptor.rsappears to be shared across VIctory-based branches, I've already implemented and long-run verified a fix in my local environment. I'm sharing the full breakdown, before/after telemetry, and a self-contained prompt at the bottom that you can hand directly to a coding agent to audit your branch and adapt the fix—hope this helps!What Was Happening (Root Cause)
Profiling
VIEWSread/write lock contention and table growth across a 54m 10s run closed the loop:The placed-view
shapestable saturates early (2^22= 4,194,304 cap)R0–R13, including alignment/trailing padding wordsR1andR13), and all 14 non-address view words (D0–D9,D12–D15).shapeshit its 4,194,304 ceiling at 08:28 (when the generalVIEWStable only had 22,860 entries).Saturation triggers an unreclaimed per-address leak into
views.listshapesis full, new placed views fall back to inserting full records (~136 B/row + index tree) into the generalVIEWStable (views.list) keyed per address.forget(resource)never reclaims them. By 54:10,views.listhad ballooned to 37,495,611 entries.Contiguous
Vecdoubling under the global write lock causes the multi-second freezesviews.listis backed by a single contiguousVecguarded by the globalVIEWS: RwLock<Views>.VIEWS.write(), blocking every descriptor mirroring/recording thread:VIEWS.write()Hold+4.250 GiBtable cap)How I Fixed It in My Environment
resource_prefix,descriptor,pad_aforR1,pad_bforR13) plus anextended4-tuple fallback, with the low 26 address bits stored inline. Every original bit is preserved without masking.Vecbacking forviews.list, legacyshapes, and the new dictionaries with two-level paged slabs (1,024rows/page,256pages/directory group;136 KiB/page forviews.list). Growth allocates a single small page without ever relocating existing rows underVIEWS.write().Results in My Environment (54m 10s Baseline vs. 50m 05s Patched)
Same hardware, same launch flags, default 4 MiB buffer window:
VIEWSentries (end of run)VIEWSwrite-lock stalls ≥ 50 ms1.50 s,3.73 s,9.13 s)03:30–50:05)20–30 min,6k–8kdraws/frame; n=17 vs 29)20–30 min,6k–8kdraws/frame)Unit tests (
victory-gpu): 471 passed, 0 failed (including 100,000 randomized bit-exact round-trips for the new encoding and paged-storage stability/concurrency tests).Prompt for Coding Agents (Audit & Port to Your Branch)
If your team uses a coding agent (Codex, Claude Code, etc.), you can paste the prompt below directly to have it check whether your branch is affected and implement an adapted version of this fix:
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-30T09:56:47Z.
Thanks for the detailed write-up, the analysis is spot on.
In KLBF Lab this is already handled on two sides:
KLBF_PLACED_NORMAL, on by default; taken from VIctory-LITE f234022, which got it from trustno1-coder/VIctory-NVIDIA 4eead678 / 144aca0f)KLBF_OWNERLESS_VIEWS, since v26.11.10, after VIctory-NVIDIA 89fd9361)With both, the shapes table stays far from the 2^22 cap: the "memory, more:" line in .17 logs shows around 100k shapes kept after 25 minutes, and 0 placed views in the general table.
If you still see the growth with KLBF Lab itself, please paste the "memory, more:" lines from your run log here (just those lines, the full log shows your Windows user name).
Your component-dictionary idea is interesting for cutting memory further, it's noted.
Imported from PastiiJay/klbf-lab. Originally posted by 3sssm0keee on 2026-11-30T10:27:38Z.
Thanks buddy, hope team could get it done for pc players!!!