doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
12.98k stars 833 forks source link

Overwatch 2 (D3D11) - Low performance, high RAM usage with GPL #3813

Open 3DMicks opened 8 months ago

3DMicks commented 8 months ago

Software information

Overwatch 2 on Steam (https://store.steampowered.com/app/2357570/Overwatch_2/) Any graphical preset, mainly tested on Low

System information

Log files

The game's logs are hundreds of megabytes due to spam: warn:seh:dispatch_exception unknown exception (code=6ba) raised 5 times, then warn:seh:dispatch_exception EXCEPTION_PRIV_INSTRUCTION exception (code=c0000096) raised once, then warn:seh:dispatch_exception EXCEPTION_SINGLE_STEP exception (code=80000004) raised ~140k times, then finally warn:seh:dispatch_exception EXCEPTION_ILLEGAL_INSTRUCTION exception (code=c000001d) raised when I close the game. So here is a version that cuts it off after a few of them (from ~400 MB). Let me know if I trimmed anything important: steam-2357570-trim.log steam-2357570-trim-nogpl.log

Description

OW2 suffers from high RAM utilization with GPL enabled

With GPL enabled, the game initially uses ~5 GB of RAM and after around 7 minutes of "Compiling Shaders" the game settles on 8.5 to 9 GB of RAM. Without GPL, "Compiling Shaders" still occurs for several minutes but RAM utilization only gets close to 6 GB. On Windows, the game uses only 5 GB. Steam does compile shaders and all of that, but it has no effect; the game still compiles shaders every time you open it, with the first time going from 0% to 100% and every subsequent run just does "Compiling Shaders" with no number.

In-game FPS drops to roughly half of whats expected, even for Linux

With the system I tested on Low, the game previously (before coming to Steam) ran at around ~180 FPS on the Practice Range, and currently it sits at around ~90 FPS with its latest version. That 90 FPS is not stable, however. After loading a map, the game does run slightly above that 50% FPS range, but shortly after drops and becomes unstable. I have also noticed that my mouse's polling rate affects the game significantly, roughly like this: 1000 Hz ~35% FPS drop, 500 Hz ~12%, and 250 Hz is negligible. In other Wine games this doesn't happen.

Two ways I know how to force shaders to compile and stress the game to help tests are: playing the 1 dad vs 11 kids custom game mode which switches everybody's heroes every minute, and the HEZHJ benchmark workshop code (Custom game -> Create -> Import code). On my more powerful machine the FPS issues are less noticeable overall but still a massive downgrade.

doitsujin commented 8 months ago

Not really a bug or an issue, just how GPL inherently works.

We compile we compile a very large number of shaders up front, extra memory usage is fully expected. Can be mitigated by setting dxvk.trackPipelineLifetime = True in the config file, which we already do by default for 32-bit games for this reason, but this may reintroduce some stutters since we now have to go through the driver's disk cache to compile pipelines on the fly.

High CPU usage when compiling optimized pipelines in the background also isn't unexpected at least for some time after loading into a new area. Again, can be mitigated by setting dxvk.enableGraphicsPipelineLibrary = True which disables those optimized pipelines, but this will come at the cost of GPU-bound performance.

All of this is exacerbated by the fact that Nvidia's compiler just isn't very fast compared to e.g. RADV, and pipeline objects are for some reason also significantly larger than on other drivers, but that is outside of our control.

I have also noticed that my mouse's polling rate affects the game significantly, roughly like this:

This is not our problem, and most likely related to wineserver sitting at 100% CPU.

and every subsequent run just does "Compiling Shaders" with no number.

This means the individual compile batches complete fast enough that computing a percentage isn't meaningful. Again, normal. Keep in mind that the game actually has to load its D3D shaders as well, which is not free, they don't magically fall from the sky.

3DMicks commented 8 months ago

Replying to https://github.com/doitsujin/dxvk/issues/3813#issuecomment-1907934772

Thanks for the response! I didn't know about the trackPipelineLifetime config option and I'll definitely test it. I still have some questions though:

High CPU usage when compiling optimized pipelines in the background also isn't unexpected at least for some time after loading into a new area.

Indeed, that is expected, but I might have made a mistake in not mentioning that this happens when you open the game itself (i.e., the main menu, hero list, etc.) and is independent of any actions like loading a map or previewing a hero. I also forgot to mention that the CPU usage isn't particularly high, it just takes a long time and the FPS is unstable while it's happening. This is an issue that has been in the game since it was released and is probably an engine quirk.

> I have also noticed that my mouse's polling rate affects the game significantly, roughly like this: This is not our problem, and most likely related to wineserver sitting at 100% CPU.

I test the mouse issue after the compilation and benchmarking/forcing more shaders to compile, my CPU usage is ~15 to 30% when not moving the mouse in-game and it goes up to ~55% when moving while looking at the sky in the practice range.

Finally, performance was better before the game came to Steam, that's why I say I get ~50% of the expected FPS while my laptop didn't change specs. I suspect this may be caused by a game update along the way, but I can't tell.

IngeniousDox commented 8 months ago

About the mouse issue: In the past (5 years ago?) , I had a similar issue with about the same setup as you (desktop nvidia, not laptop). The solution I found was disabling polling for drm_kms_helper. I took this solution from:

https://superuser.com/questions/528727/how-do-i-solve-periodic-mouse-lag-on-linux-mint-mate

It solved weird lag for me when looking around in OW and WoW at that time. I still have this set, but perhaps the issue is still present and this will help. Should be easy enough to test.

3DMicks commented 8 months ago

Replying to https://github.com/doitsujin/dxvk/issues/3813#issuecomment-1913127205

Thanks for the recommendation, but unfortunately, this didn't help. It looks like they all say that they have problems in the desktop or random lag which I don't have, the module isn't loaded and doesn't load (I can't even find info about it), and they all use Ubuntu while I'm on Arch (EOS). I only have a problem with OW2, so It's probably either a Wine issue or an DXVK issue. Also, they are all from around 2013 to 2018 and a lot has changed since then.

I also know that people have been complaining a lot about high polling rate mice in Wine causing lag since time immemorial, so maybe it's just Wine devs not caring or smth.

IngeniousDox commented 8 months ago

I'm on Arch, I set it on Arch in 2018. I set it because my 1000hz mouse was causing lag in Wine when looking around in WoW and OW. This was the solution. I never changed a thing since then, and it is still there, well, at least for me. Here is a link to ArchWiki KMS page that still talks about setting this (though in context that polling simple can lag you).

It used to be needed by nvidia_drm, which loaded drm_kms_helper. However, it does seem that module isn't loading indeed or at least no longer needed for nvidia_drm, I do not know at what point that changed. But! I still can toggle it with /sys/module/drm_kms_helper/parameters/poll. Though at this point I'm unsure what is providing it, perhaps nvidia_drm? I'm loading with nvidia_drm.modeset=1 nowadays, so that is most likely the change. However I also have a intel gpu on my processor, even though I don't use it at all, so perhaps it has something to do with that.

In your case: I also assumed you had intel + nvidia. Rereading your specs I'm slightly confused to what you have. Is MX350 your normal gpu in your laptop, and 1650 your 2nd gpu? What is your GPU? Does your CPU not have a igpu?

Oh, and did you have this issue with 535 driver as well? 545 has had some issues for multiple people. And 550 is also available now in beta.

3DMicks commented 8 months ago

Replying to https://github.com/doitsujin/dxvk/issues/3813#issuecomment-1913294380

In your case: I also assumed you had intel + nvidia. Rereading your specs I'm slightly confused to what you have. Is MX350 your normal gpu in your laptop, and 1650 your 2nd gpu? What is your GPU? Does your CPU not have a igpu?

I have two laptops with Intel + Nvidia, one with an MX350 and one with an 1650

Oh, and did you have this issue with 535 driver as well? 545 has had some issues for multiple people. And 550 is also available now in beta.

Yeah, I'll wait until 550 hits stable and maybe it'll fix some of the issues. Plasma 6 might also help. Thanks for the recommendation though!

IngeniousDox commented 8 months ago

Ah, that makes sense again!

Some quick thoughts:

Oh and side note: I disabled GPL for OW myself. The old cache stutters during game-play till it fills up, but for me it always used less CPU and felt faster on my rig. Make sure you have big enough __GL_SHADER_DISK_CACHE_SIZE so it doesn't get cleaned out on subsequent starts (then dxvk has to use dxvk_cache to recompile it every time you start up the game).

3DMicks commented 8 months ago

Replying to https://github.com/doitsujin/dxvk/issues/3813#issuecomment-1913332044

I tested setting the parameter before you even commented, actually, but unfortunately it had no effect; the dxgi setting also had no effect; NVAPI and spoofing AMD also had no effect.

Oh and side note: I disabled GPL for OW myself....

Yeah, I'm doing the same and setting __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1. Still, thanks for the suggestions!

ibrokemypie commented 7 months ago

might not be the same issue but on nvidia (driver 550, 545 also the same) using latest proton (proton-experimental or proton-ge), if I disable steam's shader precompilation I end up having 5-10 minutes of low fps/stutters and maxed out cpu (~100% load on every core) each and every time I launch overwatch. __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 had no effect.

this is on a 13600k + 4080 running arch

rvveber commented 2 months ago

Have the same issue. But i'll describe it with my own words.

I have 16GB of RAM and an NVIDIA GPU. v555 driver. And have tried all of the Tricks on ProtonDB. The game starts with 6.5 GB of memory and runs wonderfully smooth - until the memory usage hits ~11.5GB You can watch it go up at every stage of playing. (Lowest Settings btw. at 120fps) Then it begins to jitter, slow down ~30 frames and speed up ~30 frames again. Makes it unplayable.

Turning on PROTON_USE_WINED3D=1 makes the game even more unplayable but not related to a memory leak. Can we do anything to force clear memory, without restarting the game?