Copy path measured on GTA VI (4080 SUPER / 5800X): copy-back optimum at 256 KiB, the stage is bookkeeping-bound, and one thread maps #3713

Open
opened 2026-11-30 04:28:34 +00:00 by github-bot · 3 comments
Owner

@⁠TheBen420 on GitHub · 2026-11-30 04:27 UTC · original

Frame-time work on the copy path, measured at a fixed viewpoint in GTA VI (not a cutscene, not a menu): two spots held for 30 s each, one cold launch per run, numbers taken from the engine's own frame lines.

Machine: RTX 4080 SUPER 16 GB, driver 32.0.16.2140, Ryzen 7 5800X, 64 GB DDR4-3600, Windows 11 Pro 22631.
Build: 41adb551 from source, release, plus a local patch that caps the copy-back (below).
Launch: --res 1080to1440 --dlss dlaa --no-framegen-ready --set VICTORY_ALIAS_TARGETS=0 --set VICTORY_ROOM_REAL=1 --set VICTORY_AMBIENT_CHROMA_SCRUB=1 --set VICTORY_RAYMISS_KEEP=1 --set VICTORY_AMBIENT_SPECULAR=1,0
Logs: https://gist.github.com/TheBen420/2568016fcd58c50abb50dbed3886aafe

Where the frame goes

At the reference spot a 50 ms frame splits as: preparing 35–42 ms (copies 18–23 ms for 52–58 MB, copy-back 12–14 ms, textures 1–2 ms), GPU 0.5–3 ms, and the rest is the title's own CPU work. The card is idle. Everything below is therefore about the copy path.

1. The copy-back cap has an optimum, and it is below yours

A local patch (VICTORY_GPU_BACK_MAX_KB=<n>: shader writes to ranges larger than n KiB are not copied back) gave this curve at the same spot:

cap copy-back time copy-back volume fps
256 KiB 11.6–13.3 ms 0.9 MB 19.4–20.8
1 MiB 12.7–15.7 ms 1.3–1.5 MB 18.9–19.6
4 MiB 15.8–16.3 ms 1.4–1.6 MB 17.8–20.5
16 MiB 17.0–17.7 ms 1.3–1.4 MB 13.4
none (0) 4.6–12.4 ms 0.0 MB broken, see below

Two things stand out. Raising the cap makes copy-back both slower and larger in volume, monotonically, which is the opposite of the intent — larger retained ranges appear to force larger resyncs.

2. The copy-back stage costs bookkeeping, not bytes

With VICTORY_GPU_BACK_MAX_KB=0 the frame line reads copying back 0.0 MB while the same stage still reports 4.6–12.4 ms. Almost the whole cost is the scan and the queue around the copies, not the memory movement. That is the one worth a look: skipping every byte saves a fraction of the time, so no amount of threshold tuning can recover it.

3. VICTORY_COPY_MODE=none does not reach the copies that matter

Documented as "skips the copies (for timing only)". Set and confirmed in the log, the frame line still reported copies at 24.8–25.6 ms for 52–55 MB. So it cannot be used to size the prize.

4. The title does read back what the card writes

There is a claim circulating that the game never reads the buffers copied back, so copy-back can be dropped wholesale. On this title and save it cannot: with no copy-back at all, textures stretch off the character's head and the sunlight flickers like a candle. Vertex/index data and the lighting buffers are read. Above 4 MiB no distortion was visible, so the readable set is small but real, and it is in that set.

5. Parallel page mapping is worth about a frame

VICTORY_SOFT_VIEWS=0 with VICTORY_MAP_THREADS=8 (soft views force one thread, xmem.rs side_by_side):

copies fps
soft views (one thread) 20.8–25.6 ms, 2.4 GB/s 19.4–20.8
SOFT_VIEWS=0 + MAP_THREADS=8 14.7–21.7 ms, 3.4 GB/s 18.5–20.0 (native 1440), ~1 fps up

MAP_THREADS=16 goes backwards (2.8 GB/s at the same spot) — the knee is at 8, as the note in xmem.rs predicts.

Ruled out, with numbers

  • VICTORY_TEXTURE_ROOM_PERCENT=90: no frame-time change, VRAM 11.8 → 12.6 GB.
  • VICTORY_TEXSPK_PASS_MS=16: no gain, copy-back slightly worse, more reconstruction noise on ground.
  • VICTORY_SMALL_COPY=0: a wash on Zen 3 (18.8–20.0 against 18.5–19.6), so the SSE2 path neither helps nor hurts here.
  • 4k output: ~100 ms a frame against ~50 at the same internal resolution, GPU still idle — presentation cost only.

One intermittent thing, recorded because it is not frame time: distant textures at a fixed island viewpoint flicker out and back at a regular interval on some runs and not others, with no measurable fps cost. Probably residency churn, but I have not caught it with counters yet.

**@⁠TheBen420** on GitHub · 2026-11-30 04:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3713) Frame-time work on the copy path, measured at a fixed viewpoint in GTA VI (not a cutscene, not a menu): two spots held for 30 s each, one cold launch per run, numbers taken from the engine's own frame lines. **Machine:** RTX 4080 SUPER 16 GB, driver 32.0.16.2140, Ryzen 7 5800X, 64 GB DDR4-3600, Windows 11 Pro 22631. **Build:** `41adb551` from source, release, plus a local patch that caps the copy-back (below). **Launch:** `--res 1080to1440 --dlss dlaa --no-framegen-ready --set VICTORY_ALIAS_TARGETS=0 --set VICTORY_ROOM_REAL=1 --set VICTORY_AMBIENT_CHROMA_SCRUB=1 --set VICTORY_RAYMISS_KEEP=1 --set VICTORY_AMBIENT_SPECULAR=1,0` **Logs:** https://gist.github.com/TheBen420/2568016fcd58c50abb50dbed3886aafe ## Where the frame goes At the reference spot a 50 ms frame splits as: **preparing 35–42 ms** (copies 18–23 ms for 52–58 MB, copy-back 12–14 ms, textures 1–2 ms), **GPU 0.5–3 ms**, and the rest is the title's own CPU work. The card is idle. Everything below is therefore about the copy path. ## 1. The copy-back cap has an optimum, and it is below yours A local patch (`VICTORY_GPU_BACK_MAX_KB=<n>`: shader writes to ranges larger than `n` KiB are not copied back) gave this curve at the same spot: | cap | copy-back time | copy-back volume | fps | |---|---|---|---| | 256 KiB | 11.6–13.3 ms | 0.9 MB | 19.4–20.8 | | 1 MiB | 12.7–15.7 ms | 1.3–1.5 MB | 18.9–19.6 | | 4 MiB | 15.8–16.3 ms | 1.4–1.6 MB | 17.8–20.5 | | 16 MiB | 17.0–17.7 ms | 1.3–1.4 MB | 13.4 | | none (0) | 4.6–12.4 ms | 0.0 MB | broken, see below | Two things stand out. Raising the cap makes copy-back both **slower** and **larger in volume**, monotonically, which is the opposite of the intent — larger retained ranges appear to force larger resyncs. ## 2. The copy-back stage costs bookkeeping, not bytes With `VICTORY_GPU_BACK_MAX_KB=0` the frame line reads `copying back 0.0 MB` while the same stage still reports **4.6–12.4 ms**. Almost the whole cost is the scan and the queue around the copies, not the memory movement. That is the one worth a look: skipping every byte saves a fraction of the time, so no amount of threshold tuning can recover it. ## 3. `VICTORY_COPY_MODE=none` does not reach the copies that matter Documented as "skips the copies (for timing only)". Set and confirmed in the log, the frame line still reported copies at 24.8–25.6 ms for 52–55 MB. So it cannot be used to size the prize. ## 4. The title does read back what the card writes There is a claim circulating that the game never reads the buffers copied back, so copy-back can be dropped wholesale. On this title and save it cannot: with no copy-back at all, **textures stretch off the character's head and the sunlight flickers like a candle.** Vertex/index data and the lighting buffers are read. Above 4 MiB no distortion was visible, so the readable set is small but real, and it is in that set. ## 5. Parallel page mapping is worth about a frame `VICTORY_SOFT_VIEWS=0` with `VICTORY_MAP_THREADS=8` (soft views force one thread, `xmem.rs` `side_by_side`): | | copies | fps | |---|---|---| | soft views (one thread) | 20.8–25.6 ms, 2.4 GB/s | 19.4–20.8 | | `SOFT_VIEWS=0` + `MAP_THREADS=8` | 14.7–21.7 ms, 3.4 GB/s | 18.5–20.0 (native 1440), ~1 fps up | `MAP_THREADS=16` goes backwards (2.8 GB/s at the same spot) — the knee is at 8, as the note in `xmem.rs` predicts. ## Ruled out, with numbers - **`VICTORY_TEXTURE_ROOM_PERCENT=90`**: no frame-time change, VRAM 11.8 → 12.6 GB. - **`VICTORY_TEXSPK_PASS_MS=16`**: no gain, copy-back slightly worse, more reconstruction noise on ground. - **`VICTORY_SMALL_COPY=0`**: a wash on Zen 3 (18.8–20.0 against 18.5–19.6), so the SSE2 path neither helps nor hurts here. - **4k output**: ~100 ms a frame against ~50 at the same internal resolution, GPU still idle — presentation cost only. One intermittent thing, recorded because it is not frame time: distant textures at a fixed island viewpoint flicker out and back at a regular interval on some runs and not others, with no measurable fps cost. Probably residency churn, but I have not caught it with counters yet.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:28:34 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-30 04:28 UTC · original

Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

**@⁠github-actions[bot]** on GitHub · 2026-11-30 04:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3713#issuecomment-7268800379) Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
Author
Owner

@⁠TheBen420 on GitHub · 2026-11-30 04:42 UTC · original

Follow-up with a census from a --features diagnostics build at the same reference spot. This is the answer to "which buffers cost the 20 ms", and it is one buffer.

copied from 0x1f980000+0xae00000 (memory 0x40000): 13.9x/frame, 2529.07 MB/frame, 10.13 ms/frame
copied from 0xe38c00000+0x3200000 (memory 0x40000):  1.0x/frame,   52.43 MB/frame,  0.10 ms/frame
copied from 0xe97f20000+0x2400000 (memory 0x40000):  1.0x/frame,   36.59 MB/frame,  0.04 ms/frame
(next eight ranges are 12-25 MB/frame at 0.02-0.10 ms each)

A single 174 MiB region is copied 13.9 times a frame — 2.5 GB per frame, 10.13 ms of every frame — against 0.4 ms for the entire rest of the copy traffic. Everything else in this report is rounding error next to it.

The same log says what it is:

WARN victory_gpu::port: renderer port 1: title memory not in place, a copy as before
     start=0x1f980000 len=182452224 window=false
     why="not one native-import-eligible stretch of a section: Scattered"
INFO victory_gpu::shadow: a buffer's host copy is in the card's memory start=0x1f980000 len=182452224
INFO victory_gpu::port: renderer port 1 (VICTORY_PORT_CONSTANTS=1): 0 regions of the title's
     graphics memory in place (0 MB)

That is the game's 185 MB heap, which xmem.rs::arrange exists to make one stretch of its section precisely so the GPU side can open it as one heap ("run port1-1: Scattered"). Here the placement still fails and the fallback is the host copy in card memory, refreshed 13.9 times a frame.

So the lever is: make that reservation one stretch, and the largest single cost in the frame goes away. Either arrange is not reaching this mapping on this title build, or its "freshness" test is rejecting pages it should accept. 10 ms of a 50 ms frame lives behind that one why=.

**@⁠TheBen420** on GitHub · 2026-11-30 04:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3713#issuecomment-7269010370) Follow-up with a census from a `--features diagnostics` build at the same reference spot. This is the answer to "which buffers cost the 20 ms", and it is one buffer. ``` copied from 0x1f980000+0xae00000 (memory 0x40000): 13.9x/frame, 2529.07 MB/frame, 10.13 ms/frame copied from 0xe38c00000+0x3200000 (memory 0x40000): 1.0x/frame, 52.43 MB/frame, 0.10 ms/frame copied from 0xe97f20000+0x2400000 (memory 0x40000): 1.0x/frame, 36.59 MB/frame, 0.04 ms/frame (next eight ranges are 12-25 MB/frame at 0.02-0.10 ms each) ``` **A single 174 MiB region is copied 13.9 times a frame — 2.5 GB per frame, 10.13 ms of every frame** — against 0.4 ms for the entire rest of the copy traffic. Everything else in this report is rounding error next to it. The same log says what it is: ``` WARN victory_gpu::port: renderer port 1: title memory not in place, a copy as before start=0x1f980000 len=182452224 window=false why="not one native-import-eligible stretch of a section: Scattered" INFO victory_gpu::shadow: a buffer's host copy is in the card's memory start=0x1f980000 len=182452224 INFO victory_gpu::port: renderer port 1 (VICTORY_PORT_CONSTANTS=1): 0 regions of the title's graphics memory in place (0 MB) ``` That is the game's 185 MB heap, which `xmem.rs::arrange` exists to make one stretch of its section precisely so the GPU side can open it as one heap ("run port1-1: Scattered"). Here the placement still fails and the fallback is the host copy in card memory, refreshed 13.9 times a frame. So the lever is: **make that reservation one stretch**, and the largest single cost in the frame goes away. Either `arrange` is not reaching this mapping on this title build, or its "freshness" test is rejecting pages it should accept. 10 ms of a 50 ms frame lives behind that one `why=`.
Author
Owner

@⁠TheBen420 on GitHub · 2026-11-30 06:11 UTC · original

Numbers from main at 41adb551 (+ a 27-line patch of ours adding VICTORY_GPU_BACK_MAX_KB, below), RTX 4080 SUPER, Ryzen 7 5800X (Zen 3), Win 11 23H2, GTA VI Xbox 1.0.2.1, --res 1080to1440 --dlss dlaa, VICTORY_ALIAS_TARGETS=0 VICTORY_ROOM_REAL=1 VICTORY_AMBIENT_CHROMA_SCRUB=1 VICTORY_RAYMISS_KEEP=1 VICTORY_AMBIENT_SPECULAR=1,0 VICTORY_SOFT_VIEWS=0 VICTORY_MAP_THREADS=8 VICTORY_TEXTURE_ROOM_PERCENT=80, one save, one reference viewpoint, numbers read from the engine's own frame lines over ~30 s holds.

1. VICTORY_PORT_CONSTANTS defaults disagree, and the default state copies 2.5 GB a frame for nothing

The diagnostics build's census in this spot is dominated by one range: copied from 0x1f980000+0xae00000 (174 MiB) at 13.9x/frame = 2529 MB/frame, 10.13 ms/frame; the next largest range is 0.10 ms. The port warns not one native-import-eligible stretch of a section: Scattered.

Cause: victory_gpu::port::on() returns true for non-Ampere adapters, while xmem::port_on() — which gates arrange(), the page reordering that makes a contiguous placement possible — returns false unless VICTORY_PORT_CONSTANTS is set. So out of the box the placement is always attempted and always fails on "Scattered", and the whole 174 MiB section is copied every time it is submitted.

Measured three ways at the same spot:

port state census, largest range fps ms/frame
unset (placement attempted, arrange skipped) 174 MiB at 13.9x/frame, 2529 MB/frame, 10.13 ms 19.4-20.8 48.1-51.5
VICTORY_PORT_CONSTANTS=0 (no placement, no whole copy) 11.9 MB/frame, whole copies 1.25 MB/frame 19.6-20.5 48.7-51.1
VICTORY_PORT_CONSTANTS=1 (arranged: 32-bit graphics pages given their section's slices in address order ... all=2944) whole copies 0 ranges 17.1-18.2 55.0-59.0

So the whole copy is free in wall clock — ~250 GB/s card-side and fully overlapped — and forcing the port actually on costs about 2 fps. There is no prize here, only a wasted 2.5 GB/frame and a default that misleads: VICTORY_PORT_CONSTANTS=0 is the state you want on this hardware, and making port::on() false wherever xmem::port_on() is false would get there without anyone knowing the switch.

2. Copy-back: the stage costs 4-12 ms with zero bytes, and capping it at 256 KiB is the optimum

VICTORY_GPU_BACK_MAX_KB is not in main; I added it here, ported from HotScarlett, in defer_gpu_write (patch below). Curve at the reference spot, everything else fixed:

cap copy-back
256 KiB 11.6-13.3 ms / 0.9 MB
1 MiB 12.7-15.7 ms / 1.3-1.5 MB
4 MiB 15.8-16.3 ms / 1.4-1.6 MB
16 MiB 17.0-17.7 ms / 1.3-1.4 MB

It rises monotonically, and the volume rises with it: more data retained means more forced back anyway. 256 KiB is the knee.

Uncapped against capped on the same binary, same spot, same session, nothing else changed:

cap frame lines (fps / ms) copies copy-back
unset 19.4/51.5, 20.4/49.0, 18.9/53.0, 16.4/61.0 15.4-17.3 ms / 53-57 MB 16.1-17.6 ms / 2.0 MB
256 KiB 16.2/61.6, 17.5/57.1, 16.0/62.6, 14.3/70.0, 14.7/68.1 18.1-25.0 ms / 53-62 MB 13.4-14.8 ms / 0.9-1.0 MB
unset, repeated under the second run's conditions 12.7/78.9, 15.9/62.9 17.3-22.6 ms / 62-78 MB 18.1-26.9 ms

The cap halves the volume, and its time is worth 3-5 ms whenever the title's write traffic is steady (13.4-14.8 ms against 16.1-17.6). It is not a fixed saving: a later launch of the same capped config, in a heavier scene streaming 302 MB of textures, put the stage back at 18.5-21.3 ms, so what the cap buys is bandwidth and residency, not a constant number of milliseconds. It does not take frames out of the copy stage, which is why the two runs do not line up frame for frame: that stage moved 15.4-17.3 to 18.1-25.0 ms with the cap unchanged, after a texture load-in (one frame at textures 20.6 ms / 253 MB) and a heavier per-MB cost. With the copy stage healthy (3.4 GB/s) the capped frames were 46.6-51.2 ms.

VICTORY_GPU_BACK_MAX_KB=0 is not a free win, whatever the "the title never reads back what is copied" claim says. With no copy-back at all the title breaks: textures stretch off the character's head and the sunlight flickers like a candle. The artefacting this reporter came for was unchanged. This title and save do read those ranges.

Also worth having in the issue: with the cap at 0 the stage still costs 4.6-12.4 ms/frame with 0.0 MB of data. The cost is the bookkeeping (watches, batch log, resolving what may be written), not the bytes, so any easy win on this stage is in the records rather than in the transfer.

3. VICTORY_JOIN_PARTS=8 is slower than the default here, and VICTORY_CARD_STEPS finds nothing to do

Both are off in main; I had been running 8 parts and VICTORY_CARD_STEPS=2 from earlier experiments, and going back to the defaults is worth ~10% per draw on this machine:

config fps ms/frame copies copy-back draws
parts 8, card steps 2 17.1-18.2 55.0-58.6 21.0-24.5 ms / 55-62 MB (2.2 GB/s) 13.7-15.7 ms / 0.9 MB 5894-6243
defaults (parts 1) 19.6-21.5 46.6-51.0 14.9-18.2 ms / 56-61 MB (3.4 GB/s) 14.1-14.3 ms / 0.9 MB 5701-5992

Preparing is 38.9-47.5 ms of a 55.0-58.6 ms frame with the parts joined, against 34.9-41.1 ms of 46.6-51.0 at the defaults. Draw-normalised (ms per 1000 draws, since the scene content drifts between runs) that is 9.1-9.9 against 8.0-8.8. The doc for joins() reports the opposite sign (51.4 against 54.8 ms of thread time, dorm, submit-1), so this is worth a matched-draw check on other hardware — but on Zen 3 the joined parts cost the copy stage a third of its bandwidth and buy nothing.

VICTORY_CARD_STEPS reports 0.00 fills, 0.00 buffer copies, 0.0 KB per frame for whole runs at both =1 and =2 (the steps done on the card instead of waiting for flights line), so the 25-30 ms stand described in card_steps.rs is not happening in this title/save as we play it. It is inert here rather than harmful — I mention it only so nobody reads "0.00" as a broken meter.

4. Defaults I tried to beat and could not

Each of these was a separate cold launch at the same spot, >=3 frame lines each:

  • VICTORY_MAP_THREADS=16: copies 2.8 GB/s against 3.4 at 8. The knee is 8.
  • VICTORY_DSTORAGE_WORKERS=32: 14.9-17 fps, clearly worse than the default 16.
  • VICTORY_SMALL_COPY=0 (rep movsb instead of the SSE2 path): a wash on Zen 3, 18.7-20.0 against 18.5-19.6 with a slightly lighter draw count.
  • VICTORY_TEXTURE_ROOM_PERCENT=90: no frame gain, VRAM 11.8 -> 12.6 GB of 14.75. 80% is the better trade.
  • TEXSPK_PASS_MS=16 (default 8): no gain, and visibly more reconstruction noise on ground textures.
  • VICTORY_WATCH_LARGE_XMEM=0: no gain at matched per-draw cost.
  • --res 4k with DLSS quality: ~100 ms/frame at the same internal 2560x1440. Not playable on this card.
  • VICTORY_HEAP_SYNC_AT_SUBMIT=1 and VICTORY_HEAP_SYNC_FIRST=1 are set in every run I quote here, so I am not claiming they beat the defaults - I never isolated them. They are untested rather than recommended; the switch line in each log shows exactly what was on.

Where the 50 ms goes at this spot now: ~41 ms preparing (copies 15-20 ms, copy-back 12-14 ms, textures 1-4 ms), 0.5-3 ms on the GPU, the rest title CPU. The two copy stages are ~80% of the frame and neither is limited by the card, which is the shape of the problem I would chase next.

Patch for the cap, if it is wanted upstream:

--- a/crates/victory-gpu/src/host.rs
+++ b/crates/victory-gpu/src/host.rs
@@ -10806,6 +10806,22 @@ impl HostList {
         address: usize,
         len: usize,
     ) {
+        // `VICTORY_GPU_BACK_MAX_KB=<n>` (ported from HotScarlett): shader writes to
+        // ranges larger than `n` KiB stay on the card without copying back into title
+        // memory (0 copies none; unset copies all as before).
+        static MOST: OnceLock<Option<usize>> = OnceLock::new();
+        let most = *MOST.get_or_init(|| {
+            std::env::var("VICTORY_GPU_BACK_MAX_KB")
+                .ok()
+                .and_then(|v| v.trim().parse::<usize>().ok())
+                .map(|kb| {
+                    tracing::info!(kb, "shader writes of ranges over {kb} KiB are not copied back into title memory (VICTORY_GPU_BACK_MAX_KB)");
+                    kb << 10
+                })
+        });
+        if most.is_some_and(|most| len > most || most == 0) {
+            return;
+        }
         let mut deferred = self.deferred();

Logs for the sections above, one --res 1080to1440 --dlss dlaa play each (the switch line at the top of every file is the full set): https://gist.github.com/TheBen420/2761fa893abb6e97010eca346831d1f0

  • victory-nvidia-play-20261130-060122-1736.log - copy-back uncapped (section 2, first row)
  • victory-nvidia-play-20261130-060345-5296.log - copy-back capped 256 KiB, same binary (section 2, second row)
  • victory-nvidia-play-20261130-053420-17444.log - the config I play with, parts 1 (section 3, second row)
  • victory-nvidia-play-20261130-052834-15628.log - parts 8, card steps 2 (section 3, first row)
**@⁠TheBen420** on GitHub · 2026-11-30 06:11 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/3713#issuecomment-7270398560) Numbers from `main` at `41adb551` (+ a 27-line patch of ours adding `VICTORY_GPU_BACK_MAX_KB`, below), RTX 4080 SUPER, Ryzen 7 5800X (Zen 3), Win 11 23H2, GTA VI Xbox 1.0.2.1, `--res 1080to1440 --dlss dlaa`, `VICTORY_ALIAS_TARGETS=0 VICTORY_ROOM_REAL=1 VICTORY_AMBIENT_CHROMA_SCRUB=1 VICTORY_RAYMISS_KEEP=1 VICTORY_AMBIENT_SPECULAR=1,0 VICTORY_SOFT_VIEWS=0 VICTORY_MAP_THREADS=8 VICTORY_TEXTURE_ROOM_PERCENT=80`, one save, one reference viewpoint, numbers read from the engine's own frame lines over ~30 s holds. ## 1. `VICTORY_PORT_CONSTANTS` defaults disagree, and the default state copies 2.5 GB a frame for nothing The diagnostics build's census in this spot is dominated by one range: `copied from 0x1f980000+0xae00000` (174 MiB) at **13.9x/frame = 2529 MB/frame, 10.13 ms/frame**; the next largest range is 0.10 ms. The port warns `not one native-import-eligible stretch of a section: Scattered`. Cause: `victory_gpu::port::on()` returns true for non-Ampere adapters, while `xmem::port_on()` — which gates `arrange()`, the page reordering that makes a contiguous placement possible — returns false unless `VICTORY_PORT_CONSTANTS` is set. So out of the box the placement is always attempted and always fails on "Scattered", and the whole 174 MiB section is copied every time it is submitted. Measured three ways at the same spot: | port state | census, largest range | fps | ms/frame | |---|---|---|---| | unset (placement attempted, `arrange` skipped) | 174 MiB at 13.9x/frame, 2529 MB/frame, 10.13 ms | 19.4-20.8 | 48.1-51.5 | | `VICTORY_PORT_CONSTANTS=0` (no placement, no whole copy) | 11.9 MB/frame, whole copies 1.25 MB/frame | 19.6-20.5 | 48.7-51.1 | | `VICTORY_PORT_CONSTANTS=1` (arranged: `32-bit graphics pages given their section's slices in address order ... all=2944`) | whole copies 0 ranges | 17.1-18.2 | 55.0-59.0 | So the whole copy is free in wall clock — ~250 GB/s card-side and fully overlapped — and forcing the port actually on costs about 2 fps. There is no prize here, only a wasted 2.5 GB/frame and a default that misleads: `VICTORY_PORT_CONSTANTS=0` is the state you want on this hardware, and making `port::on()` false wherever `xmem::port_on()` is false would get there without anyone knowing the switch. ## 2. Copy-back: the stage costs 4-12 ms with zero bytes, and capping it at 256 KiB is the optimum `VICTORY_GPU_BACK_MAX_KB` is not in `main`; I added it here, ported from HotScarlett, in `defer_gpu_write` (patch below). Curve at the reference spot, everything else fixed: | cap | copy-back | |---|---| | 256 KiB | 11.6-13.3 ms / 0.9 MB | | 1 MiB | 12.7-15.7 ms / 1.3-1.5 MB | | 4 MiB | 15.8-16.3 ms / 1.4-1.6 MB | | 16 MiB | 17.0-17.7 ms / 1.3-1.4 MB | It rises monotonically, and the volume rises with it: more data retained means more forced back anyway. 256 KiB is the knee. Uncapped against capped on the same binary, same spot, same session, nothing else changed: | cap | frame lines (fps / ms) | copies | copy-back | |---|---|---|---| | unset | 19.4/51.5, 20.4/49.0, 18.9/53.0, 16.4/61.0 | 15.4-17.3 ms / 53-57 MB | **16.1-17.6 ms / 2.0 MB** | | 256 KiB | 16.2/61.6, 17.5/57.1, 16.0/62.6, 14.3/70.0, 14.7/68.1 | 18.1-25.0 ms / 53-62 MB | **13.4-14.8 ms / 0.9-1.0 MB** | | unset, repeated under the second run's conditions | 12.7/78.9, 15.9/62.9 | 17.3-22.6 ms / 62-78 MB | **18.1-26.9 ms** | The cap halves the volume, and its time is worth 3-5 ms whenever the title's write traffic is steady (13.4-14.8 ms against 16.1-17.6). It is not a fixed saving: a later launch of the same capped config, in a heavier scene streaming 302 MB of textures, put the stage back at 18.5-21.3 ms, so what the cap buys is bandwidth and residency, not a constant number of milliseconds. It does not take frames out of the copy stage, which is why the two runs do not line up frame for frame: that stage moved 15.4-17.3 to 18.1-25.0 ms with the cap unchanged, after a texture load-in (one frame at textures 20.6 ms / 253 MB) and a heavier per-MB cost. With the copy stage healthy (3.4 GB/s) the capped frames were 46.6-51.2 ms. `VICTORY_GPU_BACK_MAX_KB=0` is **not** a free win, whatever the "the title never reads back what is copied" claim says. With no copy-back at all the title breaks: textures stretch off the character's head and the sunlight flickers like a candle. The artefacting this reporter came for was unchanged. This title and save do read those ranges. Also worth having in the issue: with the cap at 0 the stage still costs **4.6-12.4 ms/frame** with 0.0 MB of data. The cost is the bookkeeping (watches, batch log, resolving what may be written), not the bytes, so any easy win on this stage is in the records rather than in the transfer. ## 3. `VICTORY_JOIN_PARTS=8` is slower than the default here, and `VICTORY_CARD_STEPS` finds nothing to do Both are off in `main`; I had been running 8 parts and `VICTORY_CARD_STEPS=2` from earlier experiments, and going back to the defaults is worth ~10% per draw on this machine: | config | fps | ms/frame | copies | copy-back | draws | |---|---|---|---|---|---| | parts 8, card steps 2 | 17.1-18.2 | 55.0-58.6 | 21.0-24.5 ms / 55-62 MB (**2.2 GB/s**) | 13.7-15.7 ms / 0.9 MB | 5894-6243 | | defaults (parts 1) | 19.6-21.5 | 46.6-51.0 | 14.9-18.2 ms / 56-61 MB (**3.4 GB/s**) | 14.1-14.3 ms / 0.9 MB | 5701-5992 | Preparing is 38.9-47.5 ms of a 55.0-58.6 ms frame with the parts joined, against 34.9-41.1 ms of 46.6-51.0 at the defaults. Draw-normalised (`ms per 1000 draws`, since the scene content drifts between runs) that is 9.1-9.9 against 8.0-8.8. The doc for `joins()` reports the opposite sign (51.4 against 54.8 ms of thread time, dorm, `submit-1`), so this is worth a matched-draw check on other hardware — but on Zen 3 the joined parts cost the copy stage a third of its bandwidth and buy nothing. `VICTORY_CARD_STEPS` reports **0.00 fills, 0.00 buffer copies, 0.0 KB per frame** for whole runs at both `=1` and `=2` (the `steps done on the card instead of waiting for flights` line), so the 25-30 ms stand described in `card_steps.rs` is not happening in this title/save as we play it. It is inert here rather than harmful — I mention it only so nobody reads "0.00" as a broken meter. ## 4. Defaults I tried to beat and could not Each of these was a separate cold launch at the same spot, `>=3` frame lines each: - `VICTORY_MAP_THREADS=16`: copies 2.8 GB/s against 3.4 at 8. The knee is 8. - `VICTORY_DSTORAGE_WORKERS=32`: 14.9-17 fps, clearly worse than the default 16. - `VICTORY_SMALL_COPY=0` (`rep movsb` instead of the SSE2 path): a wash on Zen 3, 18.7-20.0 against 18.5-19.6 with a slightly lighter draw count. - `VICTORY_TEXTURE_ROOM_PERCENT=90`: no frame gain, VRAM 11.8 -> 12.6 GB of 14.75. 80% is the better trade. - `TEXSPK_PASS_MS=16` (default 8): no gain, and visibly more reconstruction noise on ground textures. - `VICTORY_WATCH_LARGE_XMEM=0`: no gain at matched per-draw cost. - `--res 4k` with DLSS quality: ~100 ms/frame at the same internal 2560x1440. Not playable on this card. - `VICTORY_HEAP_SYNC_AT_SUBMIT=1` and `VICTORY_HEAP_SYNC_FIRST=1` are set in every run I quote here, so I am not claiming they beat the defaults - I never isolated them. They are untested rather than recommended; the switch line in each log shows exactly what was on. Where the 50 ms goes at this spot now: ~41 ms preparing (copies 15-20 ms, copy-back 12-14 ms, textures 1-4 ms), 0.5-3 ms on the GPU, the rest title CPU. The two copy stages are ~80% of the frame and neither is limited by the card, which is the shape of the problem I would chase next. Patch for the cap, if it is wanted upstream: ```diff --- a/crates/victory-gpu/src/host.rs +++ b/crates/victory-gpu/src/host.rs @@ -10806,6 +10806,22 @@ impl HostList { address: usize, len: usize, ) { + // `VICTORY_GPU_BACK_MAX_KB=<n>` (ported from HotScarlett): shader writes to + // ranges larger than `n` KiB stay on the card without copying back into title + // memory (0 copies none; unset copies all as before). + static MOST: OnceLock<Option<usize>> = OnceLock::new(); + let most = *MOST.get_or_init(|| { + std::env::var("VICTORY_GPU_BACK_MAX_KB") + .ok() + .and_then(|v| v.trim().parse::<usize>().ok()) + .map(|kb| { + tracing::info!(kb, "shader writes of ranges over {kb} KiB are not copied back into title memory (VICTORY_GPU_BACK_MAX_KB)"); + kb << 10 + }) + }); + if most.is_some_and(|most| len > most || most == 0) { + return; + } let mut deferred = self.deferred(); ``` Logs for the sections above, one `--res 1080to1440 --dlss dlaa` play each (the switch line at the top of every file is the full set): https://gist.github.com/TheBen420/2761fa893abb6e97010eca346831d1f0 - `victory-nvidia-play-20261130-060122-1736.log` - copy-back uncapped (section 2, first row) - `victory-nvidia-play-20261130-060345-5296.log` - copy-back capped 256 KiB, same binary (section 2, second row) - `victory-nvidia-play-20261130-053420-17444.log` - the config I play with, parts 1 (section 3, second row) - `victory-nvidia-play-20261130-052834-15628.log` - parts 8, card steps 2 (section 3, first row)
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA#3713
No description provided.