Making VICTORY_PORT_CONSTANTS pay on CPU-bound PCs: a VRAM copy of the culling's atomic ranges gave +15-22 % fps here. Full data inside; help, tests and ideas wanted #586
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?
Imported from readmet3xt-lab/foxhound. Originally posted by BrenoMazini on 2026-12-04T00:53:41Z.
foxhound version: 0.8.3.5 (
5e44415) with my fork's changes on top. The earlier measurements below were made on the build of my fork described in #532's controlled runs. Each section says which.GPU / CPU / RAM / Windows: RTX 4070 SUPER 12 GB / Ryzen 7 5700X (8 cores, 16 threads) / 32 GB / Windows 11. Fixed pagefile of 32-48 GB (commit limit about 64 GB). Resizable BAR on (16 GB BAR1); foxhound's paths that use it (
VICTORY_WC_BAR,VICTORY_SEND_BAR) were off in every run.Launcher settings (resolution, DLSS, Frame Generation, VRAM limit): 3440x1440, DLSS Performance, Frame Generation off, VRAM limit not set
What happens, and when:
This is not a bug report. It is the full record of a feature in my fork, the "home", written for two audiences:
#532 and #572 mention it in passing. This issue puts everything in one place: what it does, what it gave, what it costs, what I tried and dropped, what I'm testing now, and what I don't know.
In short
Corrected on 2026-12-04, after re-checking my logs and results: the title and this summary gave only the larger of the two gains, the defaults' p95 in section 4 came from one series only, and section 1 mixed a value from the standing phase into the port's preparing time. The numbers below are the corrected ones. No conclusion changed.
VICTORY_PORT_CONSTANTS=1, the title's large shared buffer stays in system RAM and the card reaches it over PCIe. The culling programs change a few small ranges of that buffer with atomic operations, tens of times a frame, and each atomic over PCIe is a round trip on the bus.GUARD_PAGES=1gave 13.7 fps, so the home was about 10 % above it. The card's time in compute dispatches fell from about 40 ms to 17-19 ms a frame.GUARD_PAGES=1(p95 105-111 ms against 86 ms), more work on the submitting thread, and it only helps where the port is on.How you can help
Testing the home itself needs my fork and the title's values, which I can't post. Until there's a way to carry those values (question 3 in section 9), these are the things that would help most, and none of them needs the home:
VICTORY_PROFILE=1andVICTORY_PROFILE_TOP=1, run the same spot and camera path withVICTORY_PORT_CONSTANTS=1and without it, and post the card busy, the card profile's time in dispatches, and the submitting thread's preparing line from the 5-second lines. That would show how much the culling's atomics over PCIe cost on other cards and buses, which is the cost the home removes.When you post numbers, please follow the template's rules: no names from the game, no files or captures from it, and the game folder replaced by
<game>in logs.1. Why it exists: the cost of atomics over PCIe
What the port does on this PC (controlled runs in #532, same spot, same scripted camera turn):
The port takes the copying work off the CPU, but the card pays for it, and the frame rate stays where it was.
Where the card's extra time goes:
2. How it works
It is off by default (
VICTORY_HOME=1turns it on), and it turns itself off with a warning withoutPORT_CONSTANTS=1.The ranges. Up to four ranges of the shared buffer, given in MiB (
VICTORY_HOME_RUNS). In this title, two ranges, 4 MiB in total. The home is two buffers of that size in the card's memory: the copy, and a snapshot of the last state both sides agreed on.The translator. In the culling programs (the profile's
pass.*roles) and in programs named inVICTORY_HOME_PROGRAMS:This is safe in this title because the small views the culling uses are all under 1 MB, so an offset that large only exists in the view of the whole buffer, whose base is the buffer's start.
The host side.
Keeping both sides in agreement. This is the core. Around every submission whose lists used the home, on the same queue:
VICTORY_HOME_PULL_COPY, on by default). A program of ours then compares each dword with the snapshot; where the title's memory differs, it writes the new value into both the copy and the snapshot.VICTORY_HOME_ARGS, on by default).The log line, every 5 s:
VICTORY_PROFILE=1, the card time of each pull and push.3. What each part gave, in the order I built it
Single sessions, not controlled runs. Only the card-side numbers compare across sessions.
HOME_PULL_COPY)That last row means ~97 % of each pull is wasted. The obvious fix, pulling only the pages the CPU wrote, can't work under the port (section 6).
4. Controlled results
Same spot, same direction, at least 30 s to settle, then input only from
VICTORY_KEYS_FILE: 20 s to settle, 60 s standing, 24 s turning the camera. Configurations alternated. I read the turning phase, where the load per frame stays within a few percent across runs. The method is described in full in #532.Series 1 and 2 (the build of #532's controlled runs):
GUARD_PAGES=1GUARD_PAGES=1Series 1 alternated the defaults, the port and the port with the home run by run (A B C C B A). Series 2 ran the defaults against
GUARD_PAGES=1(A AG AG A), then the port with the home against the same plusGUARD_PAGES=1(C CG CG C), so in series 2 the defaults and the home were not alternated with each other. That is why I give both gains: +15 % in series 1, +22 % in series 2.GUARD_PAGES=1adds nothing on top of the port and the home. With the port, there is far less left to copy.Thread series (0.8.3.5 + my fork, #572):
VICTORY_THIN_THREADS=6instead of 8, the frames over 100 ms fell from 18-23 % to 9-12 % (two runs each), with the same median.5. Where the card still pays with the port and the home
Same build, turning phase: the stock path with
GUARD_PAGES=1against the port and the home.6. What I tried and dropped
HOME_SPARSE).7. What I'm testing now, and what is still open
Updated on 2026-12-04 with what the first two items gave. In short: each of them did what it was meant to do on the card or the threads, but on this PC the frame time varies between loads more than either effect, so I can't claim a frame-rate gain from them. All of this comes from short, quick tests in a controlled setting (the same spot and scripted camera turn as in section 4, about two minutes each, two runs per configuration), so please take it as a first look, not as settled results.
VICTORY_SCRATCH_KEEP_MB=1024). This is not the home, but it is on the same configuration.VICTORY_SPARE_WARM_MBevery frame while the host is under memory pressure, so that key has to be raised too.ask_first):GetWriteWatchitself, which here costs 3-4 times what the code's comment measured upstream (0.3 µs a call plus 0.5-1.1 µs per MiB walked). The calls that overlap aVirtualProtecton another thread cost 5-11 times that. My guess is that both take the same address-space lock in the kernel, but I haven't confirmed it.VICTORY_ASK_NEAR=1(512 KiB instead of 8 MiB) would walk far less; it has never been measured here.VirtualProtectcalls (opening a 64 KiB block) added up to 21-39 ms of thread time a frame, 0.3 ms each alone and 1.0-1.8 ms when aGetWriteWatchran at the same time. To see what the normal build pays, I added a log line behind a new key that is off by default (VICTORY_FAULT_TIME=1, only in my local build for now): write faults per frame by the way they went, their time, and theVirtualProtectcalls in faults, opening and guarding again.watch::guards; my build has #527's journal mirror, so this isn't the journal's lock). The guards' lock is also taken by the title's streaming threads (writing()before a file read), the faults that go the locked way,guard_aheadand the runtime's memory notices, and guarding a block again (VirtualProtectinguard_locked) is done with it held. #434 already moves those calls outside the lock; its replay bench on a fast CPU saw no difference, so a slower CPU like this one may be where it shows. I'll first measure who holds the lock in the normal build (VICTORY_GUARDS_TOP=1,VICTORY_REFRESH_TOP=1) and then try #434 here.VICTORY_GUARD_HOT=50(the launcher's value) leaves a block the title writes again and again open for 50 ms.docs/findings.mdmeasured it in scenes of roughly 35-55 ms frames, so about one frame or a bit more. My frames are longer (about 70 ms), so 50 ms is less than one frame: if I read it right, a block written every frame is guarded again and faults again every frame. I'll try 150 ms.VICTORY_FILL_TITLE=1), with a stated risk (a constant read stale). I'll try it on its own and watch for visual faults.8. What I don't know, and the risks
GUARD_PAGES=1, as above.9. What a PR would contain, and the questions
A PR would contain only what is measured and kept:
It would leave out the sparse pull, the quiet ranges and everything from section 7. And it would carry no values for any title:
pass.*roles.My questions:
If the answer is no, that's fine: the home stays in my fork, and I'll keep posting what I measure.
Log: not attached, because the logs carry the title profile's shader ids. I can post the summary lines (
frame times:,card profile,home (VICTORY_HOME) per frame) from any of the runs above, with the game folder replaced by<game>.As in my other reports, I made the runs and the configuration, and a model (Claude) read the logs and helped with the code. Every number comes from the logs.
Imported from readmet3xt-lab/foxhound. Originally posted by tillo88 on 2026-12-04T06:12:23Z.
@BrenoMazini, here is the port on/off measurement you asked for, on the replay bench.
Measured: release v0.8.3.5 (
5e44415), no PR,VICTORY_PROFILE=1on both sides; one side addsVICTORY_PORT_CONSTANTS=1. Same save and recorded controller input on every run, ~6.5 min route (prison cutscene, cut to the plane, first part on the boat); each job starts with a warm-up run that is not counted. 2 measured runs per side.VICTORY_PROFILE_TOPdoes not exist in v0.8.3.5, so there is no per-program breakdown (and I would not post program lines anyway, since they carry the profile's shader ids).PORT_CONSTANTS=1Card profile values are the frame-weighted means of the 5-second
card profilelines over the whole route.What it shows on this machine:
crates/victory-gpu/src/port.rs, "not one stretch of a section").queue::behindwarning ("a queue still stood at a wait at a present") in port run 2; the same one-time warning also appeared on this bench without the port, so I don't attribute it.For scale: the release without
VICTORY_PROFILEaverages 36.86 fps over 9 runs (36.45-37.24) on the same route, so the profiler itself costs about 2 % here. A port-on job without the profiler is queued, to give the plain frame-rate cost.Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default
play-foxhound.ps1settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap.Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
Imported from readmet3xt-lab/foxhound. Originally posted by BrenoMazini on 2026-12-04T11:26:06Z.
Thank you for taking the time to run this, and with so much care: a replay bench, a warm-up run left out, two measured runs on each side, and the profiler's own cost measured too. It is exactly the comparison I asked for, and more carefully done than mine.
Your result fits what I tried to describe in sections 8 and "How you can help", and I think it shows the other side of it well:
Your numbers also show something I didn't know. On your route the largest rise is in indirect draws, while dispatches rise only by about 1.5 ms. Here the rise was mostly in dispatches, from the culling's atomics over PCIe, which is the only cost the home removes. So even where the port does pay, how much the home can win back may depend a lot on the scene.
To be clear, I'm not presenting any of this as confirmed. Everything on my side comes from one PC and short runs, and the frame times vary between loads more than I would like (your two port runs, 10.6 and 19.8 fps, show the same kind of spread). It still needs tests from people with hardware like mine, or with the same pattern: a CPU that limits the frame while the card has room left on the stock path.
One difference between our setups that may matter: my runs are made further into the story, in a city area with many more people and objects around. It is a much denser scene, about 5,500-7,500 indirect executions a frame in my logs, and that is where the CPU limit shows most. Your automated route is very good, because it can be repeated exactly. If at some point you could also record one through a city area like that, I think it would be the most useful comparison, since that is probably where most players spend their time. The
indirect executions per framevalue from the 5-second lines would also let us compare the density of our scenes directly. There's no hurry at all.Thanks again for the help.
As in my other posts, I made the runs and wrote the request, and a model (Claude) helped me read the logs and write this reply.