Proposal (Linux): unify title memory by placing it in VRAM at the title's own addresses #95
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#95
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?
@Fran-co-F on GitHub · 2026-11-26 03:20 UTC · original
Your
docs/findings.mdputs it well: every large cost is noticing, moving and waiting, because CPU and GPU no longer share memory. On Linux the two can share it again, and I think the layer could drop most of that work there.Idea. The in-place mode (
OpenExistingHeapFromAddress1on title memory, as in upstream #2112 / DexNomVICTORY_INPLACE) skips copies, refreshes and copy-back for what it covers. Today vkd3d-proton backs that call with host memory (VK_EXT_external_memory_host), so shaders read it over PCIe. Under Wine, vkd3d-proton can instead allocateDEVICE_LOCAL | HOST_VISIBLEmemory (ReBAR), copy the bytes in, and map it at the same virtual address withVK_EXT_map_memory_placed. The title keeps its pointers, shaders read VRAM, and there is nothing to notice or move. Windows has no equivalent: D3D12 can't choose where a heap's CPU mapping lives.What I measured (RX 9070 XT, RADV / Mesa 26.3.1, Wine 11.17, vkd3d-proton master, kernel 7.3):
play.ps1settings. That needs awineserverwith mapped views in a tree (CachyOS/wine-cachyos#50). Stock Wine spends seconds per frame there. In the log, "preparing" is the wall at 43–55 ms, as in your findings.win32u/ntdll+ vkd3d-proton): about 3,400 in-place heaps / 861 MiB mapped in VRAM at the title's addresses in the real game. GPU time went back to the copy-based level (110–130 ms in that scene), against 700–1,000 ms with in place over PCIe.mmapped withMAP_FIXEDat chosen addresses, with non-zero offsets, the same 64 KiB at several addresses, and the aliases stay coherent. Unmapping one view leaves the others intact. Tested natively; under Wine still to do.What blocked a clear win so far:
Expected effect here. From your boat-scene breakdown (55 ms frame: preparing thread 48 ms, of which about 30 ms is refreshes, card steps, write-watch queries, card copies and title bytes under shader writes; card about 41 ms including hash passes): removing the sync work should make the frame GPU-bound. That is about 41 ms right away, and roughly 30–35 ms once the card no longer hashes copies. These are estimates, not measurements.
Limits. Linux only, AMD with ReBAR. NVIDIA needs
VK_EXT_map_memory_placedin its driver, which I haven't checked. It needs small patches in Wine and vkd3d-proton (opt-in through environment variables) and changes in the layer's view handling.I'm continuing on the 32 MiB blocks and then the page pool. I can share the Wine and vkd3d-proton patches and the test programs if anyone wants to try this in parallel. Feedback on whether this layer's view and guard machinery could skip VRAM-backed ranges would help a lot.
@Fran-co-F on GitHub · 2026-11-26 13:30 UTC · original
First measured gain on this fork: 51–55 ms → 45–46 ms, with only private write-combined memory in VRAM plus
VICTORY_PORT_CBV=1(RX 9070 XT, Linux)Setup:
a9400a6+ #166, local patches for the in-place filter, Wine 11.17 (patchedwin32u/ntdll, view-tree wineserver), vkd3d-protonec20719(patched to place in-place heaps in VRAM in 32 MiB blocks), RADV 26.3.1, Series X profile,VICTORY_RELAY=2,VICTORY_PORT_CONSTANTSoff.VICTORY_INPLACE=2. Same save and scene, 160 s runs, medians over about 110 s of world frames. The control uses the same Wine, prefix and binary with in place off.PORT_CBV(2 runs)PORT_CBV(1 run)PORT_CBV(2 runs)What it took, in order:
VICTORY_PORT_CBV=1removes that cost here: about 1,000 tables' constant buffers a frame (1.9 MB) are read by the card in place, and "copies and fills" is back to 2.5–2.9 ms.Limits: one machine, one scene, one or two runs per row, picture checked only by eye (one of the two VRAM runs looked slightly worse while loading; the counters of dropped draws did not differ). View memory (the page pool) is not covered; it is still copied.
AI-assisted (Claude Code and Gemini).