Profiling notes on an RTX 3090 Ti: what limits the frame, and what did not help (measured) #2098
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#2098
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?
@gioeleBrancaleoni on GitHub · 2026-11-29 09:29 UTC · original
Sharing measurements from two days of profiling, in case they save someone the same runs. All numbers are from a
branch of 2026-11-27/28 (before the big 11-28 integration), so some may have moved since; the method and the
negative results should still hold.
Setup and method
frame-statswith the first 150 s leftout; Series S profile (1080p) and Series X profile (1440p, DLSS Quality). REFLECTION ESTIMATE on.
session ~3 fps: only same-session comparisons count.
Nsight's own MCP server (
ngfx-mcp.exe, stdio) to attribute metrics to marker ranges. CPU: the diagnosticsbuild's timeline (
VICTORY_TIMELINE).The one change that helped:
VICTORY_CARD_AWAKE=0Same conclusion as
42c064de, measured independently:With it off the card stays at full clocks anyway (nvidia-smi every 0.5 s through a run: 1995-2000 MHz, P0, no
throttle reasons), so "prefer maximum performance" adds nothing here.
What the GPU is doing (Series S, spinner off)
~5,200 dispatches and ~1,000-3,000 draws a frame.
title's own barrier groups (~720), batched clamp passes (~150), copies (alias copies ~75, uploads). Lazy texture
transitions mostly share the sync point of the barrier before them.
are not. Not PSO changes (same-PSO executions stall alike), not count buffers (the title's executions are one
record, no count). Some mesh draws run 100-300 us at 2-20% SM (one mesh program is 15k DXIL lines, long-scoreboard
bound).
most that, minus ~10 cross-queue waits a frame (
VICTORY_ASYNC_QUEUE=plan: ~8 of ~16 submissions a frame comefrom the compute queues).
What the frame waits for (CPU timeline at 4 moments per profile)
The chain each present waits for runs mostly through the title's own threads (8-19 ms a frame, its native code), a
DirectStorage worker during streaming bursts (41 ms in one stretch in one sample) and, in some samples, the card
(7-16 ms). The submitting thread is busy (~20-30 ms of work a frame) but is rarely on that chain, so pipelining it
would lower its busy time without shortening most frames (we designed it and shelved it after this measurement).
Tried and measured, no gain (same session, ±1 fps noise)
VICTORY_GROUP_SYNC=0(unsafe)VICTORY_SHADER_OPT=127VICTORY_WIDE_THREADS=6/8VICTORY_WIDE_SPIN=100/300VICTORY_JOIN_PARTS=16VICTORY_HELPER_PRIORITY=2VICTORY_THIN_THREADS=4/6/12(default 8)Texture lateness
With
VICTORY_TEXTURE_STAGE_MS=16andVICTORY_TEXTURE_CATCHUP=0the queue of textures picked by index holds1,200-1,900 due slots on average and 7,000-9,000 at the 95th percentile; the oldest due slot waits 100-200 frames on
average and up to ~600; first servings come 4-9 frames late on average, up to 400+. Same session:
VICTORY_TEXTURE_CATCHUP=1VICTORY_TEXTURE_STAGE_MS=32So catch-up helps (as play.rs now has it) at no fps cost, a larger plain budget does not, and the peaks at scene
changes stay high. These lateness numbers vary a lot between runs (scene timing), treat them as a trend.
Tools, if useful upstream
ngfx.exe --platform ...is taken by Qt as its own-platformoption and fails; leave it out) and a small stdio client for
ngfx-mcp.exe(protocol 2026-07-28,_metawithprotocol version / client capabilities / client info on every request) that attributes WFI stall, go-idles, SM
throughput to marker ranges.
VICTORY_MARKERS=1(each noted command opens a marker range named by itskind, so a trace sums time and stalls per kind), the card's own stamps split by the title queue that sent each
submission, barrier/transition census by host state pair, the submitting thread's list steps timed by kind.
Happy to port them onto current main if wanted.
@github-actions[bot] on GitHub · 2026-11-29 09:29 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)
@gioeleBrancaleoni on GitHub · 2026-11-29 12:16 UTC · original
Update: what limits the frame here (stack profile), and upstream main
829188e9measured on the same PCSame PC as above (RTX 3090 Ti, 9800X3D, 32 GB, Windows 11 24H2), 6-minute opening runs,
frame-stats -SkipSeconds 150, same session for every comparison.1. The title waits for our fence signals (the diag timeline hides it)
VICTORY_PROFILE=200,230,5,<file>(diagnostics build), stacks named with dbghelp against the diag PDB and the title image disassembled withdumpbin /disasm:monitorx/mwaitxloop (image+0x4fb0ac4..+0x4fb0c27, Series S) on a 64-bit value whose address comes from a virtual call at slot0x60of a fence, i.e. ourfence::gpu_address(it waits untilvalue - targetis non-negative, with a yield when themwaitxtimer runs out). Another ~15 % is a kernel wait.queue::behindlane, ~90 % insideHost::submit) and the list workers.The diag timeline only sees fence polling through
GetCompletedValue, so this direct memory polling looks like the title's own work there; earlier we concluded from timelines that "the title's threads are the chain" — that was wrong. The release frame lines agree with the profile:prep~19 ms +copy~7 ms a frame on the submitting thread ≈ the whole 25.6 ms frame (Series S, ~39 fps), waiting on the card ~1.4 ms.Causality check: a local, temporary spin at the start of
Host::submit(500 µs a submission, ~5-8 ms a frame) took Series S from 38.0 / 40.0 fps to 32.0 (frame ~25.6 -> ~31.3 ms), so the frame follows the submitting thread almost 1:1. Overlapping the preparation of submission N+1 with the sending of N (or taking work off that thread) is where the frame rate is, not the title's threads and not the card (gpuwait ~1.4 ms a frame).(Side note: one run with a 250 µs spin ended after 3 min with a host command list that did not close,
0x80070057, thenDXGI_ERROR_DEVICE_REMOVED— looks like a latent timing-dependent bug; not chased yet.)Where the submitting thread's time goes (inclusive, diag build, Series S):
shadow::wide19.5 %,Host::take_steps9.9 %,Shadow::merge_under_writes8.3 %,watch::ask_once/ask_ahead/ask_run~8-13 %,Batch::update7.2 %,Shadow::update6.9 %,host::read5.4 %,land::Pool::each4.9 %,copy_mapped4.3 %.2. upstream main
829188e9on this PCf3534e6b+ 19 fixes picked from main)829188e9829188e9does not start:XMemVirtualAlloc refused size=6538919936 kind=0x42000 flags=0x23 (os error 8), then the title's breakpoint at+0x1e6c284. Our branch starts Series X every time on the same PC.VICTORY_AMBIENT_SPECULAR): not caused byVICTORY_BVH_MISS(=0: same) nor by the HDR clamp / NaN scrub (VICTORY_HDR_CLAMP=0 VICTORY_COMPOSE_NAN=0: worse, green noise over the whole window).f3534e6bis clean in the same scene, so the regression is in f3534e6b..829188e9 (minus the fixes we picked:e530c0033f6ba0113a9f195b71add4c9cfa18bfbc8f08560, which do not bring it).E_OUTOFMEMORY(0x8007000e) on829188e9here: 137-315 such log lines per Series S run (44 distinct pipelines in the first run); 0 in each of the 20 runs of our branch today.3. Measured, no gain here
9a8249b2(descriptorVIEW_SHAPESlock split), ported onto our branch: S 37.9 / 38.4 vs 38.1 / 40.4 without, X 32.6 vs 33.8, low5 a little worse. The descriptor lock is not where the time goes on this machine.3269180b(counting allocator diagnostics-only): our branch already hadcopystatbehinddiagnostics, nothing to gain.aee4c45a564a46d24f5ae578e205498c6ea4529f74d6f240879558a33f054e46e530c0033f6ba0113a9f195b71add4c9cfa18bfbc8f08560def7cda60f0c2ad85b7ce88bc0ab82aa96270e51) applied cleanly and cost nothing (S 39.2 vs 39.2/38.8).Happy to share the profile tooling (a dbghelp symbolizer and a script that splits samples by waiting/working per first own frame) if useful.
@trustno1-coder on GitHub · 2026-11-29 20:36 UTC · original
This issue has the start-up crash where Windows refuses the game's 6.5 GB reservation (
XMemVirtualAlloc refused size=6538919936 ... os error 8, then+0x1e6c284). v2026.11.29.04 is a build with only one fix aimed at exactly this crash.We couldn't reproduce the real crash here, so it may not fix it for you. Please try it and tell us here whether the game now starts, and attach the play log and crashes.log either way. If the play log has a line with
no room at first in the title's window, include that line; it tells us whether this was the cause.@gioeleBrancaleoni on GitHub · 2026-11-29 20:49 UTC · original
Tried v2026.11.29.04 (
f72cec77, release build, Series X profile, same PC: RTX 3090 Ti, 9800X3D, 32 GB, Windows 11 26100.8737). The game now starts on Series X.XMemVirtualAlloc without write watching (the title's own address, or a placeholder) at=0x1800000000 size=6538919936 kind=0x42000 flags=0x23.no room at firstline in the play log.It then ended at 3 min 25 s, with a different error:
crashes.log holds only that host GPU failure line. Full logs not attached (they name the title and local paths); happy to send specific lines.
This close failure is not specific to the XMem fix. Our own branch (
f3534e6bbase) hits the same error at the same moment of the opening, ~3:20-3:25 in. It is timing-dependent there: about 1 run in 5-8 in our normal configuration, and every run with settings that change the submitting thread's timing (VICTORY_SUBMIT_FRAMES=2, preparing ahead, CPU load).@gioeleBrancaleoni on GitHub · 2026-11-29 21:52 UTC · original
Found the command behind
a host command list did not close (0x80070057)(the 3:20-3:30 crash on Series X, also in v2026.11.29.04).How: a journal of every D3D12 call recorded into each host list (a per-object method table on the list, the call and its key arguments in a ring), written out when
Closefails, in a release-timing build (the diagnostics build is too slow to hit it). Two full lists caught, 71 and 176 commands.The bad call, same in both:
The second copy of each pair comes from the
placed_twinsloop inlist.rscopy_texture_region: a title copy into a texture is repeated into every view placed over the destination's memory.resource::placed_twinsmatches those views by block size only, so a BC7 view placed over BC3 blocks (both 16-byte blocks) is a twin, and gets a BC3 -> BC7CopyTextureRegion. D3D12 refuses copies across format families; without the debug layer the list is just marked invalid andClosereturnsE_INVALIDARG, then device removed.It is timing-dependent because the twin only exists while that BC7 view is alive: with
VICTORY_SUBMIT_FRAMES=2(and preparing ahead) it is almost every run on Series X here, about 1 in 5-8 in the default configuration.Fix (our branch, small): in that loop, a twin whose host format is of another family than the destination's is not copied into; it takes the destination's levels through a buffer at its next use, with the existing
texture::seed_later/seed_pendingpath (the one already written for "a BC3 texture's blocks read as BC7"). TheCopyResourcetwin loop already skipped other families, but then left the twin stale; it now reseeds it the same way.Result (Series X, settings that crashed nearly every run): before, 2 of 3 runs with the journal ended in this error (and all earlier runs with these settings that evening); with the fix, 3 of 3 ran the full 6 minutes, no close failure. The new path fired in each run, and not only for BC7: twins of formats 98 (BC7_UNORM), 99 (BC7_UNORM_SRGB) and 95 (BC6H_UF16) over BC3_UNORM_SRGB (78) destinations.
Happy to open a PR with it if you want it.
@gioeleBrancaleoni on GitHub · 2026-11-30 08:22 UTC · original
More measurements (Series S profile, RTX 3090 Ti + 9800X3D, opening of a new game, our branch with the twin fix above). Two findings that may save someone time, and one place where the submitting thread loses ~half of its refresh time.
1. There is no ~40 fps cap: frame time follows the submitting thread's preparing. Run means sat at 40-41 fps whatever we changed, so we looked for a cap. The per-5 s frame-rate lines show none: 16-58 fps by scene, and frame time tracks the "preparing" ms of the same line closely:
(The "GPU" column stays at 0-7 ms.) The 150-290 s bench window is the letterboxed opening cinematic, a mix of these. Moving preparing to another thread (prepare N+1 while N is sent,
SUBMIT_FRAMES=2) never changed fps here; only less preparing work will. Comparing per-5 s lines of the same scene shows gains that run means hide.2. Things measured with no effect on S (each A/B in one session, ±1 fps noise):
VICTORY_UAV_DROP=all, DLSS performance vs quality,VICTORY_DSTORAGE_PRIORITY0/1,VICTORY_WIDE_THREADS=8,VICTORY_WIDE_SPIN=100,VICTORY_ASYNC_QUEUE=plan,VICTORY_FSR_FRAMEGEN=0(plain swap chain; presents are not vsync-bound, loading screens log 500+ fps),VICTORY_FRAME_INTERVAL_MS=1(the title's own rate patch;play-foxhound.ps1only setsVICTORY_FRAME_INTERVAL_US, so that patch is never applied by the launcher: +0-1 fps, not a cap).VICTORY_INPLACE=1is much worse (30 vs 41 fps, GPU 13 ms: shaders reading system memory over PCIe).3. Where the refreshes' time goes (release counters, gameplay mean per frame, all threads summed):
Shadow::update_free: 27.6 ms asking the write watch (watch::writes), 6.3 ms copying 65 MB of written pages (44,000 blocks, ~10 GB/s, fine).watch::writes: 20.3 ms inguard()(252 calls, ~80 µs each); answered ahead/published 1.0, waiting inAsking::hold0.6,GetWriteWatch0.6, noting 1.2.guard(): is-it-a-view 0.8, holes asked (uncommitted_end/is_view) ~0, protect/cover loop 5.9, and ~13 ms of the "clean check" spent waiting for the guards'Mutex(guards_timed()beforeg.clean.range(first..last).count()). The count itself is cheap.So the 4 wide threads plus the submitting thread mostly queue on one lock. Its holders are the other refreshes'
protect()/cover()loops, which callVirtualProtectwith the lock held (~750 calls, ~3.5 ms a frame), and the fault handler. We tried a lock-free copy of the clean bits for an "all clean" early answer, but it almost never applies (nearly every asked range has written blocks), so no gain. The next thing we will try is to change protections outside the guards' lock (thePROTECTEDbits are already set ahead of the change) and to join runs into fewer calls. Ideas welcome if you know why it has to stay under the lock.