Closed HK47196 closed 5 years ago
This is not a bug, DXVK does not free once allocated memory blocks by design since doing so would require defragmentation, and is generally not very useful if the game needs more VRAM once again.
Stuttering apps could also be caused by high GPU utilization rather than memory pressure.
I'm facing something similar with ue4 titles (in the specific, shenmue 3 and borderlands 3) I've a 3GB nvidia gpu, and when the allocations reaches 2.9GB, fps drops drastically. Also experimented this with DXMD. Last game i tried in the steam free weekend was borderlands 3, his minimum requirements are 2GB of vram and maximum 3GB, but still at 2.9GB it drops fps from 40 to 18 if i'm lucky. The only way for it to recover is to restart the whole game. Also, i've to add that i'm using prime render offload, so the allocations on the gpu are entirely from the game itself. Unfortunately i don't tried how it performs on windows, but since they states minimum vram requirements at 2GB and reccommended 3GB, i wonder if somehow the game fails to keep the allocations under the limits or using DXVK just means to use more vram that the game requires.
In the end, if the root cause could not be fixed in an acceptable way, i also think that maybe adding a knob for the final user to trigger the discard of unused allocations and perform memory defragmentation could help in those ("corner?") cases.
I have the same issues in DCS world. Game runs fine for a long time, then suddenly FPS drops to below 5 and does not recover until restart. GPU memory usage is usually shown as slightly over 100%.
A lot of the time, this happens when switching views to something with very high texture resolution, which further indicates that VRAM is the issue.
I have not heard any windows users report this issue, though they usually get a lag spike at the same time. In their cases however, it recovers after a few seconds
D3D11 on Windows has much more advanced memory management that's almost impossible to implement in DXVK.
Turn down the texture quality.
Big news, once you're out of VRAM, performance drops.
Lower your settings, especially when using an Nvidia GPU.
Oh now I realised I may have been missunderstanding things and may have interpreted "never deallocates memory" as "never frees memory".
It still seems like DXVK might over-allocate more than the amount of VRAM available and have that affect performance even after the "true" usage drops down below that limit. Though do let me know if I missunderstood things again :)
DXVK allocates as much as it needs to do what the game asks it to do. When that exceeds VRAM, it will fall back to system memory.
DXVK does not move resources around, so if some resources got put into system memory and the game then frees some VRAM, those will stay in system memory.
Alright yea, that's what I was imagining. Would it be possible to run some sort of defragmentation when the amount of used VRAM drops back below the amount of VRAM available? Of course, this would probably cause additional performance hits if the VRAM usage goes between $VRAM_AMOUNT-1 and +1, but if VRAM usage comes and goes in bursts, as I imagine is the case when loading maps in squad for example, or when temporarily switching views to a plane with very fancy textures in DCS, it would prevent these temporary VRAM spikes from affecting performance permanently
Would it be possible to run some sort of defragmentation
No.
Last game i tried in the steam free weekend was borderlands 3, his minimum requirements are 2GB of vram and maximum 3GB, but still at 2.9GB it drops fps from 40 to 18 if i'm lucky.
This happens with all games if d3d9.evictManagedOnUnlock = True
d3d9.evictManagedOnUnlock becomes useless (after some time in the game fps drops to 10 or even to 1)
d3d9.evictManagedOnUnlock required for all memory limited x86 apps. Example all series gamebryo's engine (tes-4,f3,NV,etc) When using 'normal' textures not from past time 128x128
Is it possible to make a something like memory mapped file to swap vram with strict allocation (example ancient enboost)? Or some alternative solution?
Not use hd texures it is not solution :)
DXVK does not move resources around, so if some resources got put into system memory and the game then frees some VRAM, those will stay in system memory.
Am I understanding it correctly that, if VRAM was once full and, say, a texture was put into system memory because of that, that texture will never be moved to the VRAM, even if the required VRAM could be allocated later?
How is the texture accessed by the GPU then? Does it just DMA system memory whenever it needs the texture?
How is the texture accessed by the GPU then? Does it just DMA system memory whenever it needs the texture?
Yes.
Is it possible to see how much allocated VRAM has overflowed to system memory through the DXVK_HUD or external tools such as Mangohud/Goverlay?
Not really. Just seeing the size in bytes wouldn't be terribly useful anyway because putting regular textures in RAM is fine-ish while putting render targets or storage buffers/images into RAM will completely destroy performance.
Certain parts of Warframe use far more VRAM than the rest of the game. After going to one of the open world areas and leaving, DXVK reports memory allocated as 3GiB+† but memory used is generally <1GiB. This causes the rest of my system to stutter anytime the GPU is used with the game open(e.g., casual web browsing in a GPU accelerated browser.) I assume this is due to the driver falling back to using system memory instead of VRAM?
Software information
Warframe 64bit
System information
Log files
Screenshot of the game with DXVK_HUD=memory after triggering the issue: https://i.imgur.com/6j8Emf8.jpg
† — I think there may be a memory leak aggravating this(but is not the cause of this specific issue, I assume.) I'll have to do some more testing, but I noticed in open world areas the memory used slowly creeps up the longer I'm there.
edit: If there is a leak, it's on Warframe's end. Running the game in Windows exhibits similar behavior.