protonscr

Worker count calculation formula

dxvkclosed question
doitsujin/dxvk#3257 · opened 2023-02-16 by rskryptik61636 · updated 2023-02-16 · 2 comments · github
Rrskryptik61636 2023-02-16 github

How was this worker count calculation formula devised? Was it by trial and error?

https://github.com/doitsujin/dxvk/blob/caf31033d711460e86781b16a4d9b0f41fa9e817/src/dxvk/dxvk_pipemanager.cpp#L100

Ddoitsujin maintainer 2023-02-16 github

This code is trying to solve two problems:

  1. Strike a good balance between fast shader compiles and leaving enough CPU cores for the game to run on. This is somewhat needed even with the low priority stuff, and I found that these numbers tend to do a reasonable job, it's certainly not perfect in all situations but in geneal we want to prioritize compiling shaders over minimizing the (temporary) performance hit anyway.
  2. Reserve some threads for latency-critical high-priority shaders. The idea is that if the app binds a shader that hasn't been compiled by any of the workers yet, we can add it to a high-priority queue and immediately start working on it to minimize the inevitable stutter, even if all other threads are busy. Without this, some games (such as Elex 2 on Nvidia) would hang for extended periods of time just waiting for shaders to build.
Rrskryptik61636 2023-02-16 github

Cool, thanks for the explanation 👍

Nothing extracted yet.