HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.93k stars 202 forks source link

Diablo IV - FPS drops after a while #1588

Open marco-kretz opened 1 year ago

marco-kretz commented 1 year ago

Hey there,

I played D4 the last fews days and I noticed a significant drop in FPS after playing for a while. Checking VRAM usage with radeontop tells me that VRAM is maxed out and hovers around 98%-101%. FPS when starting the game is fine at around 120fps but after playing for a while, visiting multiple different places, FPS drops start to appear (~20-40fps) to a grade where the game is no longer playable. Restarting the game "resets" the problem.

It does not seem to be Radeon-specific. Another user on Reddit with an NVIDIA card reported the same problem and that's why I thought it maybe is caused by vkd3d.

Software information

Diablo IV via Lutris High settings | Medium settings / VSync On|Off / FSR On

System information

K0bin commented 1 year ago

Windows is simply better at vram management and there isn't really anything vkd3d-Proton can do about it.

marco-kretz commented 1 year ago

Windows is simply better at vram management and there isn't really anything vkd3d-Proton can do about it.

Okay so the only thing I can do about it is getting more VRAM? I'm getting a 4070Ti today with 12GB VRAM, will see if it still happens then.. :(

Hacki95 commented 1 year ago

Im the other user with the nvidia card. Posting here in case any additional info is needed.

Even if Linux is worse in VRAM management than windows, does it make sense that even with Low settings it gets full after a few minutes and FPS begin to drop?

Under windows VRAM stays at a certain value and doesnt increase anymore. After a few hours of gaming yesterday I was at around 7 GB used from 8. Under Linux 8GB are full in a matter of minutes like it has problems freeing up VRAM again.

I don't have this issue with any other game as far as I can tell.

K0bin commented 1 year ago

Depends on how the game manages memory. It's not uncommon for games to decide the size of their texture streaming pool based on available VRAM.

marco-kretz commented 1 year ago

Hmm it seems like the problem was known (even on Windows) in the Beta: https://us.forums.blizzard.com/en/d4/t/diablo-4-eats-24-gig-vram/11234/18

Many threads complaining about the game eating up to 22GB VRAM. They seem to partially fixed it tho because I can't reproduce the exact same symptoms on Windows. What I encounter on Windows are no FPS drops, but lags and rubberbanding... Argh Blizzard, fix your game -.-

Hacki95 commented 1 year ago

Hmm it seems like the problem was known (even on Windows) in the Beta: https://us.forums.blizzard.com/en/d4/t/diablo-4-eats-24-gig-vram/11234/18

Many threds complaining about the game eating up to 22GB VRAM. They seem to partially fixed it tho because I can't reproduce the exact same symptoms on Windows. What I encounter on Windows are no FPS drops, but lags and rubberbanding... Argh Blizzard, fix your game -.-

Yes weirdly while the FPS are lower it still often feels smoother on Linux since it doesn't drop as hard.

Depends on how the game manages memory. It's not uncommon for games to decide the size of their texture streaming pool based on available VRAM.

Is there maybe a way to trick Linux into thinking it only has like 7.5 GB of VRAM to try and trick it into not overfilling the real VRAM? Wondered if that might help yesterday.

Blisto91 commented 1 year ago

Maybe for the game itself with dxgi.maxDeviceMemory in a dxvk.conf file placed next to exe (usually. Or point to it with DXVK_CONFIG_FILE) e.g. dxgi.maxDeviceMemory = 7500 or something. Tho it might not do anything since it's just what is reported to the game through dxgi

eXt73 commented 1 year ago

Have you tested driver 535.43.02 ? They significantly improve the VRAM memory management process - I checked it under Cyberpunk 2077.

marco-kretz commented 1 year ago

Have you tested driver 535.43.02 ? They significantly improve the VRAM memory management process - I checked it under Cyberpunk 2077.

I did not. I returned the 4070Ti because I got a 7900xtx for the same price. Will test when it arrives tho I think D4 has to do something on its side.

Smoukus commented 1 year ago

I am on AMD (RX 6800XT), and have noticed significant fps drop after playing for about 30 minutes. Also my entire PC would have the same FPS of the game whilst the game is open.

If I enter settings screen or open the map however, FPS becomes normal again.

It feels like 10 FPS. At the release of D4 i haven't had that issue. VRAM shouldn't be an issue.

K0bin commented 1 year ago

VRAM shouldn't be an issue.

Are you sure about that? I've seen Diablo 4 use 20GB of VRAM at max settings. It's a pretty broken in that regard.

Smoukus commented 1 year ago

VRAM shouldn't be an issue.

Are you sure about that? I've seen Diablo 4 use 20GB of VRAM at max settings. It's a pretty broken in that regard.

Well haven't had those drops when the game launched. Therefore haven't thought it could be a problem. I managed to get 3hr+ sessions at the launch, and haven't had the issue.

mbriar commented 1 year ago

Can't you just check again if VRAM is actually not the issue? Should be easy enough. Note that AMD drivers also don't support VK_EXT_pageable_device_local_memory, so they don't really benefit for the recent improvements in vkd3d-proton.

Smoukus commented 1 year ago

Just checked right now with mangohud.

FPS dropped from around 150 to 30 after around 30 minutes of playtime.

From the first minute VRAM usage was going from 15.1GB - 15.7GB.

Now after the FPS dropped to 30, VRAM usage is still the same (jumping from 15.1GB to 15.7GB, but mostly staying at 15.5GB).

Because the VRAM usage was the same from the first minute, I doubt that the issue is that because the FPS was great for the first 30 minutes.

K0bin commented 1 year ago

So VRAM is full. Performance probably drops off the cliff because the game re-allocates some performance critical resource and it ends up in system memory this time around.

mbriar commented 1 year ago

Looks 100% like VRAM is the issue to me. You're sitting at around ~95% utilization, and with fragmentation it can and will eventually happen that some critical render target gets spilled to system RAM. And because VRAM management is almost non-existent on AMD linux, it will stay there forever and tank fps until you restart the game.

Smoukus commented 1 year ago

Okay, that what both of you guys explained right now makes sense to me then. I am just curious as to why does it run smooth when in settings screen or while the map is open. But I guess no rendering is being made when those things are on the screen.

So I guess there's nothing I can do on my end? I don't want to make the game look worse via settings just to circumvent the VRAM issue.

K0bin commented 1 year ago

I am just curious as to why does it run smooth when in settings screen or while the map is open. But I guess no rendering is being made when those things are on the screen.

Probably doesn't use any render target thats allocated in system memory in that case.

So I guess there's nothing I can do on my end? I don't want to make the game look worse via settings just to circumvent the VRAM issue.

Reduce texture quality.

marco-kretz commented 1 year ago

[...] And because VRAM management is almost non-existent on AMD linux, it will stay there forever and tank fps until you restart the game.

Out of curiosity, why? This seems, at least for me, something super crucial for a graphics driver, isn't it?

But nonetheless, problem also exists with NVIDIA.

K0bin commented 1 year ago

On Windows it's handled by WDDM, a part of Windows itself.

mbriar commented 1 year ago

I don't really know why, but it sounds to me like latest vkd3d-proton master together with latest nvidia drivers and VK_EXT_pageable_device_local_memory is supposed to help this case. (but only if the game uses D3D12's MakeResident()/Evict() properly? If it just relies on WDDM magic to be smart enough about moving stuff around then it won't help, i think)

From my understanding, AMD vulkan drivers use a "global bolist" for every application that uses descriptor indexing (all games on vkd3d-proton use this), where every resource is always valid/in-use for every submission, which sounds like it would make implementing VK_EXT_pageable_device_local_memory in a useful fashion very difficult and already makes VK_EXT_memory_priority pretty much a no-op. In addition, RADV also always adds GTT to the preferred heap (see https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6833/diffs), which means the kernel driver has absolutely no idea what is important to keep in VRAM or move back to VRAM as soon as possible, and what is ok to spill.

Hacki95 commented 1 year ago

I have not been able to test the new 535 drivers yet I will report back once I do.

Reduce texture quality.

This is only a very temporary fix, change the area once and its full again.

[...] until you restart the game.

for me its even worse. Ive come to notice that at a certain point the performance is more than halfed and only a full restart of my PC can fix it. I have no idea whats going on it that regard and I am not sure yet if I can replicate this every time.

For now I was so frustrated with playing d4 under linux that I boot into my windows os when I feel like playing. I will try to tinker around again though with the new drivers this weekend and see if that fixes any of the issues.

burghoffdavid commented 1 year ago

Same issue here:

Initially it runs great, but after porting to a couple locations, performance drops drastically (120 fps --> 26 fps) and frametimes become erratic. Observed vram usage while gaming, it seems like it never deallocates any vram, it just keeps rising, up to the point of showing gray ground textures on the high preset. When in instanced dungeons, its a bit better but you can still observe framedrops and lower fps. Even when setting everything to low, it eventually uses close to 8GB of vram.

Also tried the suggested VK_EXT_pageable_device_local_memory fix, sadly it did not help...

Edit: For anyone wondering what the gray textures look like (Medium preset). Another thing I noticed, once you stand still for a while, fps and frametimes normalize.

image

Hacki95 commented 1 year ago

I also tried out some new things with the new drivers those are my findings:

Edit: For anyone wondering what the gray textures look like (Medium preset). Another thing I noticed, once you stand still for a while, fps and frametimes normalize.

When you change your texture settings and click apply, so the game reloads some assets then the ground will look normal again and FPS will also be normal for a little while until it fills up again. If you make your mangohud show VRAM you can see it for yourself.

Also trying to trick Linux into thinking it has less VRAM like I wanted to try doesnt seem to help at all.

Hacki95 commented 1 year ago

I was able to play for several hours today without any big issues.

The main thing I changed was setting the overall graphic settings to medium instead of medium with high textures.

My VRAM hovered around maximum of 7,8-7.9 GB sometimes slightly decreasing and sometimes increasing. So it seems like it does indeed free up VRAM occasionally. Once I've set the textures to high again it always got to 8GB and began dropping frames as low as 30FPS.

Under Windows I can play with high settings and some VRAM to spare so it seems like its still not running ideally but at least I found a way how to make it somewhat playable, although with much worse performance.

allfoxwy commented 1 year ago

Greetings everyone.

I'm new to the game, actually created my character today. However I didn't notice this FPS drop problem.

I'm on Debian with VKD3D 72dc32d139a1f64319a5ae230ba390f0971eef54 And NVIDIA RTX 3080 10GB

I'm using a special WINE which is built for Final Fantasy XIV: https://github.com/goatcorp/wine-xiv-git/releases/tag/8.5.r4.g4211bac7

My point is that this WINE version's changelog says "Fixes stuttering after around 40 mins of gameplay"

Maybe you could try it either to see if it help?

Hacki95 commented 1 year ago

Greetings everyone.

I'm new to the game, actually created my character today. However I didn't notice this FPS drop problem.

I'm on Debian with VKD3D 72dc32d And NVIDIA RTX 3080 10GB

I'm using a special WINE which is built for Final Fantasy XIV: https://github.com/goatcorp/wine-xiv-git/releases/tag/8.5.r4.g4211bac7

My point is that this WINE version's changelog says "Fixes stuttering after around 40 mins of gameplay"

Maybe you could try it either to see if it help?

I might try it and see if it helps. With my latest tests I used GE-Proton-8.8.

Are you playing on at least high settings though? I have a feeling it might has something to do with the Texture Quality settings. Too high fills up too much VRAM.

Ive seen some other reports recently though that people also experience this problem on windows. It might be a problem with the game itself after all that just gets worse on linux.

Cybereu commented 1 year ago

Greetings everyone. I'm new to the game, actually created my character today. However I didn't notice this FPS drop problem. I'm on Debian with VKD3D 72dc32d And NVIDIA RTX 3080 10GB I'm using a special WINE which is built for Final Fantasy XIV: https://github.com/goatcorp/wine-xiv-git/releases/tag/8.5.r4.g4211bac7 My point is that this WINE version's changelog says "Fixes stuttering after around 40 mins of gameplay" Maybe you could try it either to see if it help?

I might try it and see if it helps. With my latest tests I used GE-Proton-8.8.

Are you playing on at least high settings though? I have a feeling it might has something to do with the Texture Quality settings. Too high fills up too much VRAM.

Ive seen some other reports recently though that people also experience this problem on windows. It might be a problem with the game itself after all that just gets worse on linux.

What appears to mitigate the issue for me is either reducing the anisotropic filter.

Maybe this issue is related to: https://forums.developer.nvidia.com/t/graphical-regression-in-elite-dangerous/247010/9

allfoxwy commented 1 year ago

Are you playing on at least high settings though? I have a feeling it might has something to do with the Texture Quality settings. Too high fills up too much VRAM.

Yes, high settings on a 1080p screen with FSR 2 set to Quality.

I didn't finish the whole mainline story in the game, so maybe it's just too few mob on my screen.

NextWork123 commented 1 year ago

I'm facing that issue as well. I play Diablo IV with Lutris, and the first 30 minutes are very smooth. However, after that, the frame rate drops to 50-30, making it unplayable because the game consumes all the VRAM.

Edit: I put proton-ge-custom and is working without issue if someone have that issue i suggest to try that.

eszlari commented 1 year ago

@adamnv As the author of #1543, maybe you can tell us if Nvidia could fix this on the driver side?

darksidewalker commented 1 year ago

Can confirm that if textures are set to high the ground gets removed or clips. I updated today to the nvidia 535.54.03 and lutris-ge-proton 8.10. Game is on 1.4 and vk3d is latest, build today.

Game is only stable on medium trextures, the other settings just does not matter for me.

RTX2070s, Ryzen 7800X3D, 32 GB RAM, Kernel 6.4.2

plfort commented 1 year ago

@marco-kretz did you try to downgrade vkd3d to v2.8 in Lutris settings ?

Blisto91 commented 1 year ago

@marco-kretz and others can you check this issue again? The 1.1.1 patch supposedly improves vram management in the game.

darksidewalker commented 1 year ago

@Blisto91 problems persist. On high settings the ground textures still clip or load very slowly. I'm using the latest vkd3d (build) and latest drivers/kernel, Lutris-GE-proton-8-13 on Manjaro. I'm using a RTX2070S and Ryzen 7800X3D (latest BIOS Gigabyte), 32GB RAM and DLSS balanced. Most settings on medium, otherwise you get clipping and massive stutters/framdrops.

I had some tests yesterday. SSAO is directly related to this most of the time. If it is OFF, it almost never clips and the higher the setting, the faster it clips.

darksidewalker commented 1 year ago

Did some more testing. Re-installed everything (Lutrix, BattleNet app and D4) from scratch. Shadow quality and SSAO had the biggest impact on constant framerates and frame drops when loading new areas and textures.

I have included my LocalPerfs.txt for settings to compare. With these settings I got a stable 60 FPS with 50-65% GPU utilisation in the Kehjistan desert and in towns and dungeons. In Scosglen (Corbach) it goes up to 80% GPU usage.

Here comes the bad part: After some transitions from one world area to another (like Kehjistan to Fractured Peaks) I sometimes get 100% GPU load with unstable ~30-50 FPS.

My 8GB VRAM was always completely full and I did not install the high resolution textures.

One good thing is that there were no missing textures atm. LocalPrefs.txt

darksidewalker commented 1 year ago

Capping the Max Foreground FPS to 60 and the Max Background FPS to 60, 30 and 8 has the floowing effect at my system.

The frametimes are:

Reverting D4 back from background to foreground:

Otherwise my CPU Ryzen 7800X3D is at 3-5% while playing and ~30% while transitioning to new areas. Switching background and foreground does not impact the usage at all.

Edit: The GPU is at 60-80%.

DaisZen commented 1 year ago

Still the same issue since the game release, this time with:

How do I try it ?

Changing the textures from high to medium resets the problem... until it goes back later.

deathxxx123 commented 1 year ago

@marco-kretz and others can you check this issue again? The 1.1.1 patch supposedly improves vram management in the game.

Still present vram leak. I have Pop!_OS, Manjaro Gnome. Nvidia 3060 TI 8GB Try with lastest stable driver and lastest beta driver. Same vram leak. Just look at MANGOHUD and walking in town forward and back and see how Vram increasing up to max. Then little stutters appear and bigger when i dash forward. Blizzard did not fix anything. Any other game i have - don't have vram issue! I tested with Steam and Battle.net releases. With Steam release run much better, but both have vram leak.

Blisto91 commented 1 year ago

You should report it to Blizzard. I still see reports of the same on Windows.

deathxxx123 commented 1 year ago

You should report it to Blizzard. I still see reports of the same on Windows.

Yes, but they does not care about Linux. I have win11 also and have drop FPS too, but not inspect it still. Maybe is same issue.

Edit: I try on win11 and issue is fixed. but not very well. Vram still move little up and down +- 1-2GB. Its a work around Blizz fix. Mostly stay about 6.8GB. In linux is in begining only. Then go to 8GB all time.

joexzh commented 1 year ago

~~Enable SGX (Intel® Software Guard Extensions) in BIOS / UEFI solved the problem for me, but I wonder why. With SGX, VRAM is at most 7.977 / 8 GiB, no longer cause GPU 100% usage and fps drop in Diablo IV.~~

Sorry it still happens, didn't realize the texture quality was set to low during the test. Once set to medium or high, teleport to different cities, fps drops, that's sad.

System Information:

deathxxx123 commented 1 year ago

I think the Blizz vram leak fix is using some of win11 features to keep clean unused vram. For that for wine or proton this is still no fix. I watch it on steam deck, and vram usage are rock soild without moving up or down. But there are mesa and radeon. I have radeon cards and will test with them for you my friends. I think open-source driver will do better.

deathxxx123 commented 1 year ago

So i'm back from testing with Radeon card. OS: POP!_OS 22.04 LTS Video: Radeon RX480 8GB Driver - open source (just install POP!_OS and steam)

In Diablo 4, no problem with VRAM leak(it is super soild) or lag. I play like 2 hours and game was super smooth. It's Radeon made. ANd there was one more update to Diablo 4, so i will test with Nvidia again with this update.

To be clear: i only change the videocard, all other specs are the same, even the OS.

deathxxx123 commented 1 year ago

I test again with nvidia 545.29.02 driver RTX 3060TI 8GB And i got my VRAM eaten up to 8GB just with few teleportation to other locations. So this issue is for Nvidia only. I could try with nvidia-open driver, but everything is slow - even desktop, so i cannot test.

deathxxx123 commented 1 year ago

Me is again. Now for Nvidia cards we may have a fix or workaround. I got no VRAM leak with this launch option: PROTON_HIDE_NVIDIA_GPU=1 %command% I don't know why this is working, but now VRAM never reach 8GB, but stay around 6.8 / 7.4GB depends of area. I play like 2 hours with this option and teleport to like 30 areas and VRAM usage is stable.

And please, other guis with Nvidia cards, try this to see if this is working only for me. Driver i use is: 545.29.02 Steam client Beta Pop!_OS 22.04

DaisZen commented 1 year ago

I haven't tried your solution yet @deathxxx123 because I suppose it would disable access to DLSS. But also because I tried downgrading vkd3d to 2.8 (as someone said earlier in this thread) and i managed to play hours all this week-end without any texture bug, and the only performance problem is that after hours i began losing a bit of FPS. Oh, And I couldn't watch a stream on my second monitor without having performance issues too.

deathxxx123 commented 1 year ago

I haven't tried your solution yet @deathxxx123 because I suppose it would disable access to DLSS. But also because I tried downgrading vkd3d to 2.8 (as someone said earlier in this thread) and i managed to play hours all this week-end without any texture bug, and the only performance problem is that after hours i began losing a bit of FPS. Oh, And I couldn't watch a stream on my second monitor without having performance issues too.

Yes, you lose DLSS option, but AMD FSR 1.0 is much better, eat less VRAM and drop GPU usage more than DLSS or FSR 2.0. I play with steam version with lastest Proton with no problem.

sir-wallaby commented 10 months ago

I got no VRAM leak with this launch option: PROTON_HIDE_NVIDIA_GPU=1 %command%

I can confirm, this seems to resolve both - the low quality textures popping in after 'porting to a new location and the performance drop.

Driver Version: 535.146.02 RTX 3070ti

mutotemiz commented 7 months ago

PROTON_HIDE_NVIDIA_GPU=1 %command%

Does this fix work on the Lutris installation as well? Since Lutris is using wine, not proton...