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
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA#3713
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?
@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:
41adb551from 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,0Logs: 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 thannKiB are not copied back) gave this curve at the same spot: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=0the frame line readscopying back 0.0 MBwhile 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=nonedoes not reach the copies that matterDocumented 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=0withVICTORY_MAP_THREADS=8(soft views force one thread,xmem.rsside_by_side):SOFT_VIEWS=0+MAP_THREADS=8MAP_THREADS=16goes backwards (2.8 GB/s at the same spot) — the knee is at 8, as the note inxmem.rspredicts.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.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-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.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
@TheBen420 on GitHub · 2026-11-30 04:42 UTC · original
Follow-up with a census from a
--features diagnosticsbuild at the same reference spot. This is the answer to "which buffers cost the 20 ms", and it is one buffer.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:
That is the game's 185 MB heap, which
xmem.rs::arrangeexists 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
arrangeis 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 onewhy=.@TheBen420 on GitHub · 2026-11-30 06:11 UTC · original
Numbers from
mainat41adb551(+ a 27-line patch of ours addingVICTORY_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_CONSTANTSdefaults disagree, and the default state copies 2.5 GB a frame for nothingThe 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 warnsnot one native-import-eligible stretch of a section: Scattered.Cause:
victory_gpu::port::on()returns true for non-Ampere adapters, whilexmem::port_on()— which gatesarrange(), the page reordering that makes a contiguous placement possible — returns false unlessVICTORY_PORT_CONSTANTSis 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:
arrangeskipped)VICTORY_PORT_CONSTANTS=0(no placement, no whole copy)VICTORY_PORT_CONSTANTS=1(arranged:32-bit graphics pages given their section's slices in address order ... all=2944)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=0is the state you want on this hardware, and makingport::on()false whereverxmem::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_KBis not inmain; I added it here, ported from HotScarlett, indefer_gpu_write(patch below). Curve at the reference spot, everything else fixed: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:
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=0is 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=8is slower than the default here, andVICTORY_CARD_STEPSfinds nothing to doBoth are off in
main; I had been running 8 parts andVICTORY_CARD_STEPS=2from earlier experiments, and going back to the defaults is worth ~10% per draw on this machine: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 forjoins()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_STEPSreports 0.00 fills, 0.00 buffer copies, 0.0 KB per frame for whole runs at both=1and=2(thesteps done on the card instead of waiting for flightsline), so the 25-30 ms stand described incard_steps.rsis 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,
>=3frame 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 movsbinstead 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 4kwith DLSS quality: ~100 ms/frame at the same internal 2560x1440. Not playable on this card.VICTORY_HEAP_SYNC_AT_SUBMIT=1andVICTORY_HEAP_SYNC_FIRST=1are 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:
Logs for the sections above, one
--res 1080to1440 --dlss dlaaplay each (the switch line at the top of every file is the full set): https://gist.github.com/TheBen420/2761fa893abb6e97010eca346831d1f0victory-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)