RTX 4070 12 GB + Ryzen 5 5600: steady-state world 361 → 263 ms/frame with CARD_BUFFERS_MIN_MB=1 on RELAY=1 (313 → 285 on RELAY=2); page faults 66k → 0.5k #418
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#418
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?
@xunbreakablex on GitHub · 2026-11-25 00:34 UTC · original
Needs human attention:
VICTORY_CARD_BUFFERS_MIN_MB=1moves change detection for ~87 more title-buffer copies (97 copies in the card instead of 10) to the card. I checked card vs CPU copies with a diagnostic (below) and found no mismatch in those copies, but I have not compared rendered images, and everything here is from one machine. Please do not read this as a reason to change a default on its own.Measurements of one switch in isolation, in steady state, on a card/CPU pair that is probably CPU-limited (the numbers other reports show for 4070-class cards on faster CPUs are lower: #125 187-205 ms, #27 4.3 fps).
Setup (#96 template)
7b0f736plus one local commit (texture hashing for changing view-memory textures);--profile diag --features diagnostics. This is older than currentmain(2119b0e): it does not have the in-flight-write fixes1582757(#89) andc75cb22(#168/#191)VICTORY_KEYSEnter presses to get through the start screens, no input afterwards; warm shader cache (misses=0) in every run belowVICTORY_RELAYas stated; CARD_BUFFERS =VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024Result (steady-state frame time, mean ± sd of 6 s log windows)
RELAY=1RELAY=1+ CARD_BUFFERS (same binary, run right after)RELAY=1(second pair, earlier)RELAY=1+ CARD_BUFFERS (second pair)RELAY=2(two runs)RELAY=2+ CARD_BUFFERS (one run)RELAY=1is as fast asRELAY=2(256-263 vs 267 ms median). Without itRELAY=1is about 45 ms slower thanRELAY=2. If you have to avoidRELAY=2(#89, #168), this is a way to avoid it without losing the speed.RELAY=1without → with CARD_BUFFERS: process page faults 66k → 0.5k; title-buffer bytes snapshotted on the CPU 349 → 24 MB; process kernel CPU ~194 → ~146 ms; relay (copy-back) thread busy 257 → 136 ms; time from present to the first command-list call 17 → 6 ms. The page-fault line is thecopies per framelog line. The "on the GPU" wait goes up withRELAY=2(about 94-111 → 124-163 ms) and down withRELAY=1(156-163 → 122 ms).Method note: whole-world medians include the warm-up
For the first ~90-120 s after the first world frame, frame time is 500-1200 ms and draws per frame are still rising from ~1,400 to ~4,950; in those windows 70-90% of the texture refresh time is "waiting for title memory to hold still" (the thing #95 is about). A median over the whole world period is therefore a mix. In our runs it was 5-15% above the steady state (for example 343 ms against 304 ms for the same run). I defined steady state as the first three consecutive log windows with < 400 ms and > 4,800 draws per frame, and report the mean ± sd from there to the end of the run (11-25 windows of 6 s per run). Warm-up took 92-120 s in these runs (84-92 s with CARD_BUFFERS). If other reports use whole-period medians, the speed-up of a change that shortens the warm-up (#95) and one that changes steady state will be mixed together.
Does the card copy equal the CPU copy? (diagnostic, not in the fork)
I wrote a diagnostic for
diagnosticsbuilds that, every 10th frame, drains all flights, holds the submission lock, reads whole card copies back and compares them with the CPU copy in 64 KiB pieces (leaving out bytes the title wrote that have not gone up yet). Run withRELAY=1+ CARD_BUFFERS, 233 rounds, 98 copies, every copy checked at least once, 1,311 copy checks: 0 mismatches in 97 copies (1,302 checks). The remaining 9 checks all mismatch in one 24 MiB copy: 140 of its 384 pieces (~6 MiB) differ, the same pieces every time. That copy is already in the card's memory by default (≥ 16 MB), so it is not somethingCARD_BUFFERS_MIN_MB=1adds. I do not know yet which side is newer there (shader writes that are not declared, or something that does not go up); a three-way comparison with the live title memory is next. Happy to open a PR for the diagnostic if it is useful.What this does not show
RELAY=2+ CARD_BUFFERS; two for the others. Other cards and CPUs.AI-assisted analysis (Claude); the runs were done on my machine.
@Yorivel on GitHub · 2026-11-25 01:01 UTC · original
Data point from an RTX 4090 + i9-14900K (64 GB, Windows 11, diag build).
CARD_BUFFERS_MIN_MB=1on top ofRELAY=2lost the first room's walls here.RELAY=2without it kept them.Base: fork
mainata803c87plus the DirectStorage page-write notify fix from #62 (branchfix/dstorage-notify-on-a803c87on Yorivel/victory-fork,VICTORY_DSTORAGE_NOTIFY=1). With that fix and no relay, the room was complete in 3 of 3 runs, where it used to be about 1 in 4. All runs also useSHADER_OPT=0andSHADER_LOOP_LIMIT=256.A C2 log line:
235.4 ms/frame (112.5 preparing: copies 42.2 ms 138.7 MB, textures 2.7 ms; 108.0 on the GPU; 190.5 copying back 67.3 MB), 5025 draws/frame.Caveats: B is a single run, and the room was random before the DirectStorage fix, so this is one bad run against two good ones, not proof. It does match #417 (card buffers + relay drop data) and #168 (relay loses walls). With the fix in, though, relay alone does not seem to lose them any more. On this machine the card-buffer setting also bought nothing with relay on: C was faster than B.
Under relay, copy-back now takes the most time: about 190 ms for about 70 MB a frame.
@xunbreakablex on GitHub · 2026-11-25 01:06 UTC · original
Thanks, this is the data point I was missing: it says the CARD_BUFFERS gain depends on the CPU, and I should not have written it as a general recommendation.
My reading, which I have not tested on a fast CPU: on a Ryzen 5 5600 the card path replaces about 345 MB per frame of CPU-side snapshotting (the "title-buffer bytes snapshotted" in the numbers above) and about 66k page faults a frame; on a 14900K that CPU work is much cheaper, so there is less to save and the card-side compares (the GPU wait went up with
RELAY=2here too: ~94-111 → 124-163 ms) can cost more than they save. That would fit your C being faster than B.On the walls: I have only one
RELAY=2+ CARD_BUFFERS run (313-324 → 285 ms), most of my runs areRELAY=1, and I have not looked at the barracks window, so I cannot confirm or rule it out. Two things to keep apart: my byte check compares the card copy with the CPU copy, which does not cover an ordering problem like the one in #168 (a copy can be equal and still be read too early). And #417 saw a broken picture withCARD_BUFFERS_MB=4096, clean at 1024, which is the value I used.If you want to see whether
CARD_BUFFERS_MIN_MB=1withRELAY=2ever leaves the card and CPU copies different on your base, #455 addsVICTORY_CARD_VERIFY=N(diagnostics builds, based ona803c87): every Nth frame it drains the flights and compares the card copies with their CPU side, onecard verify:line per copy. Its three-way part (which side is newer) has not been run in game yet.(AI-assisted; the numbers above are from my own runs.)
@xunbreakablex on GitHub · 2026-11-25 10:24 UTC · original
A hardware note I should have put in my measurements above: this machine is power- and clock-limited. RTX 4070 with a 100 W power limit (core at most ~2300 MHz), Ryzen 5 5600 held at 3.95 GHz (so below its normal boost). The 361 -> 263 ms steady-frame numbers come from that CPU-bound setup, which fits Yorivel's reading that the gain depends on the CPU; I would not expect them to carry over to a faster or unthrottled CPU. Single machine, as before.
AI-assisted (Claude).