Repository navigation
Conversation
crates/victory-gpu/src/longframe.rs as trustno1-coder#1925 (wtry-gta) has it at 1a4eefb, with its hook in the frame-rate meter. trustno1-coder#1925 is on f9dfb76 and does not apply to main (run.rs, ab.rs, descriptor and others conflict), so only the module and the meter's call come here; the places that feed its stages are in trustno1-coder#1925's other changes and are not ported. The next commit gives it the stages of a long frame on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aging on the memory line In every build, when a present comes more than VICTORY_LONG_FRAME_MS (100 by default; 0: never) after the one before, one line names the frame's parts on all threads: pipeline waits (graphics, compute, passes over the screen, and how many threads waited), the sweep, settles by why, the submission lock, resident and mapping waits, the texture pass, shaders translated at first use and pipelines made. At most 4 lines a second; the next says how many long frames had none. The per-second lines spread a spike over its second, so the causes of the long frames on the RTX 5080 bench (one frame over 100 ms nearly every second, single frames of 380-620 ms) were only known by coincidence per second. The parts are AtomicU64 counters the present swaps back to 0, fed with relaxed adds where a clock is read already (the sweep's once a second is the only new one). The once-a-second "memory now:" line also says the PC's free memory, our page faults a second (PageFaultCount, soft and hard) and the pages all processes read from disk a second with the reads that brought them (hard faults: SystemPerformanceInformation's PageReadCount and PageReadIoCount). That PC runs with 0.1-1.3 GB free and ~5.5 GB of ours paged out, and no line could show a stall from a hard fault. Built on the module of trustno1-coder#1925 (previous commit, its author's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, Submit-thread speedups, in-session A/B, teleport test tool, texture cap, ambient floor #1925): Submit-thread speedups, in-session A/B, teleport test tool, texture cap, ambient floor #1925'slongframe.rsmodule as it is at 1a4eefb, with its call in the frame-rate meter. Submit-thread speedups, in-session A/B, teleport test tool, texture cap, ambient floor #1925 is on f9dfb76 and conflicts on main, so only the module and that one call come over. The places that feed its stages are in Submit-thread speedups, in-session A/B, teleport test tool, texture cap, ambient floor #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 ccc22ec'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 6on ccc22ec (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-featureson ccc22ec itself does not compile, for a reason that is main's: its base 716a0c9 has the diagnostics build errors that main's 41adb55 fixed (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 main 41adb55, 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 main 41adb55 (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 (base 716a0c9): 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 on f9dfb76 and 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