Profile under root (RDNA3, 8 GB): the frame is the title's own synchronisation, not the layer's memory work #64
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem#64
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?
@YaBulochka on GitHub · 2026-12-01 11:50 UTC · original
Where the frame goes: a root-level profile of the stack on RDNA3 / 8 GB
Measured on a machine that is not the reference one, in case the shape is useful: nobody's copy of this runtime has been counted from the kernel side, and the split surprised me.
Rig. RX 7600 XT (8 GB, RDNA3), Ryzen 5 9600X (6 cores / 12 threads), 30 GB RAM, RADV 26.3.1 built by
./setup.sh, GE-Proton11-16, KWin on Wayland with the desktop on the integrated GPU (so the dGPU does the title alone). Build:37bb30fwith #51, #52, #58 and #60 merged locally (ede9bc9);series-s,VICTORY_FSR_HOST=1,VICTORY_OUTPUT=1920x1080,VICTORY_BVH_HARDWARE=0, ray tracing otherwise on.Method.
bpftraceontracepoint:syscalls:sys_enter_ioctland theamdgpu:*tracepoints with/pid == <title>/,strace -c -fon the same pid,perf record -pat 99 Hz, plus/proc/<pid>/smapsand the DRMfdinfocounters. Every number below is the title's process only; system-wide counters are useless here because the desktop runs on the other card.The split
Frame, 720p rendered to 1080p, open world:
Syscalls of the title, per 10 s (two runs, same shape):
And the ioctls by request, which is the part I did not expect:
amdgpu tracepoints for the same process:
vm_bo_map24 000-51 000 andvm_bo_unmap23 000-53 000 per 10 s,bo_move2 700-5 200,bo_create1 400-2 700.Profile (
perf -p, 99 Hz), stable across four runs:What I read out of it
The layer's own memory work is not the heavy part: 800 submissions and 3 200 page-table updates a second. What dominates is the title's own synchronisation, arriving as 15 600
NTSYNC_WAIT_ANYand 12 500EVENT_SETa second, plus thefutextraffic beside it. 150 threads of the title, waiting on each other, is the largest single consumer in the process.Second, the page cache is squeezed while the title streams:
filemap_add_folio138 000-205 000 per 10 s againstfilemap_get_pages17 000-37 000, that is 54-100 MB/s, withCachedat 1.8-2.7 GB on a machine that has 30 GB. The title keeps adding, the cache keeps dropping, so textures come back from disk.Third, and small: VRAM sits at 7.0-7.6 GB of 8.2 GB with
GTTaround 9.5 GB, which is wherebo_moveand part of the page-table churn comes from.Ruled out here, with numbers, so it is not re-tried
gpu_waitstays 25-45 ms in all three.VICTORY_PAGES=0does not change the mapping churn (24 467 to 23 181vm_bo_mapper 10 s), so the residency pass is not what remaps pages.most): 256 frames versus 4 changes nothing on screen and multiplies re-uploads by 18.preparing.Questions
NTSYNC_WAIT_ANYa second expected for this title, or does it look like a synchronisation that could be batched (one wait for several events)?filemap_addagainstfilemap_get_pages, 54-100 MB/s) — does that match what the reference machine shows, or is this 8 GB card simply re-reading what a bigger one would keep?No game files, paths, screenshots or captures included: numbers and log fragments only.
@YaBulochka on GitHub · 2026-12-01 12:29 UTC · original
Follow-up: the page traffic itself, traced for a minute
Same rig as above. I traced
amdgpu:amdgpu_vm_bo_mapandamdgpu_vm_bo_unmapfor 60 s during open-world driving at ~13 fps,tracefsbuffer at 256 MB, and parsedstart/last(they are page numbers in these events, not bytes; the GTT base at0x80000000pages confirms it).Three things stand out.
The minute's working set is 3.5 GiB, and it fits. On this 8 GB card there is room; the frame is not short of VRAM for what the title actually touches in a minute.
What is mapped at any instant is only ~0.5 GiB. So the layer maps a small slice, unmaps it, maps the next: 1 789 operations a second at a median of 76 KiB, 7.65 GiB of mapping traffic for a 3.5 GiB set. Each of those is a page-table update and a TLB invalidation.
It is the layer doing it, not the title. The trace's task names are
victory-late-wa…andvictory-submit…, so the slicing is ours; the title asks for memory and we hand it over in 76 KiB pieces.If that reading is right, a policy that keeps larger ranges mapped (or a whole placed buffer at a time) would cut 1 789 operations a second to tens, without any change on the title's side. That is the one lever this profile found that is not "buy a 16 GB card".
Caveats, so this is not overread: one sample, driving at ~13 fps, and tracepoints only cover the VM's own mappings (other resident memory is not in these events). I can re-run the same probe on any commit and post the deltas, or on a build with a switch that changes the policy, so you can see whether the operation count moves.
@YaBulochka on GitHub · 2026-12-01 12:54 UTC · original · edited 2026-12-01 12:58 UTC
Where the 7 GB of VRAM actually goes (it is not the title's memory)
Same rig and build as above. The unified arena reports
1024 MB in VRAMwhilemem_info_vram_usedreads 7.1 GB, so something else owns most of the card.From the frame summary:
So 5.15 GB of the 8 GB card, 72 %, is the layer's copies of individual texture levels, averaging 68 KB each, taken because the title views single mips. The unified memory itself is about 1 GB.
That reframes the residency picture on this card: the window stays at 0.5-0.8 GB not because the policy is timid but because the copies already own the card. A minute's working set is 3.5 GiB (previous comment) and it would fit, if the copies did not.
Three questions this raises, in the order I would answer them:
What I have not measured yet: how much of that VRAM the ray-tracing structures take. My first attempt at that comparison was wrong (the switch never reached the runtime, because
run.shclears inheritedVICTORY_*variables and only takes them as arguments), so I am re-running it and will post the number separately rather than guess.Caveat: this is one run, an 8 GB card,
series-swithVICTORY_FSR_HOST=1at 1080p, which makes the working set smaller than it would be at 4K. On a 16 GB card the same copies would simply not compete.No game files, paths or captures included.
@YaBulochka on GitHub · 2026-12-01 13:04 UTC · original
Correction to the numbers in the comment above: the first RT comparison was taken with the switch in the environment instead of as an argument, and
run.shclears inheritedVICTORY_*variables, so both runs had the builder on. Re-measured properly (VICTORY_BVH_BUILDER=0 VICTORY_BVH_IN_PLACE=0as run arguments, and the log no longer says "the ray-tracing structure builder runs"):So the ray-tracing structures are about 87 MB on this card at
series-swith 1080p output and the hardware node test off. They are not what fills the card; the 5.15 GB of texture-level copies is, and that part of the comment stands.The earlier
VICTORY_REVEAL_RUNnote in my head was also measured with the switch in the environment and is being redone; nothing of it went into this thread.Sorry for the noise: the rule here is now "every
VICTORY_*goes afterplay", and I will re-run any number you want before it is quoted again.@LOCKhart07 on GitHub · 2026-12-01 14:33 UTC · original
A note on the "host copies of the levels viewed alone" reading: as far as I can tell from the code, those aren't extra copies on top of the texture. They are the texture's host copy, made smaller.
In
resource.rs(host_resource), a placed texture the title only views from level n gets a host texture of levels n.. only (ResourceDesc::from_level(base)), not the whole chain.want_levelreplaces it with a larger one when a sharper level is viewed ("replaced by one with more levels").HELD[1](the MB on the card) is the size of those reduced copies, andHELD[3](MB of title memory whole) is what the full textures would have taken.So 5.15 GB on the card versus 32.5 GB whole is a saving of about 27 GB. Each title texture's console-layout bytes stay in title memory, and the PC-layout host copy is the only copy in VRAM.
Same counter on a 16 GB RX 9070 XT (RT on, 1440p, ~18 min): 537,052 reduced copies, 38 GB copied versus 220 GB whole.
What did look costly here instead:
@YaBulochka on GitHub · 2026-12-01 16:06 UTC · original
Three switches on an 8 GB card:
gpu_wait38.6 -> 13-15 ms, frame 60.7 -> 56 msFollow-up on the profile above, because two of these are defaults rather than new code, and one of them is on by default and costs about 25 ms of card wait here.
Setup. Same rig and build as the first post (RX 7600 XT 8 GB, Ryzen 5 9600X, RADV 26.3.1,
series-s,VICTORY_FSR_HOST=1,VICTORY_OUTPUT=1920x1080,VICTORY_BVH_HARDWARE=0, ray tracing otherwise on). One save, open world, medians of the in-world frame lines:The finding.
gpu_waitfalls by about two thirds and stays there between runs. The frame falls 60.7 -> 54-57 ms. FPS rises from 16.5 to 17-18 while drawing more per frame, so the per-draw cost moved less than the totals suggest;gpu_waitis the number that holds.Why it looks like
VICTORY_LOW_MEMORYis backwards here. It is on when unset (memory.rs:is_none_or(|v| v != "0")), and turning it off is the single biggest step in the table. My reading ofdirect()is that with it on, pages above0x1_0000skip some of the "can this be placed directly" checks, so the title ends up waiting for pages instead of reading them where they are. On an 8 GB card with 5.15 GB of texture-level copies that may be the wrong trade: the mode saves VRAM by making the title wait.So the question: is the low-memory default right for 8 GB cards? Here it costs about 25 ms a frame of card wait, and switching it off is worth more than everything I tried on top of it.
Cost of the shader pass set.
VICTORY_SHADER_OPTis part of the cache key, so the first run rebuilt 99 308 pipelines in 777 s (13 minutes). Fine once; worth a line in the docs, because switching it looks like the game hung.Textures. None of the three changed the flicker: tiles of another texture on roads and clothes, and characters that go fully white or black, are still there. That is the
refill put off ... the last fill keptpath from my earlier comment, and it is untouched by these switches.No game files, screenshots or captures included.