victory-gpu: the 5-second long frame: memory line off the presenting thread, process-memory line once a minute #4872
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4872"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by Kenzim on 2026-12-01T12:17:37Z.
Two periodic log lines were holding up a frame every few seconds.
What changes
copystat(diagnostics builds only): the memory line and the "copied from" range lines are written on a thread of their own (victory-memory-line, one at a time; a line still being written when the next is due is skipped and says so).resource::unmapped_holderswalks the textures' table 512 at a time instead of holding its lock for the whole walk, andwalk_texturessleeps 0.5 ms between two holds instead of yielding (the lock is not fair; a yield took it back before a waiter woke).procmem(every build): the "process memory:" line's address-space walk (1.1-1.3 s of VirtualQuery over ~130,000 regions, on its own thread) runs once a minute instead of every 5 s.Why / measurements (RTX 3090, native 2560x1440, DLSS off; street scene, last 62 s of each run, frames longer than twice the median within 0.6 s of a report)
VICTORY_PROCESS_MEMORY=0). Mean frame unchanged (36.4-37.6 ms; the scene is card-bound).Not measured
Restoring the old behaviour
VICTORY_PROCESS_MEMORY_S=5: the process-memory line every 5 s again.VICTORY_PROCESS_MEMORY=0: no process-memory line at all.Related
#2783 and #2877 also address the 5 s VirtualQuery spike (and #4835's
4ba45d36turns the process-memory line off by default). This one keeps the line, once a minute, and also moves the diagnostics memory line off the presenting thread; whichever is preferred, the measurements above may help choose.Translator key / shader cache: not affected.
Checks
cargo clippy -p victory-gpu --all-targets(default and--all-features) shows only main's existing 5 errors (font.rs, menu.rs, panel.rs, #4152).cargo xtask policyok.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T12:46:46Z.
There is a retry gap in
0a44cee9. The scheduler advancesSTARTEDbefore spawning the worker, so a transient spawn failure can suppress the memory line for another minute even though no sample was started.a32c1dae saves the previous timestamp and restores it on spawn failure, before clearing the worker flag. The next regular frame report can try again. A successful start still counts toward the configured interval.
In one Windows Rust fixture I ran the exact scheduler with a stub clock and worker builder. A sample at 5 s succeeded and an injected spawn failure at 65 s prevented the author version from trying again at 70 s. The patch retried successfully at 70 s and kept the normal interval for the new sample. The staged asset policy passed for the one file.
Please keep the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change in.AI-assisted with OpenAI Codex.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tikD1337 on 2026-12-01T13:28:03Z.
Tested on
origin/main(5fabb46e) in--releasestacked with#4877,#4885(VICTORY_THIN_PEEPHOLE=1), and#355601/03/04(VICTORY_PORT_CONSTANTS=0, Ryzen 5 7600 + RTX 4070 Ti SUPER, Driver621.1.0, Win1126300, DLSS Quality,105 ssteady 3D runs):#4877+#4872together lifted our stack from27.41 -> 27.93 FPS,36.48 -> 35.80 ms,submit_prep 32.7 -> 31.6 ms).105 sruns (including with DLSS FG 2x).Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Freeman022026 on 2026-12-01T14:04:29Z.
Tested on an RTX 4090 24 GB (driver 621.14), Ryzen 7 7800X3D, 64 GB RAM, Windows 11, Series X profile at 2560x1440, DLSS Performance, 2x DLSS Frame Generation, ray tracing off. Local MSVC release build on
v2026.11.30.02(84bd61e2) with #4872 composed alongside #4558 (VICTORY_SWEEP_OFF_THREAD=1) and a local PR stack.In a 6-hour session before adding #4872,
process memory:logged 4,292 times on its 5-second cadence, and theVirtualQuerywalk grew from 42,300 regions (306 ms) at startup to 130,126 regions (1,501 ms, peaking at 2,504 ms).With #4872 applied,
process memory:ran 14 times over a 13-minute session at 60-second intervals (199 ms at 42,138 regions up to 1,055 ms at 104,750 regions), cutting those 1 to 2.5 s walks by 12x. Unit tests forprocmemandunmapped_holderspassed on MSVCrustc 1.99.1.Not tested: isolated clean
main, a diagnostics build (copystatmemory line onvictory-memory-line), or a multi-hour run with #4872 enabled.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by botto854 on 2026-12-01T14:43:11Z.
A data point for the procmem part, from a 14900K / 4090 / 32 GB (Series X profile, DLAA, frame generation off,
diag build of v2026.11.30.02 + #2585). Same exe,
VICTORY_PROCESS_MEMORY=0against the default, five runs each,order alternated per round, 30 s settle + 240 s scripted route on a balcony:
PROCESS_MEMORY=0p99 was lower in all five pairs. Here the walk reports about 98,500 regions in ~530 ms, and every second that held a
frame over 100 ms ended less than a second before a "process memory:" line. In a free 27-minute drive through the city
the same lines explain only about a fifth of the long frames, so streaming dominates there; on a quiet scene it is most
of them. Once a minute, as here, looks right to me.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CLHelper on 2026-12-01T16:34:07Z.
On the "Not measured" point (why a submission waits behind the procmem walk): on this machine the write-watch query does wait for it.
RTX 4060 Laptop GPU (8 GB), 16 logical CPUs, 32 GB, Windows 11; Series S, DLSS performance; a local diagnostics build on
c71899d9e;VICTORY_TIMELINEover 24 frames, player standing still. (The timeline itself adds about 6 ms a frame.)victory-asksat inGetWriteWatchfor 19.97 ms and then 8.83 ms. The two calls returned 0.02 ms and 0.00 ms after thevictory-process-memorythread'sVirtualQuerycalls of 26.09 ms and 8.84 ms returned. The same walk also had oneVirtualQueryof 122 ms. In a second 24-frame window without a walk there was no longGetWriteWatch.VirtualQuerycalls of 5.4, 8.6 and 6.9 ms fromcopystat(one per top copied range). Moving that line off the presenting thread, as this PR does, covers it.Over a whole run the walk costs little here: one 200 s run with
VICTORY_PROCESS_MEMORY=0against one with the walk, standing still, gave p95 frame 60.7 against 62.2 ms, frames over 50 ms 16.1 % against 17.5 %, and 25.5 against 25.6 fps. One run each, without this PR's code.AI-assisted.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mstrmoos on 2026-12-01T16:53:07Z.
Picked this onto my play branch (#4835's code). Here's what it did on an RTX 5080.
That branch already has the process-memory line off by default, so the half that mattered here is the memory line moved off the presenting thread. The procmem doc conflicted with that; I merged it as "once a minute, off unless
VICTORY_PROCESS_MEMORY=1".Before: a 30-minute run standing on the pier (Series X, DLSS Balanced, frame generation 4x with Reflex low latency off and
frameLimitUs6,500, diagnostics build, about 5,000 draws a frame) had 5 frames over 100 ms out of 68,710: 110, 133, 147, 323 and 364 ms. Every one sat right beside amemory now:line. In the two longest, the presenting thread logged nothing for 316 and 348 ms, and the next line was the memory line.After, same build plus this, same scene and switches, 10 minutes:
The frame time is capped by the limiter here, so this only speaks to the tail. On that, it's clean.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:29:59Z.
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed