Skip to content

VIctory performance (RTX 5060 8 GB): submit thread, textures, and memory - #2334

Draft
Castyan wants to merge 62 commits into
trustno1-coder:mainfrom
Castyan:pr/rtx5060-8gb-perf
Draft

Castyan wants to merge 62 commits into
trustno1-coder:mainfrom
Castyan:pr/rtx5060-8gb-perf

Conversation

@Castyan

@Castyan Castyan commented Nov 29, 2026 •

Copy link
Copy Markdown

Fixes #597.

Changes

  • Launcher defaults. Disable the texture pool by default on GPUs with 8 GB of VRAM or less, raise helper priority while leaving list translators at normal priority, and use finer host-copy windows on PCs with 16 GB of RAM or less. Explicit user settings take precedence.
  • Submit thread and copy refreshes. Add opt-in paths for refreshing copies ahead of submission on multiple threads, plus diagnostics for stale copies and memory waits.
  • Textures, VRAM and RAM. Add configurable texture budget headroom, eviction of idle textures, on-demand CPU memory for selected copies and memory diagnostics in release builds.
  • Measurements. The test reports remain with the engine changes. The benchmark tools have their own PR, Benchmark tools: compare VIctory play sessions and sample memory #2571.

Tests on RTX 5060 8 GB, Ryzen 5 9600X and 16 GB RAM

Over the first 7 min 31 s of runs H and I on v2026.11.29.01, median FPS was 12.3 with this PR and 10.3 with the stock release. Submit-thread time was 94.5 versus 120.1 ms per frame. Each configuration was played once and the routes were similar. Run J, with 4 MiB copy windows, produced 12 stale-copy warnings and one DLSS VRAM warning.

git diff --check passed. The repository-wide asset policy flags an existing sequence of hexadecimal literals in crates/victory-loader/src/heap_sites/frame_users.rs. That file is identical on the base.

castyan27 and others added 23 commits November 29, 2026 12:41
The pool's 64 MB blocks held ~1 GB of holes on an RTX 5060 8 GB: out of
VRAM from 1:51, DLSS failing, device lost at 8:25 (trustno1-coder#597). Pool off on the
same PC: no out of VRAM, no crash, world fps median 15.5 -> 17.8.

`victory play` sets VICTORY_TEXTURE_POOL=0 when the playing card
(hardware_adapter) has 8 GB of its own or less, before the F1 menu's and
--set's switches, which still win. play-foxhound.ps1 does the same from
the display adapters' registry memory. pool.rs is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 316c8b8cdc4f05483da4fde9067a58537851c749)
(cherry picked from commit aa36a0a91f65c00d3d519d0eecd6b9e42a4dc342)
…tors at normal

As a number (1) the value was also given by cores::ask to the eight list
translators, level with the submitting thread; helpers_raised's doc and its
i5-12400F measurement want them below the helpers. A user's value still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8c3b3ccf8f897265ed8c14cb7bc73642f5fee503)
…BMIT=1, off by default)

A submission waits some ten deep in the VICTORY_ASYNC_SUBMIT line before the
submitting thread prepares it, and refreshing the copies its lists read was
the largest part of that preparing (14.7 ms a frame in the world, 41 ms in a
new area; docs/refresh-ahead-study.md). With the switch a thread of ours,
victory-refresh-ahead, takes each submission once its lists are translated and
refreshes its copies up to the first step that writes title memory. The
submission still asks and refreshes as before, and finds those pages taken.

Phase 1 takes only copies on the CPU's side, write-watched or guarded, never
written by shaders, with no range shaders may be writing.

Safety:
- The line claims a submission just before it unfolds it (where its host
  lists are taken out of our lists), outside the line's lock. The thread then
  leaves it alone, and the line waits for it to stop if it is working on it.
  Until then the recordings it holds keep our lists and their host lists.
- A copy's new `refreshing` lock is held by Shadow::update and by
  Shadow::gpu_writes (where a copy becomes one shaders write). The thread
  try-locks it and checks the copy again under it.
- The thread never takes jobs from the shared helper pool (shadow::alone), so
  it cannot wait for a job that waits for the lock it holds.
Without the switch no lock is taken and nothing is posted.

One line per frame says what was refreshed, found unchanged, left to the
submission, and how many submissions the line reached first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 41c4aa3751ff00d4391d1cd0d5e8974bddf3e729)
(cherry picked from commit e6bb19a0bbae29bb816e7a69c4b8d854f80b7494)
…CPU's own copy

Guarded view memory is left to the submission. The submitting thread opens a
block's guards before it copies into title memory there, and a refresh beside
it could guard the block again in between and never hear of that copy. The
kernel's dirty bits see every write made in the CPU, so the switch also needs
VICTORY_SAFE_COPY (on by default), not the kernel's own copy. Also fixes the
frame line's text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0c5bc93936ffda1f9ed942644b279122f6d2de6d)
(cherry picked from commit 95ec197047966c1f503bf1d7c2f903fb8aefa3d3)
…y too, and why copies are left out

Play log 20261128-230735: in a scene change the thread refreshing at the
title's submit took 70-130 copies a frame out of some 5,000. It left the rest
to the submission because they are copies in the card's memory (3,755 of
them). The submission's own refreshes already run on the kept threads
(5,000-10,000 a frame "on several threads").

- VICTORY_REFRESH_THREADS=<n> (2 to 8; 1 by default, as before): a
  submission's copies are spread over n threads of this module's own. The
  threads never take the shared pool's jobs (shadow::alone), and the line's
  claim still waits until none of them is at the submission.
- VICTORY_REFRESH_AT_SUBMIT=2: copies in the card's memory too. Their CPU side
  is brought up to date, and what changed is noted to go up from the
  submission (Host::card_before), as the submission's refresh does. A copy is
  left to the submission if it has its bytes from before (compared on the
  card, declared or looked at through views picked by index) or was ever
  landed in, or if VICTORY_UPCHECK is on.
- The `refreshing` lock is now also taken by Shadow::writing (ranges shaders
  may be writing, declared also through picked views without gpu_writes) and
  by card_make_before. The check under the lock thus sees every way a copy
  becomes one the card writes.
- The frame line splits what is left out (written by shaders, in the card's
  memory, guarded views, not write-watched, busy) and the time (walking the
  steps, looking whether anything is new, refreshing, the longest refresh).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3c8b9f7ce4708370d3a9abb39481dba3d2cc02f2)
…refreshes at submit took it

Play log 20261128-232925 had two copies stale three refreshes in a row
(loose windows of 4 MB, on_the_card=false). Nothing in the line said whether
the refresh at the title's submit had touched them. The line now gives:
- the copy's watch state: 1 the kernel's write watch, 2 none, 3 guarded;
- how many refreshes at the title's submit took it so far;
- whether the refresh that found it stale was one;
- and the thread it ran on.
Phase 1 takes only kernel-watched copies (watched=1), so watched=3 or
ahead_refreshes=0 clears it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 32bba05e3ead1fa38423025c4700712b5dea4096)
…memory not waited for, wider refreshes at submit

Four switches, all off by default:

- VICTORY_BURY_ASIDE=1: what finished submissions held is let go of on a
  thread of its own (victory-bury). At 00:02:08 and 00:02:50 the relay spent
  590-980 ms a frame in "the rest" of its landing, which is bury() and the
  message queue, while the card was 5-9% busy. The submitting thread waited
  470 and 835 ms for that landing ("waiting for flights"). The landing line
  now gives bury's share of "the rest".
- VICTORY_WAIT_RESIDENT_UPLOADS=0: upload-heap buffers are made resident with
  their creation, not made resident and waited for. The wait is for slots of
  our descriptor heaps that lists sent earlier may read; no slot shows upload
  memory. A new line per frame gives the waits for new memory (made resident,
  mapped) by the thread that waited: submitting thread, list translators,
  relay, helpers, others of ours, the title's.
- VICTORY_REFRESH_WHOLE=1: the refreshes at the title's submit walk all of a
  submission's steps, not up to the first that writes title memory. Those
  steps run after the line's claim, and the kernel's dirty bits, the guards'
  faults or the journal see what they write, so the submission copies those
  pages again. At 23:56:40 the walk saw some 860 of 10,273 refreshes.
- VICTORY_REFRESH_GUARDED=1: guarded view memory too. A write of ours there
  after a refresh guarded the block again faults into the guards' handler,
  which comes first also inside safecopy, notes the block and lets the copy
  go on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b4d55b7b47437ff73c9b8fd233dc5c96a1da230d)
…s play-foxhound.ps1 does

victory.exe play now sets VICTORY_WINDOW_KB=1024 VICTORY_WINDOW_TAILS=1 when the PC has
16.5 GB of physical memory or less, unless the menu or --set names them. On a 16 GB PC with
an RTX 5060 8 GB the game committed 17 to 18 GB and paged up to 270,000 times a second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en 5 9600X, 16 GB)

scripts/bench.py compares play logs side by side; scripts/bench-run.ps1 plays the same start
once per variant; scripts/mem-watch.ps1 samples victory.exe's memory every 5 s. The docs hold
the test plan, the runs A to G, the study of refreshes at submit and the threads census on 6 cores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…copy moved, and where refreshes go

Play log 20261129-103901: one copy stale three refreshes in a row, refreshed
by victory-refresh-ahead-3. It was a 4 MB window of title memory outside
buffers, kernel-watched, at 0x98bc00000. Its block 0x98beb0000 is the one
found stale in play log 20261128-232925 too, where the refresh at submit was
phase 1 only (no VICTORY_REFRESH_WHOLE). All three copies found stale so far
are such windows. Nothing in the journal's paths explains it.

- The refreshes at the title's submit leave windows outside buffers to the
  submission (VICTORY_REFRESH_WINDOWS=1 takes them as before), counted on
  their line.
- The stale warning says whether it is the same copy each time, and whether
  the copy or title memory moved since the last refresh that found the block
  so. If the copy moved, something other than a refresh wrote it (the card,
  in place or through an undeclared view). If title memory moved, a write
  went unnoticed.
- A frame line gives the submission's refreshes on all threads: copies looked
  at for something new and the time of it, against copies refreshed and
  theirs. In this log the latter look like most of the 19 ms (some 940
  copies, 34.6 MB a frame), not the 8,000 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frame line's "dropped without a host pipeline" counts every draw,
mesh dispatch and dispatch not run on the host, whatever stopped it: in a
new area (run 20261128-235457) 2,300 to 2,900 a frame with no pipeline
being made. Each failure point now notes its cause on its thread and the
drop counts under it: no pipeline bound, left out, being made, a shader
that does not translate, refused by the host, another kind, binding,
no free slot for a root view, index buffer without a host copy, the
ray-tracing builder off, other. Always on: one thread-local write per
prepared draw, one atomic add per dropped one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…issing without it, the binding failures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NVIDIA, compacted sizes answered)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For the memory line (paging in play log 20261129-110820: 18 GB private on
16 GB of RAM). live_bytes() gives the copies alive and their bytes in the
PC's memory and on the card. Of each it gives what only serves to compare:
snapshots in use (a new counter, SNAPSHOT_BYTES) and the snapshot buffers
kept for reuse, and on the card the pieces' hashes. The refreshes' frame line
says them too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… gaps a lost line break left

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is unwritten

The pass over textures picked by index spent 959 ms of a 5-second line
(23:54 run of 2026-11-28, RTX 5060 8 GB, on a list-translating thread)
reading whole textures and hashing them to learn that the host copy
holds them still.

When the bytes are found the same, the write-watch asking made before the
read is kept with what the host copy held (texture, first level, hash,
memory, bytes). Later, while no page of that memory is noted written after
that asking, the answer is "same" without a read. Memory the watch does
not know (writes() None: views) is read and hashed as before, and so is
any copy whose level, hash or memory changed. (Run 2026-11-29 10:39: the
part fell to 0-200 ms a 5-second line.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…MARGIN_MB, off by default), idle textures make way, 5-second line of the card's use

On an RTX 5060 8 GB with frame generation the 80 % line leaves frame
generation's memory free a second time once it runs (2026-11-28 23:07:
5,106 MB in use against a line of 4,970 MB, textures waiting in 79 of 88
records). VICTORY_TEXTURE_ROOM_MARGIN_MB=N, from the first frame frame
generation shows on: the line is max(the line without it, budget - N),
and the idle sweep lets textures idle 5 s go down to 5 % under the line
so that the room goes to those the title asks for now (1.5 s only within
N/4 of the budget). A share that moved with frame generation lost the
device (23:29 run); the margin does not move.

Beside the room line every 5 s: the card's use split into host textures
(the title's, others), card copies of title buffers and the rest; how
many copies the sweep let go were made again within 10 s; and how many of
texture::unchanged's answers came from the write watch.

(c9c5354 already lets the render-target reserve go on 8 GB cards:
VICTORY_CARD_ROOM_FOR_TARGETS_MB is no longer needed.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ults, the PC's commit, the card's two groups, what the title asked)

Run 2026-11-29 11:08 committed 18 GB privately on a 16 GB PC. A second
line after procmem's: sections shared (the title's physical pages), the
private working set, page faults a second, the PC's commit and free
memory, the card's memory in use and the PC's memory the card uses
(D3D12 resources count in the private bytes wherever they are), and what
the title asked of XMemVirtualAlloc since the start: committed,
placeholders (16,594 MB in 256 calls and 16,384 MB in one were these,
no commit of their own), other reservations. A marked place for
shadow::live_bytes() once the refresh port brings it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the pr-performance Pull request: makes it faster or use less memory label Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-performance] RTX 5060 8 GB / 6-core Ryzen / 16 GB: refreshes at submit on several threads, 8 GB and 16 GB launcher defaults, memory lines, bench tools RTX 5060 8 GB / 6-core Ryzen / 16 GB: refreshes at submit on several threads, 8 GB and 16 GB launcher defaults, memory lines, bench tools Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 29, 2026

Copy link
Copy Markdown
Author

Test on this branch (v2026.11.29.01 + this PR): run H, 12 min 17, closed normally. RTX 5060 8 GB, Ryzen 5 9600X, 16 GB of RAM. --series-s --dlss quality --framegen 2, plus the switches listed in docs/test-results-2026-11-29.md (part H).

What the player saw

  • Freezes are still there, mostly when entering new areas.
  • Textures still take some time to load.
  • Some textures do not show at all, or show wrong.

What the log says (docs/logs/victory-nvidia-play-20261129-115844-29880.log.gz, docs/logs/victory-mem-20261129-125843.csv)

  • 0 out of VRAM, 0 DLSS failures, 0 stale copies (VICTORY_REFRESH_CHECK=1). The game ran stable.
  • Frame rate: median 13.3 fps across the 135 five-second fps lines. 16 of them are under 5 fps (the freezes) and 32 under 10.
  • Submitting thread: 88.5 ms/frame, of which 44.8 ms are refreshes. The same work on v2026.11.28.03 gave 33 and 15 ms. This is a regression on this base: on this base it runs on main's batch path, without perf(gpu): lock-free no-op refreshes, chunked refresh claiming, and AVX2 copy diff #614. A run of plain v2026.11.29.01 with the same options is still needed to tell whether the cause is this branch or the release.
  • Textures: 11,506 textures waiting on average (22,260 at most), against 5,109 on .03. 232 lines say the queue has no room. Textures that wait show main's neutral stand-in, which fits what the player saw as missing or wrong textures.
  • Dropped draws: on average 764 per frame are ray-tracing builder dispatches (VICTORY_BVH_BUILDER off) and 5 are pipelines left out on purpose. Next to nothing is waiting for a pipeline to compile, so the missing textures do not come from shader compiles.
  • RAM: the private commit peaks at 21.5 GB on this 16 GB PC, even with VICTORY_WINDOW_KB=1024. Free RAM falls to 152 MB. On 16 GB, paging stays the main cause of the freezes.
  • scripts/bench.py does not read v2026.11.29.01's new fps and room lines yet. The figures above come from the raw log.

Next

  • A baseline run of plain v2026.11.29.01 with the same options.
  • bench.py reading the new log format.
  • Look at why refreshes cost three times as much on this base.
  • Look at the CPU side of card copies: about 1 GB of RAM that only mirrors title memory.

castyan27 and others added 3 commits November 29, 2026 13:28
The frame line now says "dropped N draws or dispatches" and the room's
budget gains "; ... after face headroom, ... in texture copies": the old
patterns matched 1 of H's 98 world lines and none of its 135 room lines.
Both formats are read, with a self-test line of each; "memory now:
committed" lines give a committed-memory maximum where they exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dex let go

docs/textures-h-cause.md: the pass over textures picked by index stops at
its time every run (VICTORY_TEXSPK_PASS_MS=8) with 12,780 slots due, slots
looked at before are served ahead of sampled ones, and slot eviction let go
of 0 textures in 12 minutes (all picked by index, SAMPLED_EVICT=0) while
~930 MB were marked by no shader.

Both off by default:
- VICTORY_DUE_HOT_FIRST=1: slots a shader sampled lately go before those
  looked at before (Due::ordered_by, tested).
- VICTORY_COLD_EVICT_S=<s> (10-110): slot eviction trusts the marks as
  SAMPLED_EVICT does, but only for textures unmarked that long.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DrDarkDK

DrDarkDK commented Nov 29, 2026 •

Copy link
Copy Markdown

I ran the requested VICTORY_MEM_ATTRS=1 test on a clean release build at 77427629. Windows 11, Ryzen 9 7900X, RTX 4070 Ti 12 GB, 32 GB RAM. Series X at 2560×1440, DLSS Ultra Performance, VICTORY_TEXTURE_POOL=1, VICTORY_HELPER_PRIORITY=on, and VICTORY_WARMUP_RESTART=0. I kept the existing shader cache for both runs.

Memory attributes with DLSS Frame Generation 2×

I was stuck in one place at about 0.2 FPS for just over five minutes. I closed the game normally and attached all 17 mem attrs (exit) rows.

Largest host-copy classes at exit Host copies (MiB) CPU-written after upload (MiB, cumulative)
Class 2, 0x801, 64K placeholder 3,540.9 2,256.1
Class 4, 0x2404, 2M committed 701.5 790.7
Class 18, 0x2404, 64K placeholder 385.5 330.6

Class 2 accounted for about 71% of the host-copy bytes at exit and recorded substantial writes after upload, even in this stationary sample.

Follow-up with Frame Generation off

I ran the same executable again. The only effective settings changes were VICTORY_FRAMEGEN=0, VICTORY_FRAMEGEN_X=0, and VICTORY_FSR_FRAMEGEN=0.

First 55 seconds of gameplay DLSS FG 2× FG off
Median rendered FPS 0.2 16.4
Median async submission wait at Present 4,974 ms 15.8 ms
Median draws per frame 12,757 10,290
Peak private memory 25,418 MiB 28,378 MiB

With FG on, the recurring five-second queue waits began just after DLSS FG activated. Streamline’s actual Present call took about 0.4 ms. With FG off, the longest reported queue wait in the matched window was 482 ms.

This was one run per setting, with different draw counts. Disabling FG removed the recurring five-second stall in this comparison, while private memory remained high. The underlying queue dependency is still unclear.

AI-assisted with Codex.

@Castyan

Castyan commented Nov 29, 2026

Copy link
Copy Markdown
Author

Thanks a lot @DrDarkDK for the run and the careful write-up, including the FG on/off comparison. Here is the same test on the author's PC, for a second data point.

VICTORY_MEM_ATTRS=1 at 7742762: RTX 5060 8 GB, Ryzen 5 9600X, 16 GB of RAM, --series-s --dlss quality --framegen 2, the switches of run K. Firefox and Discord stayed open (4.6 GB free at the start), so fps and memory are not comparable to K, but the class table is. About 9 min, closed by its window, 0 stale copies with VICTORY_REFRESH_CHECK=1.

Class at exit Live MiB Host copies MiB First upload MiB CPU-written after upload MiB Refreshed on the submitting thread MiB
2: 0x801 (PAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS), 64K placeholder, 1 call 16,384 4,516.5 40,873 53,599 94,472
7: 0x1, 4K reserved, 32-bit 185 174.1 0.6 58,919 58,835
4: 0x2404 write-combined, 2M committed 1,277 379.6 275.5 26,800 20,393
18: 0x2404 write-combined, 64K placeholder 1,791 304.2 304.2 19,409 19,708
3: 0x22004, 2M committed 1,614 42.1 141.0 1,190 1,309

The other 11 classes hold no host copies (class 1 is 16.7 GB live, class 12 is 4.0 GB).

What both runs say:

  • The largest class is the same on both PCs: one 16 GB 0x801 placeholder, 71 % of host copies on yours and 79 % here. Its label is the reservation's, not what the title asks of the pages it maps there. The GDKX docs say pages mapped by XMemMapPhysicalPages take their reservation's protection, so a NOACCESS pool must get its real protection later, through VirtualProtect. The counter did not hook that yet; the next commit does.
  • A small class rewritten all the time: class 7, 185 MiB reserved below 4 GB, had 58.9 GB written after its first upload, all refreshed on the submitting thread. It looks like ring or constant buffers. Those would be better served from memory the GPU reads directly, without host copies.
  • No large class is "written once" as labeled now, so nothing can be skipped yet. The next commit also records the D3D object type (XALLOC_ATTRIBUTES.ObjectType when the allocator id is D3D's) to tell static resources from dynamic and staging ones.

On the FG stall at 0.2 fps: frame generation works on this 5060 (about 20 generated frames/s in run K), so your Series X / VICTORY_TEXTURE_POOL=1 / VICTORY_WARMUP_RESTART=0 setup is the difference to look at. Noted as a separate issue.

…(VICTORY_MEM_ATTRS=1, off)

Two runs at 7742762 (an RTX 4070 Ti 32 GB and the author's RTX 5060 16 GB) put 71-79 % of host copies under one 16 GB PAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS placeholder. Pages XMemMapPhysicalPages maps there take the reservation's protection (GDKX docs), so the title sets the real one later: the title's VirtualProtect now repaints its range under a class of its own. XMemAlloc keys keep the object type when the allocator is Direct3D's (id 128), to tell static resources from dynamic, staging and tiled ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 29, 2026

Copy link
Copy Markdown
Author

Pushed e0b7a85: the memory-attribute counter now sees what the big placeholder really holds (VICTORY_MEM_ATTRS=1, still off by default and still measurement only)

Following the two runs above:

  • VirtualProtect is counted. The title's VirtualProtect (already hooked as title_virtual_protect) now repaints its range under a class of its own, shown as ... set by VirtualProtect with the protection asked. Pages that XMemMapPhysicalPages maps take their reservation's protection, so this is where the 16 GB 0x801 pool should split into its real kinds. If it stays large after this, the title sets those pages some other way, and that is worth knowing too.
  • Direct3D's object type is kept. When the XALLOC_ATTRIBUTES allocator id is Direct3D's (128), the class keeps its ObjectType, named in the log: resource, dynamic resource, staging resource, tiled resource, shader, command buffer, ring temporary, and so on. That is the line between memory written once and memory the CPU rewrites every frame, which is what a skip needs.

Tests: cargo test -p victory-gpu -p victory-hle --release pass (4 memattrs tests, 2 of them new). host::menu::tests::a_change_is_saved_at_once... failed once in the full parallel run and passes on its own (known shared-state flakiness). The release build is fine.

Same request as before, now on e0b7a85: play at least 5 minutes in the world with your usual switches plus VICTORY_MEM_ATTRS=1, close by the window, and post the mem attrs (exit) lines with your GPU, VRAM and RAM. The most useful lines are those marked set by VirtualProtect and those with a D3D object. Thanks in advance.

@Razen114514

Copy link
Copy Markdown

VICTORY_MEM_ATTRS=1 on an 8 GB card with 32 GB of RAM

The missing cell from your two runs: same VRAM as yours, twice the system RAM.
e0b7a854, release build, the switches below, 8 min 45 s from start at the
safehouse.

These are the last mem attrs (5s) block, not an mem attrs (exit) one. The
process was ended rather than closed by its window, so the log has no exit block:
0 mem attrs (exit) lines, 2,736 of the 5 s kind (14 classes over 195 windows).
Your step 3 allows the last 5 s block in that case.

The figures accumulate rather than roll. The same class 7 reads 9.7 MB
refreshed in the first block, 63,379 MB at block 100 and 112,010 MB in the last,
so the last block is the whole run and every number below is a total.

Testbed. RTX 5060 8 GB, Intel Core i5-13490F, 32 GB RAM (yours is 16 GB),
Windows 11 26300, driver 32.0.16.2124, image b99f876b74d4a77f, Series S,
--dlss performance, frame generation 2×.

Switches: VICTORY_MEM_ATTRS=1 plus the set I normally play with —
AMBIENT_SHADE=0,0.6 AMBIENT_ONCE=1 INPLACE=1 TEXTURE_NO_WAIT=0 TEXTURE_POOL=0 HELPER_PRIORITY=on WAVE_PAIRS=1.

The last mem attrs (5s) block, largest first

class 18  XMemVirtualAlloc 0x2404 (host 0x4 writecombine, graphics 0x2000) 64K placeholder
          calls 1,  live 1632.4 MB, host copies 290.3, first upload 290.3,
          CPU-written after upload 12695.5 MB, refreshed on the submitting thread 12985.8 MB

class 3   XMemVirtualAlloc 0x22004 (host 0x4, graphics 0x22000) 2M committed
          calls 3,  live 1614.0 MB, host copies 7.1, first upload 4.4,
          CPU-written after upload 2010.9 MB, refreshed 2015.3 MB

class 4   XMemVirtualAlloc 0x2404 (host 0x4 writecombine, graphics 0x2000) 2M committed
          calls 1,  live 1277.0 MB, host copies 216.3, first upload 216.3,
          CPU-written after upload 24636.7 MB, refreshed 24853.1 MB

class 7   XMemVirtualAlloc 0x1 (host 0x1, graphics 0x0) 4K reserved 32-bit
          calls 1,  live 185.0 MB, host copies 174.0, first upload 3.7,
          CPU-written after upload 112006.1 MB, refreshed 112009.8 MB

class 9   XMemAlloc type 1 (graphics write-combined) 2M align 65536
          calls 6,  live 102.1 MB, host copies 0.0, first upload 0.0, written 0.0, refreshed 0.0
class 15  XMemAlloc type 1 (graphics write-combined) 2M align 256
          calls 4,  live 47.5 MB, host copies 0.0, written 0.0, refreshed 0.0
class 5   XMemVirtualAlloc 0x4 64K committed
          calls 2,  live 33.0 MB, host copies 0.0, written 0.0, refreshed 0.0
class 14  XMemAlloc type 7 (physical cacheable) 64K
          calls 2,  live 10.4 MB, all 0.0
class 13  XMemVirtualAlloc 0x2004 2M committed
          calls 1,  live 3.2 MB, all 0.0
class 11  XMemAlloc type 3 (graphics cacheable) 64K
          calls 16, live 1.4 MB, all 0.0
class 16  XMemAlloc type 1 64K
          calls 2,  live 0.2 MB, all 0.0
class 6   XMemVirtualAlloc 0x42404 64K committed
          calls 1,  live 0.1 MB, all 0.0
class 17  XMemAlloc type 1 64K align 256
          calls 3,  live 0.0 MB, all 0.0
class 0   not allocated through XMem
          calls 0,  live 0.0 MB, host copies 92.0, first upload 80.0,
          CPU-written after upload 24.5 MB, refreshed 104.6 MB

What stands out

Three classes carry 150 GB of the 152 GB refreshed, and one of them is not
write-combined.

class live refreshed refreshed ÷ live
7 185 MB 112,010 MB 605×
4 1277 MB 24,853 MB 19×
18 1632 MB 12,986 MB 8×
3 1614 MB 2,015 MB 1.2×
0 and the rest 197 MB 105 MB —

class 7 alone is 73% of everything refreshed on the submitting thread, on 185 MB
of memory — a 605× amplification. It is protect 0x1 with 4K pages and the 32-bit
flag, so it is not one of the write-combined classes and it does not fit the shape
you were looking for: the CPU writes 112 GB into it. Something about a small
4K-page 32-bit block is costing as much refresh as everything else together. I do
not know what it holds; that is the question I would ask next.

Your "large host copies, almost nothing written" shape is class 0, not the
write-combined ones: 92 MB of host copies, 80 MB uploaded once, 24.5 MB written
after — but 104.6 MB refreshed, so it is being refreshed more than it is written.
At 92 MB it is not where the time goes.

The write-combined classes are hot. class 4 writes 24,636 MB after upload and
class 18 writes 12,695 MB, so neither can skip watching on this title. Their host
copies (216 MB and 290 MB) are also far smaller than their live bytes (1277 MB and
1632 MB) — most of what they hold is never copied at all.

The five classes that read all zeros hold 185 MB between them (9, 15, 5, 14, 13,
plus 11, 16, 6, 17 below them). All are XMemAlloc with 2, 4, 16, 2 and 3
allocations respectively — so few, and possibly late in the run, that a zero here
may mean "not touched" rather than "never needs watching". Together they are 0.3%
of the refreshed bytes.

The rest of the frame, for context

From the same log, so you can compare against your 16 GB run:

the texture queue's room: 6169 MB in use - 0 MB free in texture blocks
  + 144 MB kept for card copies + ... against a line of ...
textures picked by index: 25708 slots, 20522 of them due
the pass over textures picked by index, in the last 5 seconds: 1172 ms in all
the texture queue's lock in the last 5 seconds: taken 50826 times
textures with levels on demand: 1172 alive, 57 MB of the card given to 633 levels
11 fps, 87.3 ms/frame, 5834 draws/frame   (one window, not a median)

the pass over textures picked by index: 1172 ms in the last 5 seconds — a
fifth of the wall clock spent in the texture pass, with 20,522 of 25,708 slots due
and 0 MB free in the blocks. That matches the queue pressure you and I both see on
8 GB.

Limits

One run, one scene, my own switches. The block above is a mid-run 5 s window and
not an exit block, so the byte figures are what moved in those five seconds, not
what moved over the whole run — the class 7 amplification in particular would be
worth confirming against an exit total. I did not run with frame generation off,
so I cannot separate its share. The frame line in the excerpt is one window's
figure, not a median.

@Castyan

Castyan commented Nov 29, 2026

Copy link
Copy Markdown
Author

I added an opt-in loading screen for the first 3D scene in 36c6eba. Enable it with --set VICTORY_STARTUP_TEXTURE_WAIT=1 and frame generation off. Texture uploads and game updates continue behind the loading screen. The scene is shown when the texture queue falls below the threshold, stops making progress, or reaches the safety limit.

In a local RTX 5060 8 GB / 16 GB RAM trial on the .02 base, the queue grew from 881 to 14,774 due texture slots while uploads continued. The screen released at the 10.024-second safety limit, with the queue still above the threshold. The game later stopped with 0x8007000E while closing a D3D12 command list. This run confirms the loading screen and fallback paths. It does not establish an improvement to the first visible frames.

The two targeted tests and the staged asset policy passed on the PR branch. The setup and results are in the test notes.

@Castyan

Castyan commented Nov 29, 2026

Copy link
Copy Markdown
Author

37bce66 uses the GDKX sampler-feedback model to prioritize indexed textures that shaders sampled recently. When the regular texture pass hits its VRAM budget, these slots move ahead of background checks. Rechecks keep their fingerprints and the existing VRAM, RAM and per-pass limits still apply. Set VICTORY_DUE_HOT_FIRST=0 to compare with the former queue order.

The release built and 73 descriptor tests passed. Both local sessions reached gameplay and closed normally. In the matched 45-second opening-scene windows on RTX 5060 8 GB, warnings about textures changing after upload went from 4 to 0 and skipped prelude uploads from 1 to 0. Median rendered FPS was 5.6 vs 8.1, and median buffer-copy time was 80.4 vs 60.8 ms/frame. Both windows had eight queue samples blocked by the VRAM budget. This was one run per build with different scene timing and draw counts. It does not establish a causal FPS improvement or confirm that all visual texture problems are resolved.

The settings, method and limitations are in the test notes.

castyan27 and others added 3 commits November 30, 2026 00:39
…view over a copied texture, GDKX contracts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/placed-view-hero-lead.md: the two "HERO LEAD" lines of the run of
2026-11-30 00:29 were other textures in reused memory (a BC6H cubemap at a
BC7 texture's start, a BC1 texture inside a BC3 one): filling them from the
copied texture would show its texels in another format. The 30 "changed
after its upload" were the title writing texture memory, which
VICTORY_PAINTED_EVERY already covers.

VICTORY_HOST_WRITTEN_REUSE=1 (off by default): such a view makes the copied
texture's address forgotten, so that a later view laid out as it was reads
its own memory and not the old copy (host_written_like). The line for
reuse is said apart from HERO LEAD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…missed copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 29, 2026

Copy link
Copy Markdown
Author

A/B of VICTORY_DUE_HOT_FIRST on the same binary (37bce66), runs 1 and 2 of 4: not conclusive yet

RTX 5060 8 GB, Ryzen 5 9600X, 16 GB of RAM. One binary built from 37bce66 exactly. Each run starts from a fresh copy of one reference cache and save (VICTORY_CACHE_DIR / VICTORY_DATA_DIR per run), uses the preset of docs/prompt-reprise-pr-2334.md (--series-s --res 1440 --dlss quality --framegen 2, VICTORY_LOG=info, VICTORY_MEM_ATTRS=1, VICTORY_SAMPLED_MARKS=1, …), loads the same save, and leaves the camera still in the world. The setting is checked in each log's switch line. Both runs were closed by their window.

45 s window from the first 5 s line with at least 2,000 draws (scripts/bench.py on the cut logs):

Run 1: default (absent) Run 2: =0 Earlier 37bce66 run (23:00) Earlier parent 4c20058 (22:50)
free RAM at launch, MiB 4,060 (Firefox, Edge open) 7,721 (Edge open) 9,034 8,419
rendered fps p10 / median 0.2 / 0.7 1.5 / 4.2 1.9 / 8.3 2.6 / 5.6
buffer copies, ms/frame 1,344 173 105 85
submitting thread / refreshes, ms/frame 750 / 436 211 / 96 109 / 56 206 / 133
queue full (no room) lines 6 7 8 8
textures due, mean / max 14,060 / 16,568 19,931 / 22,633 27,960 / 33,035 27,844 / 29,016
"changed after its upload", "prelude upload left out" 0, 0 3, 0 0, 0 4, 1
card memory in use MB, mean 6,024 5,663 5,638 5,403
stale copies, out of VRAM 0, 0 0, 0 0, 0 0, 0

What this says, and what it does not:

  • Run 1 paged hard (4 GB free, a browser open): copies took 1.3 s a frame. It measures the PC's memory, not the queue's order. Across these four runs, the spread from RAM and route (copies 85 to 1,344 ms) is far larger than any effect the setting could have, so nothing here shows or rules out a gain from VICTORY_DUE_HOT_FIRST. The one hint in its favour, 3 late texture changes with =0 against 0 with the default in both default runs, rests on single counts.
  • No visual note was taken in the same shot for these two runs. Runs 3 (default) and 4 (=0) follow, with other programs closed.

Over the whole of run 1, two "HERO LEAD" lines turned out to be memory reused by another texture (a 6-face BC6H cube map at the start of a 1-face BC7, and BC1 blocks inside a BC3), not a GPU copy the view missed. Filling those views from title memory is right. The real risk is a later view with the old layout at the same address being sent back to the old copy. A fix, VICTORY_HOST_WRITTEN_REUSE=1 (off by default), is written but not pushed or measured yet.

Next run on the same binary: VICTORY_PORT_CONSTANTS=1. It turns on xmem::arrange(), which gives the 185 MB below-4 GB graphics heap its section's slices in address order (XMemMapPhysicalPages maps them out of order here), so the in-place port can serve it with no host copy and no refreshes. That path has been off since the GPU half of the port became default without that switch.

@Castyan

Castyan commented Nov 30, 2026 •

Copy link
Copy Markdown
Author

VICTORY_PORT_CONSTANTS=1 on the same 37bce66 binary: the 185 MB below-4 GB graphics heap is served in place, its host copy is gone

Same binary, same reference cache and save, same preset as the A/B above, plus VICTORY_PORT_CONSTANTS=1. This run was driven unattended: Enter sent to the window from 10 s after launch, every 15 s, until the title left its waiting screen. Then 60 s with the camera still in the world, then closed by its window (end = closed). Free RAM at launch was 8,237 MiB (Edge open). 0 stale copies with VICTORY_REFRESH_CHECK=1, 0 out of VRAM, 0 ERROR lines.

Why it was off. xmem::arrange() gives the pages of the title's 32-bit graphics heap their section's slices in address order. The title makes one XMemAllocatePhysicalPages call and maps it out of the addresses' order (3rd, 4th, 1st, 2nd part), and a host heap cannot be opened over views out of their section's order (OpenExistingHeapFromAddress1 refuses with E_INVALIDARG; WARP test in agent 2's branch). That function only ran with VICTORY_PORT_CONSTANTS=1 written out, while the GPU half of the port has been on by default without it. So every run on this PC logged "not one native-import-eligible stretch of a section: Scattered", and the 174 MB title buffer in that heap stayed a host copy refreshed on the submitting thread.

What the log shows with the switch:

  • the title's 32-bit graphics pages given their section's slices in address order ... moved=752 ... not_fresh=0 (five maps, 2,944 pages): no page was used before its map.
  • a stretch of the title's graphics memory opened as a host heap through a view of ours ... bytes=193986560, then title memory in place ... len=182452224 window=false.
Run 2 (A/B, without the switch) This run (with it)
class 7 (that heap, VICTORY_MEM_ATTRS): host copies 174.1 MB 0.1 MB
class 7: bytes the CPU wrote after the first upload, refreshed on the submitting thread 26,430 MB / 26,351 MB 0.0 / 0.1 MB
host copies of title memory in the PC's memory (last lines) 4,192–4,201 MB 3,235–3,271 MB
refreshes per frame on all threads (last two 5 s lines) 77.2 / 88.7 ms 55.9 / 59.6 ms
45 s window at world entry: fps p10 / median, refreshes on the submitting thread 1.5 / 4.2, 96.4 ms 0.4 / 6.6, 106.8 ms

Limits. One run of 2 min 29 with 60 s in the world. The 45 s window starts at world entry, where streaming dominates, and does not show the gain yet; the steady-state lines above do. The camera was still, and the runs it is compared with were played by hand. A longer unattended pair (with and without, same start) comes next.

What to watch. The buffer now has one home, the title's memory, but our CPU steps at submit read from it (9,799 constant-buffer fills a frame, 3.3 MB, and 6 buffer copies) without waiting for submissions still in flight, and buffer views that are not on an element of the buffer's host copy still get exact copies of their own. Neither showed up as a stale copy in this run. If they do, a targeted fix is written (VICTORY_INPLACE_VIEWS=1, off by default, not pushed). A stricter switch, VICTORY_XMEM_ORDERED=1, runs the same ordering without PORT_CONSTANTS and gives a section up for good on the first page used before its map. It is written and tested, not pushed yet.

Edited: do not turn this on. A longer pair (next comment) shows the GPU time going from 3 to 50 ms a frame and the median frame rate halving, because the shaders then read this heap from the PC's RAM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 30, 2026

Copy link
Copy Markdown
Author

Correction to the comment above: VICTORY_PORT_CONSTANTS=1 moves the cost from the CPU to the GPU, and halves the frame rate here. Please do not turn it on.

I ran a longer unattended pair on the same 37bce66 binary: same reference cache and save, Enter sent from 10 s until the title left its waiting screen, 180 s with the camera still in the world, closed by its window (end = closed for both). Free RAM was 9,255 and 10,356 MiB (Edge open). 0 stale copies and 0 out of VRAM in both.

Without VICTORY_PORT_CONSTANTS=1
Steady state (60–180 s in the world)
rendered fps p10 / median / p90 6.5 / 16.5 / 17.6 7.7 / 8.5 / 9.8
buffer copies on the CPU, ms/frame 96.3 23.6
on the GPU, ms/frame 3.0 50.0
submitting thread / refreshes, ms/frame 79.2 / 46.6 87.8 / 39.1
textures due, mean 25,186 17,936
"changed after its upload with nothing to tell of it" 5 63
World entry (first 45 s)
fps p10 / median 1.4 / 4.2 1.8 / 3.6
copies / refreshes, ms/frame 155.7 / 117.3 132.3 / 85.9
  • The in-place heap is title memory, which is the PC's RAM. On this RTX 5060, the shaders that read the 174 MB buffer (constant rings, skinning) now go over PCIe. A synthetic bench measured about 10 GB/s from system RAM against about 430 GB/s from VRAM. The CPU saves 73 ms of copies a frame, but the GPU spends 47 ms more, and the GPU becomes the limit.
  • The rise of late texture changes, from 5 to 63, is not explained yet. It is one more reason not to use the switch as it is.
  • Single pair, camera still. The direction is clear, though: the median halved, and GPU time grew 16-fold.

What it does show is where the CPU cost goes: about three quarters of the steady-state copy time is this one heap. The next step is to keep the shaders reading VRAM and take only the copy work off the CPU: the in-place heap stays as a source, and the bytes the title wrote since the last submission are carried into the card copy by the GPU's copy engine (CopyBufferRegion from the placed host buffer) instead of by CPU memcpy. That will be behind a switch off by default, measured the same way before anything is proposed here.

castyan27 and others added 3 commits November 30, 2026 01:22
…ad the heap from system RAM)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… another texture takes its memory (VICTORY_HOST_WRITTEN_REUSE=1, off)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate lows (p10 6.5 -> 16.7 fps)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Castyan

Castyan commented Nov 30, 2026

Copy link
Copy Markdown
Author

Pushed 504d07a (fast-forward from 37bce66): one texture fix off by default, and the write-up of tonight's measurements

  • VICTORY_HOST_WRITTEN_REUSE=1 (off by default, texture.rs, docs/placed-view-hero-lead.md). When a placed view of another layout (another block size, another layer count, or other dimensions at its start) lands in the memory of a texture the host copied into, the copied texture's address is forgotten. Without it, a later view laid out like the old texture at the same address, as in a streaming pool, would be served from the old copy and show the wrong texture. The two "HERO LEAD" lines of the A/B runs were such reuse. Not measured in game yet.
  • docs/due-hot-first-ab-2026-11-30.md: the protocol (one binary, a fresh copy of one reference cache and save per run, unattended runs driven by Enter, camera still), all the runs below, their limits, and the GDKX contracts behind them (XALLOC_ATTRIBUTES, XMemVirtualAlloc, XMemMapPhysicalPages, sampler feedback tier).

cargo test -p victory-gpu --release: 947 passed, 0 failed. Asset policy OK. The release build is fine.

VICTORY_REFRESH_BESIDE=1 (already in the PR, off by default) on the same binary, unattended, 180 s still in the world, compared with the run without it from the pair above. Both closed by the window, 0 stale copies, 0 out of VRAM, 0 ERROR lines:

Without VICTORY_REFRESH_BESIDE=1
steady state (60–180 s): fps p10 / median / p90 6.5 / 16.5 / 17.6 16.7 / 17.5 / 18.8
steady state: ms/frame mean 172 57
steady state: copies / submitting thread / refreshes, ms/frame 96.3 / 79.2 / 46.6 32.7 / 55.1 / 28.9
steady state: "changed after its upload", queue-full lines 5 / 195 150 / 342
world entry (45 s): fps p10 / median 1.4 / 4.2 0.6 / 3.6

The steady-state lows rise sharply, which means far fewer long frames. World entry is no better in this single pair. The rise of late texture changes from 5 to 150 is not explained yet: it could be more frames uploading more, or uploads ordered against refreshes that now run beside. It needs checking before this switch can be recommended, so please treat it as experimental. If you try it, the refreshes beside the submitting thread line and any changed after its upload lines would help.

Also from tonight, all in the doc: the VICTORY_DUE_HOT_FIRST A/B is still not conclusive (2 of 4 runs, swamped by RAM and route). VICTORY_PORT_CONSTANTS=1 halves the frame rate on this card, because the shaders then read the 185 MB heap from the PC's RAM. Carrying the written bytes into VRAM with the GPU's copy engine instead was dropped: the CPU side of a card copy is also the reference of the three-way merge that lands what shaders wrote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-performance Pull request: makes it faster or use less memory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RTX 5060 8 GB: out of VRAM then host GPU failure 0x8007000E with --series-s --dlss quality --framegen 2 (v2026.11.27.9)

5 participants