Repository navigation
[pr-performance] [memory] [startup] [NVIDIA] Reduce texture memory pressure and cold-load stalls - #1794
[pr-performance] [memory] [startup] [NVIDIA] Reduce texture memory pressure and cold-load stalls#1794dapasko wants to merge 17 commits into
Conversation
… priority (cherry picked from commit bc6a02a)
(cherry picked from commit 0a95e26)
… one instead of aborting the process (cherry picked from commit 5d93fde)
Use the freshly translated shader if cache publication fails. Existing callers can still request a path, and cache publication remains atomic. Co-Authored-By: Codex <codex@openai.invalid> (cherry picked from commit 4fd7f4d)
…y per worker (cherry picked from commit aa4ab86)
…39f0 translate 25 s to 2.6 s) (cherry picked from commit 12b4080)
(cherry picked from commit 85d3c36)
A request's source, its zlib intermediate and the buffer of a write to scattered pages were each vec![0; size], faulting in all their pages again for every request. A worker now keeps up to three spare buffers of at most 32 MiB (VICTORY_DSTORAGE_BUFFERS, on), zeroed before reuse, and all workers together keep at most 256 MB of them (VICTORY_DSTORAGE_BUFFER_BUDGET, in megabytes, 0 for no bound): 16 workers by 3 by 32 MiB could hold 1.5 GB for the run in a process the PC has little memory left for. A buffer that does not fit is freed at the end of its request. Tests: a spare buffer is reused (same memory), zeroed again, counted while kept and not kept past the most a worker keeps; a worker keeps three spare buffers at most; the budget bounds what all workers keep, counts a buffer again when it leaves, and is no bound when 0. (cherry picked from commit 5b7ce88)
…AVE_FOLDED, on) Two console lanes per host lane: a 64-lane wave runs as one 32-lane host wave, VGPRs in pairs, SGPRs shared, lane masks as two 32-bit ballot words and the scalar control flow native. Ballots, readlane, mbcnt, LDS within a group and lane masks behave as on the console. Programs that cannot be folded keep the forms they had before. On the shaders of this title (RTX 5070 Ti, before trustno1-coder#35, trustno1-coder#43 and trustno1-coder#52): "no wave32 lowering" refusals 22 -> 1, 175 programs exact. In the opening cutscene the staircase shadows on characters go, and moving characters no longer leave dotted trails (they come back with VICTORY_WAVE_FOLDED=0). Two faults found with the hair and fixed, with GPU tests: - a VALU writing the SGPR pair it also reads (v_cmp_eq_i32 s[0:1], s0, v0): the high half now goes first, and a program whose halves overwrite each other's input is not folded; - s_or_saveexec_b64 -1 reopening EXEC after lanes left through v_cmpx / s_cbranch_execz: branches on EXEC are taken wave-wide in such a program. CS_HairTileClassify had both: beards and curly hair came out in patches. VICTORY_WAVE_FOLDED_SKIP / _ONLY (name or hash prefixes) pick programs, for bisecting. VGPR numbers are u16 (folded pairs pass 255): the new LDS analysis of trustno1-coder#43 and the ray intersection add to them in u16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 8f0a0c2)
…in room-line admission (cherry picked from commit f0c5d59)
A host list kept the scratch buffers of its busiest recording for good (`batch_args` was only pushed to). With about 1,500 lists alive that was 12,719 buffers in eight minutes of play on an RX 7800 XT (16 GB) with VICTORY_INDIRECT_BATCH=1: 3.2 GB of the card by the system's count (256 KiB a buffer), past its budget, and 200 ms a frame on the card from there. No counter saw them, so nothing could let them go. Now a list gives them back when it is reset (every submission of it has run, and its last recording left them in the common state), and the next list to batch takes them, as scratch chunks and preludes already do. 512 are kept; more than that are retired. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KfgN1FfW7f4Zv2hqXUsNr2 (cherry picked from commit e6bda10)
… own, not without limit (trustno1-coder#628) trustno1-coder#243 made a dispatch make its compute pipeline on the asking thread, one after another and with no limit. A fresh build's first start, with most compute pipelines new, then held a frame past the title's 30 s watchdog while it loaded and stopped with a null write at +0x23cf683: every first start on 923e38c, bisected to the merge of trustno1-coder#243 (trustno1-coder#628). A dispatch now waits as a draw does, in `wait`, with a budget of its own: VICTORY_COMPUTE_WAIT_MS, 10 s a frame (the screen passes' 10 s beside it, below the watchdog), while the workers make the pipelines side by side. trustno1-coder#243's case, a compute program first met at a scene change taking a few seconds, is still waited for, not dropped. VICTORY_PIPELINE_COMPUTE_WAIT=0 still means the draws' half second. A dispatch waited for more than half a second is logged. RTX 3090, i9-14900K, Series S, frozen save, fresh build each time: - main d4b5d51: first start crashed at +0x23cf683 (7 of 7 on 923e38c-based builds) - this: 3 of 3 first starts reached the world, 9-12 dispatches waited (the longest 10 s each); one more start sat at the menu (no input) - victory-gpu tests: 550 passed (the test that expected trustno1-coder#243's inline make now expects the budgeted wait) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit e60fe0e)
(cherry picked from commit f23ddf5)
… sweep is active (cherry picked from commit 3246d25)
Adapt the eviction fixes from trustno1-coder#1763. Pin the guest texture and the host copy through descriptor eviction, and recheck the slot before clearing it.
…N ms once, by stage (not submitted, not started and what holds it, running, status held behind earlier reads, enqueue waiting on a full queue), and again with its whole age when it moves on (off by default; for the 30 s load stalls) (cherry picked from commit 85c7e51)
|
Tested on a 16 GB card, since the description's testing was on an 8 GB RTX 4060. System: RTX 4080 16 GB, driver 621.40 · Intel i5-10400, 32 GB · Windows 11 build 26300 One run each, and the routes were not identical (draws a frame averaged 6,406 in the baseline and 4,433 here), so treat the fps numbers as indicative.
The clearest result is the last rows: in the baseline the card went over its budget about 9 minutes in, and from then on DLSS failed with "out of VRAM (39)" (the output keeps what it had) and frame generation stopped producing frames. With this PR neither happened in 14.8 minutes, and frame generation showed 1.9 frames for each one rendered. The texture queue is busier (more uploads a minute, a higher peak waiting) but never logged "no room". One thing for the rebase: on this head, without the movie gate change from main ( Logs available if useful: |
What it changes
This integration is based on
d4b5d51. The commit history keeps the individual changes and credits the original PRs.The due-frame texture index from #1497 is opt-in with
VICTORY_DUE_INDEX=1. It uses the same first-upload and recheck priorities as the flat queue. SetVICTORY_DSTORAGE_STUCK_MSto enable the DirectStorage stall monitor.How it was tested
VICTORY_HOST_WAVE=32. This branch created 3 of 3, including6b82bc7d22016cb5, which previously reportedno wave32 lowering.cargo test --release --locked -p victory-gpu -p victory-hle --lib -- --test-threads=1passed 568 GPU tests and 205 HLE tests. The checks cover texture byte accounting, simultaneous VRAM and host pressure, bounded compute waits, and parity between the flat and indexed texture queues.VICTORY_DSTORAGE_STUCK_MS=1, verifying that the monitor tracks and clears both requests.Gameplay FPS, peak VRAM and time to reach a save still need a matched in-game A/B. The changes affect texture residency, pipeline scheduling and graphics resource lifetimes. They can be reverted without a save migration.
Checked for overlap
AI-assisted integration and verification. Hardware results above are from the submitter's Windows machine.