The xmem idea on NVIDIA under Proton: what works, and where it stops (measurements, no PR) #4508
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#4508
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?
@superuser404notfound on GitHub · 2026-11-30 21:32 UTC · original
The xmem idea on NVIDIA under Proton: what works, and where it stops (measurements, no PR)
VIctory-xmem gets its speed on AMD by giving the card the title's memory itself (patched RADV: the title's pages mapped for the GPU, so nothing is copied up, landed back or watched). I tried how far the same idea gets on an NVIDIA card under Proton. Short version: the driver and Proton can be made to do the mechanics, but the title maps the same memory twice, and with VRAM behind it the CPU-side view becomes very slow to read, which xmem avoids with amdgpu kernel features NVIDIA lacks. Writing it down so nobody has to repeat the dead ends.
Setup: RTX 4080 16 GB, NVIDIA 620.73.04, i7-13700KF, 32 GB, CachyOS 7.3.6, Proton Experimental 11.0-20261123b with the view-tree wineserver, vkd3d-proton master
71cae091, maine1251c31+ #2585 + #2034. Resizable BAR on (a 16 GB DEVICE_LOCAL|HOST_VISIBLE type).1. What the NVIDIA driver can do (native Linux test program)
VK_EXT_map_memory_placedis there (memoryMapPlacedtrue, alignment 4 KiB): ReBAR VRAM is mapped at exactly the address asked for.VkDeviceMemoryat its own address; both see each other's stores. (mremapof the mapping with old size 0 is refused, EFAULT.)2. Getting it through Proton (two small patches, below)
VK_EXT_map_memory_placedfrom applications (Wine uses it only for WoW64). A plainvkMapMemoryof VRAM lands in memory Wine does not know about:VirtualQuerysays MEM_FREE andVirtualProtectfails with 87, so our guards cannot work there.vulkan.c):vkMapMemory2KHRwithVK_MEMORY_MAP_PLACED_BIT_EXTand an address is honoured when the application committed that range itself (one or several views side by side). ThenVirtualQueryreports committed private memory,VirtualProtectworks and a guard fault is caught and resumed normally.GetWriteWatchsees nothing there (not needed when the memory is shared).5c4f1a00-7e57-4ace-9b1e-501aced00001) holds an address is remapped there onMap, through Wine's path above. AGPU_UPLOADbuffer then sits in VRAM at the chosen address, and D3D12 and the CPU see the same bytes.3. Using it for renderer port 1's region
Port 1 in system memory is the known 2.6-3.3 fps case (the card reads the 174 MB constants/skinning buffer over the bus), so I tried the same region in VRAM: on the first
port::place_inthe 174 MB buffer at0x4c7d0000is copied, the title's views there become committed memory, aGPU_UPLOADheap (CREATE_NOT_ZEROED, otherwise vkd3d's deferred clear wipes what was copied in) is placed at that address and handed back as the region. That part works ("title memory in place ... where the title has it").Then the title stops itself about 1.4 s later (its own Breakpad report, an access violation reading
[rcx+0xc]with rcx 0 at image +0x4e9b54a). The cause: the title maps the whole 185 MB section a second time, at0x577d0000right after its 32-bit reservation, which is not in the layer's views book. It writes its CPU-side data (a linked list of its own allocator, in the 27 MB GPU-read-only head of the buffer) through that second view. In a normal run the node at0x4c86fff0is written there about 60-70 ms after the port places the buffer; the writes do not fault on the read-only first view, they come from title code through the second one. After the move the second view still shows the old pages, so the title never sees its own write.4. Why I stopped there
Mapping the VRAM at the second address too is possible (section 1, export plus second import), but that view is the one the title's CPU reads through, and from ReBAR VRAM that is about 1,000 times slower than system memory. xmem gets around it with amdgpu GEM objects that can live in GTT or VRAM and move between them; NVIDIA offers no equivalent. So on NVIDIA this would need a split by access pattern (CPU-read pages in RAM, GPU-heavy pages in VRAM) inside a buffer that the GPU sees as one resource, which D3D12 has no sane way to express. I do not think it pays off on this title without that.
Useful for anyone continuing: the second 32-bit view at reservation end + 0x200000 (whole section, offset 0), the
CREATE_NOT_ZEROEDtrap, and that Wine needs the patch below before any placed mapping works for a 64-bit application.Wine patch (dlls/win32u/vulkan.c)
vkd3d-proton patch
🤖 Generated with Claude Code
@github-actions[bot] on GitHub · 2026-11-30 21:32 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)