protonscr

Some games have frame dips every few seconds

dxvkclosed
doitsujin/dxvk#687 · opened 2018-10-06 by kakra · updated 2018-10-18 · 14 comments · github
Kkakra 2018-10-06 github

I have a few games that show frame dips every few seconds but only when moving around in the game. I'm pretty sure it is some sort of regression tho I do not exactly know when it happened (because not all games were affected).

The gist is: If you're standing still, the fps graph is perfectly smooth, even if you just turn the camera only. But if you start moving around, there's a frame dip and it's pretty evenly distributed over time: Path of Exile has this around every 2s, in The Witcher 3 the interval seems at little longer, maybe 2-3s. I didn't find other games with this problem yet. Using wined3d doesn't show this problem. The regression may have been introduced somewhere in the 0.7x series of DXVK but I only came aware of it with 0.72 or 0.80.

To rule out an issue with my settings or patches, I tried different combinations of patchsets and settings since 0.80 but the problem persists unless I use wined3d for DX11.

Another DX11 game I tested shows a similar but different issue: Shadow of the Tomb Raider freezes seemingly randomly for extended periods of time (every few minutes for 5-10s, does not always occur and does not always happen right from the start, seems to depend on the gaming area in which you are playing currently, like it's accumulating frame dips and then blocks until it catched up). When I look at vmstat from a ssh session, I'm seeing that usually vmstat shows 2-3 tasks running but after the freeze it shows that sometimes over 200 tasks have been running. The other vmstat sensors do not show any striking behavior: Except for a little bit higher IO counters after the freeze, everything is normal with low std-deviation. I first thought it may be due to some blocking in the filesystem when the shader cache threads write back the pipeline state - but it doesn't seem to be the issue.

I didn't investigate SOTTR extensively yet so I don't add it to the list of games affected here. I'm not sure if it results from the same issue. And I cannot really cross-check with wined3d because the game looks really strange with wined3d (many black-tinted textures, some polygons missing, polygons sticking out of the character faces like in a bad horror movie).

Software information

Path of Exile (Steam), The Witcher 3 (Steam)

System information

  • GPU: NVIDIA 1050 Ti 4GB
  • Driver: 396.54, 410.57
  • Wine version: 3.16, 3.17, master
  • DXVK version: 0.82 (actively observed since 0.80)

Log files

Ddoitsujin maintainer 2018-10-06 github

That's not a regression, that's just how these games work, and Nvidia in particular seems to have some weird frame timing issues with DXVK that can usually be fixed by enabling Vsync or an FPS limiter. Not a (new) bug.

Shadow of the Tomb Raider likely just stalls on shader compilation.

Mmartinpl 2018-10-07 github

Its looks more like frame skipping?

Kkakra 2018-10-07 github

There's latency peak in the FPS graphs... I'm currently experimenting with reworking the staging scheduler implementation and first results look like they improve things... But it really hurts some other games now.

Llieff 2018-10-07 github

With shader cache I have no random stutter with SOTTR on 980 GTX.
But I have performance degradation over time, probably VRAM fragmentation or something. Restarting the game fixes this.

Ddoitsujin maintainer 2018-10-07 github

I think the SotTR performance degradation is mostly boils down to having more and more pipelines and memory allocations to deal with on the CPU side. That cannot really be fixed.

Kkakra 2018-10-07 github

It looks like my scheduler changes in wine fixed the issue with SotTR. But I need some more time testing it. But so far I had no more freezes, and the loading screen also has no freezes nor sound problems any longer. Maybe something in the game engine gets out of sync, and scheduling the threads differently fixes it?

I'll now look what changed for me in other games. At least DOOM 2016 works correctly again (that was unplayable after the first try, now it's back to normal). A short test with TW3 and PoE looked promising (the effect was reduced but not completely eliminated, maybe I am on the right track here).

Llieff 2018-10-07 github

This not looks like pipeline or allocations count. It's too high 2-4x fps drop after load. If it's just slowed down malloc() then windows should suffer from this too (but it's not). If it's pipelines then shader cache should be much bigger than 6mb? Or it can create more and more of the same shaders and leaking old one?

Ddoitsujin maintainer 2018-10-07 github

No, but:

  • Shader lookup becomes more expensive as more and more pipelines get added to a global hash map. Obviously the number grows significantly over time (6MB state cache means >3k pipelines!)
  • The number of VRAM allocations that are used by the game adds a cost to descriptor set allocation and/or binding, depending on the driver. VRAM fragmentation contributes to a higher number of allocations being used, but it's unavoidable with games that dynamically stream textures in and out of memory.

At least that's what I can observe on my system. The first run of the integrated benchmark is the fastest, the subsequent run is a bit slower, but subsequent runs are about as fast as the second one.

Llieff 2018-10-07 github

Yes, I can expect a bit slower for one reload, but not such dramatical decrease (which even reproduced not every time). If it's really the case - using rbtree or Patricia Tree instead of hash table should improve things (guaranteed lookup for 4billion descriptors in 32 steps). And such drop after one reload should be nearly impossible.
But still, is it even possible that game uses texture from system memory?

Ddoitsujin maintainer 2018-10-07 github

How big of a drop do you see and what are your settings? For me it's like 5% at worst, but you're making it sound like you are having bigger issues.

Llieff 2018-10-07 github

Yes, it's much bigger drop 2-4x. Game becomes unplayable and you just can't open door with ice axe for example.

Kkakra 2018-10-07 github

I'm not seeing the slowdown over time... And I didn't see the SotTR issue I initially described any longer. Is it possible that this is simply some sort of priority inversion?

Llieff 2018-10-07 github

It can be settings dependent. My settings derived from max + textures ultra->high, shadows ultra->medium. I'll test medium textures soon.

Llieff 2018-10-18 github

I've played some time with medium textures settings, and there no huge fps drop over time.

Nothing extracted yet.