Unity Engine games are kinda known to load all resources into VRAM regardless of the GPU in use, this is generally not a leak, just the game asking us to put 20GB of data into far less available memory. DXVK_HUD=memory should show this too.
DXVK's memory management also cannot be improved due to some fundamental design flaws, we've been over this.
Fair point, but usually DXVK itself doesn't come close to the VRAM limit. For that matter, the game looks like it's averaging at 5.5~gb (for now), with occasional peaks that then go down after a bit (when they're not crashing the system). I'm guessing that everything else running in the background (composition, accelerated desktop, etc) takes precious resources away from DXVK, but still.
Is there an obvious way to mitigate this issue and limit the total allowed vidmem heap that I'm missing, or is this another one of these "can't be solved unless/until the dev stops being rude to memory" issues (which, per your statement, it certainly might be)?
I cannot run the game above 720p due to this issue. The game always shoots up VRAM usage above 3.5 GB on my 970.
Me neither, blows up to 60% of my vram on my 3070ti xd so 8gig gpu's are out of the question.
By setting DXVK_CONFIG="dxgi.emulateUMA = True" can fix this issue.
Seems that Windows version game uses UMA as default.
That option did little for me, @kamikaze211.
However, update 1.1 actually stabilized the game, by and large. Seems that DXVK may have "merely" exacerbated issues present for Windows players.
Closing for now.
This is very interesting.
I have a theory after reading the statement that the game tend to use a lot of video memory than usual. I do think that the game may just use this tactic to "optimise" the game by just letting the video card handle memory instead of manually managing video memory. So I tried every single way to "lie" to the game that I'm starving VRAM with every DXVK configs I could think of
DXVK_HUD=memory DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 2; dxgi.maxSharedMemory = 0; d3d11.zeroWorkgroupMemory = True; dxvk.halveNvidiaHVVHeap = True;" %command%
I don't know which options make a difference, but after this, the game now tries to be very, very conservative on VRAM usage instead lol. It always kicked off to full VRAM usage before.
Be warned, these launch options cause significantly more stutter than usual, but it no longer runs out of video memory. My 970 can run the game at 1600×900 just fine now.
This is very interesting.
[...]
DXVK_HUD=memory DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 2; dxgi.maxSharedMemory = 0; d3d11.zeroWorkgroupMemory = True; dxvk.halveNvidiaHVVHeap = True;" %command%
Very interesting indeed. With that config - and the fact that 1.1 also drove down the OOM issues quite a bit on my RTX3080 - the memory overuse SEEMS to be getting mitigated QUITE A BIT. I've broken 8gb total in my validation but it quickly came back down,, whereas booting into the game, warping to Scott Outpost and merely walking into the tent gets me to 8gb+ total VRAM (5.ish GB to ZZZ alone) and hovers around that.
VERY nice find, @SysError99. Much appreciated.
Heads up: we're gonna remove that option in the next version.
EDIT: I mean EmulateUMA.
Heads up: we're gonna remove that option in the next version.
~which one? nVidia HVV heap or ZeroWorkgroup?~
EmulateUMA: https://github.com/doitsujin/dxvk/commit/eb8d1885bde916b3476229a9220952ad0f639ff9
Early testing shows there's some "loss of improvement" but ZZZ's VRAM overuse still seems to be somewhat mitigated by the other options.
Will try to check back later.
I got a conclusion, there's two options that need to be set in order to lie the game (at least, on my machine), dxgi.enableUMA, and dxgi.maxDeviceMemory. The dxgi.maxDeviceMemory can be set to any low value but zero, and the game now behaves properly with low memory graphics cards.
DXVK_HUD=memory DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 1;" %command%
Yes..., the option that happened to be removed in further versions (https://github.com/doitsujin/dxvk/commit/eb8d1885bde916b3476229a9220952ad0f639ff9) happens to be the option that's crucial for this workaround to work...
I did surf the dxgi_adapter.cpp a little bit, it seems like this is all that the option dxgi.emulateUMA does.
if ((m_adapter->isLinkedToDGPU() && deviceProp.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) ||
options->emulateUMA) {
sharedMemory = std::max(sharedMemory, deviceMemory);
deviceMemory = 512ull << 20;
}
The deviceMemory must be set to anything in absurd value in order to get it working (in this case, 512 << 20 or 536870912), and the sharedMemory must be very low value. So I did try to set the maxDeviceMemory to an absurd value, but this code section blocked me away to do it...
// Some games are silly and need their memory limited
if (options->maxDeviceMemory > 0
&& options->maxDeviceMemory < deviceMemory)
deviceMemory = options->maxDeviceMemory;
if (options->maxSharedMemory > 0
&& options->maxSharedMemory < sharedMemory)
sharedMemory = options->maxSharedMemory;
I think we just need to remove true max memory limit to allow its users to freely set any values into it. We just need to warn them that it can be risky and may crash their machine, like below.
// Some games are silly and need their memory limited
if (options->maxDeviceMemory > 0)
deviceMemory = options->maxDeviceMemory;
if (options->maxSharedMemory > 0)
sharedMemory = options->maxSharedMemory;
Never freaking mind, I read the code thoroughly again, and all I need to do is to set both maxDeviceMemory and maxSharedMemory to the lowest possible but zero lol.
DXVK_CONFIG="dxgi.maxSharedMemory = 1; dxgi.maxDeviceMemory = 1;" %command%
Case closed!
The deviceMemory must be set to anything in absurd value in order to get it working (in this case, 512 << 20 or 536870912), and the sharedMemory must be very low value.
The in code value is in bytes which why the number is so big. deviceMemory = 512ull << 20; is just 512MiB.
In the 2.4 release the only thing the dxgi.emulateUMA option does is the equivilant of setting dxgi.maxDeviceMemory to 128 and dxgi.maxSharedMemory to the amount of vram you GPU has.
Now as you showed above the exact numbers changed a bit on master before the option got pulled but the concept is more or less the same.
While i was typing this i see you figured out it wasn't a high number anyway.
The reason setting something like dxgi.maxDeviceMemory to a low number is that you are telling the game that you have less vram than you actually have (1 being 1MiB) and if the game cares about that it might try and be more careful with it's usage.
When i tested it ingame it seems like it might be more aggressive in freeing vram again instead of keeping it around. Also maybe pulling less in to it to begin with? Not completely sure.
DXVK_CONFIG="dxgi.maxSharedMemory = 1; dxgi.maxDeviceMemory = 1;"x1 2024-08DXVK_HUD=memoryx3 2024-08DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 1;"x1 2024-08DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 2; dxgi.maxSharedMemory = 0; d3d11.zeroWorkgroupMemory = True; dxvk.halveNvidiaHVVHeap = True;"x2 2024-08DXVK_CONFIG="dxgi.emulateUMA = True"x1 2024-08DXVK_HUD=memory`x1 2024-07DXVK_CONFIG="dxgi.maxSharedMemory = 1; dxgi.maxDeviceMemory = 1;" %command%x1 2024-08DXVK_HUD=memory DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 1;" %command%x1 2024-08DXVK_HUD=memory DXVK_CONFIG="dxgi.emulateUMA = True; dxgi.maxDeviceMemory = 2; dxgi.maxSharedMemory = 0; d3d11.zeroWorkgroupMemory = True; dxvk.halveNvidiaHVVHeap = True;" %command%x2 2024-08
Zenless Zone Zero (not a Steam-published game but hey) seems to be suffering from a VRAM leak. Whether it's from upstream or a DXVK quirk, I can't be sure, but Windows players seem to be unaffected, or at least affected far more slowly. Comparatively, there have been numerous reports of both AMD/ATI and nVidia users getting game crashes 30 minutes to an hour into a gameplay session. I myself have been suffering these slowdowns, so much so that at the mere HINT of frames being dropped, I close the game and restart it to be able to play another relatively stable bout of 30 minutes.
Before anyone wonders about the issue title, I was trying to go for maximum alliteration. Basically, ZZZ is "oversubscribing" the VRAM and it seems as if it's assuming more memory is available than there is. Could be due to some DX11 APIs related to resource loading that have implementation quirks, i dunno.
Software information
Game: Zenless Zone Zero
Type: ARPG (Gacha, F2P - can be installed without paying)
Core Engine: Unity 2019.4.40 (ultra-customized, most likely)
Settings: High on everything. (No ultra available)
Resolution: 3840x1600 (ultrawide 21:9)
System information
2.3.1-120-gfe9c---Apitrace file(s)
Log files