Repository navigation
Frame pacing: VICTORY_FRAME_PACE=auto|<ms> evens out long/short frame pairs, with the wait at our present to the host (VICTORY_PACE_AT_PRESENT=1); the frame meter's report off the presenting thread - #3851
Open
duckey-dev wants to merge 2 commits into
Conversation
…the world evenly, no sooner than the one before plus a target; VICTORY_PACE_AT_PRESENT=1 takes the wait at our present to the host (off unless set) Without pacing a heavier frame lets the card fall behind, the bound on host lists in flight stops the submitting thread, that present is late, and the next one goes out at once: frames come in long/short pairs (56 and 15 ms). The frame clock does not help at these rates: its ticks are absolute, and once the title is behind them every wait ends at once. Each present in the world now waits until the previous one's release plus a target; one already past that goes at once and the next counts from it (nothing is caught up). The target is a number of milliseconds, or auto: first estimated from the intervals between our presents to the host, then steered by the share of late presents (three of 32 raise it 3 %, none lowers it 1 %, longer runs with none late 3 %), 8 to 60 ms. VICTORY_PACE_AT_PRESENT=1: the title's present only notes its turn and goes on; the thread that presents waits just before the swap chain's Present, so the next frame's lists are submitted meanwhile. There a present counts late for auto only when more than VICTORY_PACE_SLACK (0.2 unless set) of the target past its turn. A 5-second log line gives the target, presents held back and late ones. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…CTORY_METER_OFF_THREAD, on unless 0) The presenting thread takes the meter's own figures (intervals, the present budget's window, frames, the 5-second counts) and hands them to victory-meter, which takes the other modules' counters and logs. A timeline capture had the report stand the presenting thread 33 ms once a second. The caption stays on the presenting thread. 0: the report on the presenting thread, as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
moritz-eckhard-nickel
added a commit
to moritz-eckhard-nickel/VIctory-NVIDIA
that referenced
this pull request
Nov 30, 2026
…E), both frame lines kept 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.
The problem
On an RX 7900 XTX at native 1440p (ray tracing off), a walk in the open world keeps about 28 frames a second, but the frames do not come evenly. They come in long/short pairs, 56 ms and then 15 ms. The median difference between two neighbouring frames is 21 ms, and 20 % of frames are over 50 ms. The average is close to 30, but what you see is closer to 18 fps with an extra frame squeezed in.
How it happens: a heavier frame lets the card fall behind. The limit on host lists in flight (
VICTORY_LATE_WAIT_LISTS) then stops the submitting thread, so that present is late. Meanwhile the card drains. The next frame is already made, so it goes out at once.The frame clock in
frame.rsdoes not prevent this at these rates. Its ticks are absolute (start plus whole intervals of the title's 33.3 ms). A wait whose tick has already passed ends at once. Once frames take longer than the interval, the title is always behind the clock, every wait ends at once, and nothing is paced.A second, smaller cause of uneven frames: once a second the frame meter builds its report (frame-time lines, budget, the 5-second counters) on the thread that presents. A timeline capture showed that block holding the submitting thread for 33 ms.
What it changes
1. Frame pacing (
crates/victory-gpu/src/pacer.rs, new; hooks inqueue.rsandhost.rs). Off unlessVICTORY_FRAME_PACEis set.world_since()is set and frames have 500 draws or more (8 frames in a row under that turn pacing off). Menus, movies and loading screens are not paced.VICTORY_FRAME_PACE=<ms>: a fixed target, 1 to 1000 ms.VICTORY_FRAME_PACE=auto: the first target comes from the intervals between our presents to the host, less the wait the pacer itself added. It is a high quantile of neighbour means, so a 60/18 alternation reads as 39 ms, plus 5 %. From then on the share of late presents steers it, looking at the last 32 presents once every 16: three or more late raise the target 3 %, none late lowers it 1 %, and after four looks in a row with none late it comes down 3 % a look. The target stays between 8 and 60 ms.queue.rs), before the present goes to the line or the host;VICTORY_PACE_AT_PRESENT=1, the title's present only notes its turn and goes on. The thread that presents to the host waits just before the swap chain'sPresent(host.rs). The frame's copy has already been sent, so the card keeps working, and the next frame's lists are submitted during the wait. This is the measured setup. With the wait on the title's thread, a capture showed that thread asleep about 27 ms a frame while the next frame's lists sat unsubmitted, and the card idle 15 to 20 ms every other frame.VICTORY_PACE_SLACK=<share>(0 to 2, default 0.2, only withVICTORY_PACE_AT_PRESENT=1): how far past its turn a present may be, as a share of the target, beforeautocounts it as late. Frames a few ms past their turn do not show. Counting them as late keptauto4 to 8 ms above what the walk sustains.Present, so they are paced before their markers. The generated frames in between are spaced by the frame-generation runtime, not by this.2. The frame meter's report off the presenting thread (
host.rs,VICTORY_METER_OFF_THREAD, on unless0). The presenting thread takes only the meter's own figures: intervals, the present budget's window, frame and draw counts, and the 5-second counts. It hands them to avictory-meterthread, which reads the other modules' counters and writes the lines. The window caption is still set from the presenting thread, as before.0keeps the report on the presenting thread, as before. The lines and their contents are unchanged. Counters read off the thread may count a moment longer into one report and the same amount shorter into the next.VICTORY_FRAME_PACEauto, or a target in msVICTORY_PACE_AT_PRESENT1: wait at our present to the host, not on the title's threadVICTORY_PACE_SLACKautocounts itVICTORY_METER_OFF_THREAD0: report on the presenting thread, as beforePacing is off by default. Turning it on lowers the average frame rate, for even frames (see below).
How it was tested
auto+VICTORY_PACE_AT_PRESENT=1autogives up 1 to 2 fps against it. Its target sometimes wanders up for a stretch, for example after a burst of streaming, and that is where its frames over 50 ms come from.cargo testpassed for the crates it touches: no failure that main does not have on this machine (13 pacer tests pass). Both of CI's clippy runs add no warning over main.Not tested
VICTORY_REFLEX, Streamline: NVIDIA Reflex low latency without frame generation (VICTORY_REFLEX=on|boost) #3072, or the Reflex that frame generation turns on). With both on, two things would pace.Checked for overlap
I searched the open pull requests for the same issue and for the files this touches.
Present queue: VICTORY_PACE shows every frame for the same number of refreshes (on top of #1988) #2201 (stacked on Present: the swap chain on a queue of its own (VICTORY_PRESENT_QUEUE=1) #1988): "Present queue: VICTORY_PACE shows every frame for the same number of refreshes". This is the closest one. It paces on Present: the swap chain on a queue of its own (VICTORY_PRESENT_QUEUE=1) #1988's present thread in whole display refreshes (vblank waits through the output), with
autochoosing the count by the share of late frames. That steering idea is the same as ours. Assessment: for a fixed-refresh display without VRR, theirs is better: a frame held for exactly n refreshes is what a V-synced display can show evenly, and ours does not align to refreshes. Ours is better where theirs does not reach: it needs Present: the swap chain on a queue of its own (VICTORY_PRESENT_QUEUE=1) #1988's present queue (a second queue and a stand-in copy, motivated by an NVIDIA driver behaviour), it is left out with frame generation, and its steps are whole refreshes (at 60 Hz, 33.3 or 50 ms; ours sustains 34.5 ms here). Ours works on the default present path, at any target, with or without VRR. They can live together, but not both on at once. If both land, ours should step aside whenVICTORY_PACEis set. The names also share a prefix (VICTORY_PACEagainstVICTORY_PACE_AT_PRESENT/VICTORY_PACE_SLACK), and one side could rename.Present: the swap chain on a queue of its own (VICTORY_PRESENT_QUEUE=1) #1988: the swap chain on a queue of its own (
VICTORY_PRESENT_QUEUE=1). It replaces thePresentcall that ourbefore_host_presenthook sits before with a handover to its own thread. With both, our wait would happen on the submitting thread before the handover. That still paces, but it would belong on its present thread. The text conflict is next to our hook.Host lists: the present can run on a thread of its own (VICTORY_PRESENT_THREAD, off by default) + RTX 4060 Ti 8 GB findings #2346: the present on a thread of its own (
VICTORY_PRESENT_THREAD). It rewrites the same lines as our twohost.rshooks. The text conflicts are small. In meaning it is the same question as Present: the swap chain on a queue of its own (VICTORY_PRESENT_QUEUE=1) #1988: with it, the pacer's wait should move into its present job.Frame clock: VICTORY_FRAME_INTERVAL_DRAWS keeps the title's own 30 for the opening animation, videos and menus #2077: the frame clock keeps the title's 30 for videos and menus (
VICTORY_FRAME_INTERVAL_DRAWS). It changes when the title's frames begin (frame.rs). Ours changes when finished frames are let go, and does not touchframe.rs. Complementary; both use the same 500-draw line for "in the world".Streamline: NVIDIA Reflex low latency without frame generation (VICTORY_REFLEX=on|boost) #3072: NVIDIA Reflex low latency without frame generation (
VICTORY_REFLEX). Reflex's sleep paces the title's frames, on NVIDIA only. It adds markers next to ourqueue.rshook (a small text conflict). Turning both on would mean two pacers.Card kept awake no more while Reflex paces frames (the 14 fps lock) #1938, FSR 3 frame generation: the presenter sleeps and waits for its fence instead of spinning (VICTORY_FSR_PACING) #2371: pacing inside frame-generation runtimes. No code overlap.
Frame generation asks the base-frame pace guard before it runs #1357 (with The WARP tests cannot skip in silence any more #1360, The inplace gate enforces the module's own rule about late wait #1363): the base-frame pace guard for frame generation (
streamline/pace.rs). Despite the name, it decides whether frame generation runs, not when frames go. No overlap.gpu, scripts: fix 5s VirtualQuery frame-pacing spikes, glass reflection specks, and 6-core thread sizing #2783: takes the 5-second
VirtualQuerywalk off in release builds. Related to the meter change only in symptom: that walk already runs on a thread of its own, and this PR moves the rest of the report.Many open PRs add lines to the meter's report body (for example Diagnostics: loading lines under the frame rate, crash minidumps, the PSO budget watch and a memory-by-kind line #3074, Synchronisation core: commit leak fix, exact refresh runs, list summaries, heap hooks on, and a night of NVIDIA/Ampere work #3650, Long frames: one line naming what a frame over 100 ms waited for, and paging on the memory line (release builds) #3703, Add Fluent runtime localization #3617). They merge as text, since the body stays where it is. But a line added there that reads a
Meterfield throughself.has to take its figure intoMeterReportinstead. None of the open ones checked does this.🤖 Generated with Claude Code