Computer

This is why your games suffer freezes even with an RTX 3090

All games today have part of their source code that is executed by the GPU in the form of programs that we call shaders and that are executed in the homonymous units of the graphics processor. The name of these units changes depending on the brand we are talking about, for example they are called SM by NVIDIA, Compute Unit by AMD and Xe Core by Intel. Its function? Execute a series of programs that make use of the enormous capacity for parallel calculation, either for manipulating graphical primitives or for applying mathematical algorithms at high speed.

The shader compilation problem

Shader units differ in architecture from a conventional CPU and have certain shortcomings that prevent them from working in the center of a PC, but we will not go into this here, but one thing they do have is a register set and instructions and Since no one programs in binary, there are high-level languages ​​that humans can use to write such programs. The best known on PC? HLSL in DirectX and GLSL in Vulkan and OpenGL.

The problem on PC? The manufacturers themselves do not respect their ISA from one GPU design to another, this means that the shader programs cannot come compiled. We are not talking about the set of registers and instructions changing from one generation to another, but rather that this can even happen in the same family. This means that in PC games the shaders have to be compiled on the fly and supposes a loss of performance while we play.

Compilation of shaders has become a problem when playing many games on PC, especially in large open world games where data is continuously output to RAM as we explore the environment. and thus with few stops to load a new level, something that will become more common with the NVMe SSD. The reason? Load times in many PC video games are used to compile shaders.

This does not happen on consoles

Controls consoles optimization games console

A video game console does not change a bit of its specifications in its entire lifetime, which means that its GPU does not change and consequently neither does its ISA. In other words, it is not necessary to compile shaders on the fly like on PC and these are already compiled together with the rest of the game code.

This is a double-edged sword, for the backward compatibility of future systems. For example, much of the development of the Xbox Series and PS5 APUs has to do with understanding the binary of the previous generation shaders. At the same time Nintendo and NVIDIA facing the successor of Switch have to develop a variant that understands the shaders compiled for the GPU of the hybrid console.

The most logical solution to the problem

AMD FidelityFX GTA V

To solve the problem of compiling shaders in PC games, there are two different solutions:

  • Create a repository that the game can access during installation that has the shader code already compiled for each ISA of the different graphics cards. The problem is that this would make the developers have to maintain such a growing repository for a long time without any financial compensation.
  • Compiling the shaders during game installation takes a little longer, but game performance suffers.

What do we think the majority of developers will do? Use the cores of more of the different Intel and AMD CPUs to run the shader build with them. This is one of the background tasks that, for example, the Intel Core 12 E-Cores will do, although in general they will end up using several cores in parallel to compile the different shader programs as quickly as possible, especially when the times of The burden for this will be removed by the use of high-speed solid-state drives.

Related Articles

Leave a Reply

Your email address will not be published.