Long frames: one line naming what a frame over 100 ms waited for, and paging on the memory line (release builds) #3703
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3703"
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 Lyrnc on 2026-11-30T04:21:35Z.
Problem
G1. Release builds do not say what a long frame waited for. The
frame timesline only counts frames over 50 and 100 ms. Every other per-second line (the submitting thread's split, settles by why, resident waits, the texture pass) spreads a 500 ms frame over its second. The per-part timers (copystat, timeline) are in diagnostics builds only. So the perf30 cause table (CAUSES.md) had to be built by coincidence per second (tools/classify.py):Tonight's A/B needs the per-frame cause.
G4. Nothing logs paging, although the bench PC runs with 0.1-1.3 GB of physical memory free and the process has about 5.5 GB paged out (
26310 MB private ... (20844 MB in memory)). A hard fault stalls whichever thread takes it, and no line can show that.Fix
Two commits on main:
87f9814a, author Wtry (wtry-gta, #1925): #1925'slongframe.rsmodule as it is at1a4eefb2, with its call in the frame-rate meter. #1925 is onf9dfb76fand conflicts on main, so only the module and that one call come over. The places that feed its stages are in #1925's other changes and are not ported.ccc22ecc: the module gets the parts G1 lists, a default and a rate limit.memory_nowgets paging (G4).G1:
crate::longframe, on by default.At every present the meter swaps a set of
AtomicU64counters back to 0 (µs and span counts per part).When the present came more than
VICTORY_LONG_FRAME_MSafter the one before (default 100;0turns it off), one line at info, targetvictory_gpu::longframe. At most 4 lines a second; the next line says how many long frames had none. Example (from the unit test):long frame 512 ms (frame 18200), ms on all threads: pipeline waits 480 (graphics 480; 3 threads), sweep 0, settles 6 (sync 6), lock 0, resident 12 (mapped 1), texture pass 3, translated 0, pipelines made 2 (1260 ms)What feeds each part. Every feed is a relaxed
fetch_add, placed where the code already reads a clock:pipeline/make.rs:wait()(bywaits_as_screenandgraphics.is_none()), and the inline compute make inready()(wherecompute_spentis fed). Threads: each thread counts once per present (a thread-local present number)host.rs::sweep(), from past its once-a-second gate to its end. This part adds its own clock read, once a secondrelay_wait()andHost::settle(), next toLATE_WAITED[why]. The line shows the total, then each why of at least 0.5 ms (always the largest), named after host'sWHY_places. Aconstassert in host.rs keeps those places in line with the namesHost::submit, the same nanoseconds asSPLIT[11]("waiting for the submission lock")host::resident()(MakeResident) plushost::mapped()(until mapped), the counters behind the "new memory waited for" lines; the mapped part is shown when it is 0.5 ms or moredraw.rsheap_textures(): the loop'stookplus what came before the loop (HEAP_TEXTURE_REST[7]), from the clocks it already readspipeline.rsShader::translated(): ms and shadersmake.rsPending::make(): everyHostPipeline::new(driver compile or library load), with its msA span counts whole in the frame it ended in. Parts on other threads overlap the submitting thread and each other, so the parts need not add up to the frame (the line says "on all threads").
The steady-state cost is relaxed atomics on paths that already wait or take a clock, an
OnceLockread per feed, and 43 atomic swaps per present. The gate's mutex is taken only for frames over the threshold.G4:
memory_now()(once a second, from the sweep). Thememory now:line keeps its text and gets a; ...tail:residency::physical_free);PageFaultCount, which counts soft and hard faults, from theK32GetProcessMemoryInfocall the line already makes;SYSTEM_PERFORMANCE_INFORMATION'sPageReadCount(0x50, behind\Memory\Pages Input/sec) andPageReadIoCount(0x54,\Memory\Page Reads/sec), fromNtQuerySystemInformation(SystemPerformanceInformation)(ntdll raw-dylib, as host.rs does forNtWriteVirtualMemory).All are wrapping u32 counters. Rates are per second of the actual time between lines (the sweep can come later than a second). The first line says the rates come from the next line on. If Windows does not answer, the line says the page reads are not known.
memory now: committed 26310 MB, ...; the PC's memory free 640 MB, page faults of ours 4000 a second, pages read from disk by all processes 1000 a second in 50 reads (hard faults)Verification
Windows 11, rustc 1.98.1 (the pinned toolchain), Ryzen 7 9800X3D. On ccc22ecc's tree, before it was committed:
cargo check -p victory-gpu --locked: passes. None of the crate's 18 warnings is in the lines this touches; they are existing dead code elsewhere (pipeline.rs841-898,make.rs1328Queue::pop,host.rs3160/12825/12966,shadow.rs,watch.rsand others).cargo test -p victory-gpu --lib --locked -- longframe paging_tests: 10 passed, 0 failed.longframe::tests:threshold_defaults_to_100_ms_and_0_turns_it_off: unset, empty or not a number gives 100;0, a negative orinfturns it off.only_frames_over_the_threshold_are_long.each_present_takes_the_parts_and_starts_again: the reset.a_thread_counts_once_a_present_among_pipeline_waiters.at_most_four_lines_a_second_and_the_next_says_how_many_had_none: the rate limit and its window.the_line_names_each_part: the exact text, rounding, the settle why shown, the skipped tail.host::paging_tests:page_counters_are_taken_a_second_and_across_a_wrap.the_paging_text_has_rates_from_the_second_line_on.performance_words_are_read_little_end_first.system_performance_information_is_read_where_windows_puts_it: this callsNtQuerySystemInformationfor real.AvailablePagesat 0x2c times 4 KiB matchedGlobalMemoryStatusEx's free memory, which checks the offsets. Page reads came back no lower than the IOs that brought them.cargo clippy -p victory-gpu --all-targets --locked -j 6onccc22ecc(2026-11-30, target directoryC:\it, built fromC:\i-long): finishes with warnings only (victory-gpu lib 25, lib test 24, victory-shader 3). None is on a line this branch adds (checked againstgit diff -U0 716a0c99 ccc22ecc: all oflongframe.rs,paging_testsandmemory_now's helpers, the feeds inhost.rs,draw.rs,pipeline.rsandpipeline/make.rs).cargo clippy ... --all-featuresonccc22eccitself does not compile, for a reason that is main's: its base716a0c99has the diagnostics build errors that main's41adb551fixed (mbmissing in copystat.rs's windows-cut line,timing()shadowed inHost::submit; 9 errors, none in this branch's lines). The branch merges cleanly with main41adb551, so it was run on that merge (dd105afc, a scratch commit, not pushed; the PR's CI checks the same merge): finishes with warnings only (lib 27, lib test 30, victory-shader 3). None is on a line this branch adds, and its 37 warnings are the same, file by file and kind by kind, as an--all-featuresclippy of main41adb551(with onlypipeline/library.rschanged, which adds none).NOT tested
classify.pyon R1/R2 is for the benchmark agent.NtQuerySystemInformationanswers under Wine/Proton. If it does not, the line says the page reads are not known.cargo clippy --all-featureson the branch as it is (base716a0c99): it stops at main's old diagnostics errors; it was run on the branch merged with main (see Verification). Not rebased: it merges cleanly.settle_now,settle_unlocked) are counted only where they reachrelay_waitorHost::settle. The submission lock taken outsideHost::submit(settle_now, the present's order lock) is not in "lock".Overlap
gh pr list --state open --searchfor "long frame", "frame breakdown", "page fault", "hard fault", "longframe", "PageFaultCount", "paging", "Pages Input", "memory now", "free physical", "per frame breakdown", "spike".longframe.rs,VICTORY_LONG_FRAME=<ms>, off by default, with other stages (title waits at present/room/drain, the submit thread, landings, texback, refreshes, remap and read locks, DirectStorage, map calls) and a 10 s summary. It is onf9dfb76fand conflicts on main. Built on: commit 1 is its module with Wtry as author. The stages here are G1's; its stages could come back as more parts once its feeding hunks are rebased. Its 10 s summary was not kept: the skipped count covers the rate limit.procmem.rsadds "process memory beside the census", with our page faults a second (soft and hard) and the PC's free physical memory, on the census's own schedule. It has no system hard-fault rate and does not touchmemory_now. No conflict; if both land, the process fault rate is logged twice.AI use
Claude Code (Claude Opus 5.5) ported #1925's module (with its author kept), wrote the second commit and its unit tests, ran the checks listed above, and wrote this note. Nothing was run in game.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by paales on 2026-11-30T20:51:57Z.
Written by 🤖:
I used this line to find what frames at the cuts of the first cutscene wait for. PC: RTX 5070 Ti 16 GB, Ryzen 9 5900X, 32 GB, Windows 11. Series X, 1440p, DLSS Performance, frame generation off, 30 fps cap. Each run: a new game (settings save, no story save), one A press, the first cutscene for 60 s from its first frame. On this PC the same build's submitting thread took 24 ms a frame in one run and 35 ms in another half an hour later, so only large differences count.
It merged cleanly onto
main84bd61e2with #3918, #1727, #3553, #3043 and #4206. With #4138 it conflicts inhost.rsin two places: #4138 moves the sweep's work intorun_sweepon a thread of its own, and your timer goes intorun_sweepthere.With
VICTORY_LONG_FRAME_MS=50, 56 long frames in 60 s: the texture pass 1,460 ms over them, waits for new memory to be resident 944 ms, the submission lock 490 ms, settles 413 ms. At the scene's first frame, two passes over the screen waited 2.1 and 3.2 s for pipelines made in that run. Thanks, it made those causes visible in a release build.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T03:56:19Z.
Thanks @paales, glad it helped. Your split is the kind of answer this line is meant to give in a release build: 56 frames over 50 ms in 60 s, with the texture pass at 1,460 ms, waits for new memory to be resident at 944 ms, the submission lock at 490 ms and settles at 413 ms. At the scene's first frame there were also two pipeline waits of 2.1 and 3.2 s.
On #4138: if it lands first, I'll rebase this. The timer shouldn't just move into its
run_sweep, though. On a thread of its own the sweep no longer holds the frame, so the line would blame it for frames it didn't delay. There, the line should count only the time the submitting thread waits for the sweep, if it waits at all.AI use: Claude Code (Claude Opus 5.5) wrote this.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:49:40Z.
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