protonscr

strict validation of pipeline state cache possible directly after DXVK loads?

dxvkclosed
doitsujin/dxvk#891 · opened 2019-01-27 by aufkrawall · updated 2019-01-28 · 6 comments · github
1 matching comments, n / p to jump
Aaufkrawall 2019-01-27 github

When I update radv, I notice that performance in Heroes of the Storm suffers (stutter) for some minutes until the state cache is completely updated. Most updating seems to be done during loading times, but it doesn't suffice entirely.
Would it be possible to implement a "hard validation check" directly after each start of the game to prevent this?

Ddoitsujin maintainer 2019-01-27 github

What exactly do you mean?

If the game decides to compile shaders during runtime (i.e. after loading the level), there's always going to be stutter, even on Windows, because the shaders themselves are simply not available before that.

Aaufkrawall 2019-01-27 github

I suppose I misunderstood the way the state cache works then. The game also shows an increased amount of stutter on Windows DX11 until the driver's shader cache is populated. Maybe it just doesn't feel as bad due to supposedly lower shader compile time.

OOschowa 2019-01-27 github

I thought something similar, i would have expected the state cache to work like this:

  1. Play level A oft game X; state cache and driver cache get filled up.
  2. Update driver.
  3. Relaunch game, let it sit in the menu for ~10 mins; pipelines in the state cache get compiled in the background.
  4. Replay level A without stutter.

But currently there is still stutter in step 4. I don't know if it's actually possible the way i described it, but i remember a feral guy mentioning that their RotTR port does something similar, so maybe dxvk could do it aswell?

Ddoitsujin maintainer 2019-01-27 github

Feral has source code access to the games they port, they can and do change what is done during loading, and as a result, RotTR has longer loading times on Linux than on Windows, but overall runs smoother. DXVK can't do anything like that at all.

The issue with the state cache is that it does not cache shaders, so it only kicks in once the game itself actually wants them compiled. Most games do this while loading or at least with enough time between Compile*Shader and first use so that the state cache can compensate, but some don't, and those will stutter, and those will stutter even on Windows after a driver update. Witcher 3 would be another example where this happens.

Now in theory it would be possible to cache all shaders and compile them in the background, but there are significant drawbacks to that approach as well:

  • Compiled shaders can take hundreds of Megabytes of disk space per game. Even if you don't really care about disk space, managing that amount of data efficiently is hard and writing it all to disk is just inherently slow, especially when it happens while loading the game (just enable DXVK_SHADER_DUMP_PATH, you'll see what I mean).
  • Compiling all shaders for one game at once can take several minutes and we basically have no idea which ones we're actually going to need first. This is a problem with games like Quake Champions as well, which compiles all its shaders up front and leaves you sitting with 100% CPU load for ~5 minutes on a Ryzen 2700X.
  • It is just not useful for the majority of games.
Mmassatt212 2019-01-28 github

is it possible to compile all cashe
so i dont have to stutter the next time ?

Aaufkrawall 2019-01-28 github

The answer is in the very post above yours. My short interpretation of it: It's too impractical to be considered.
I think my initial question is well covered, thanks again @doitsujin .

Launch options