The Mesa RADV Vulkan Driver Will Soon Have An Option That Boosts Performance 30%+ On RDNA2 GPUs By Rendering Less
Those who have the very latest Radeon RX 6000 series graphics cards from AMD will get the option of doing fewer fragment shader invocations per pixel rendered in Vulkan games when Mesa 21.1 is released come May. This can provide a huge performance-boost, or nearly none at all, depending on the game or workload. The new Mesa option requires variable rate shading support in hardware, so it is only for those who have a shiny new GPU from AMD.
A MSI RX 470 GPU. It can do Vulkan, but it can't do Variable Rate Shading. It's just too old.
Variable Rate Shading is a part of the Vulkan specification that allows graphics drivers to do far less work by sacrificing some of the visual quality. The concept is pretty simple: You take a block of 4x4, 2x2 or 2x1 pixels and apply graphics shader operations to the whole block instead of each individual pixel. Cheating this way has two predicable results:
- The visual quality is lowered
- The GPU load used to do shader operations decreases and the number of frames per second goes up
Samuel Pitoiset from Valve has written two patches (1, 2) for the RADV Vulkan driver for AMD GPUs in the Mesa graphics stack that allow those who have a AMD graphics card with hardware support to enable Variable Rate Shading. Both patches, first submitted about two months ago, were accepted and merged into the Mesa master branch this weekend. They will be a part of Mesa 21.1 when it is released on May 5th.
The RX 6000 series graphics cards ("RDNA2") from AMD are currently the only cards cards with the required hardware support. It is simply not possible to implement this on older graphics cards from AMD.
Those lucky enough to have the shiny new and supported graphics hardware will be able to run Vulkan applications with a new
RADV_FORCE_VRS= variable that can take the arguments
Mesa-developer and Google-employee Bas Nieuwenhuizen has written a blog post about the VRS technology titled "A First Foray into Rendering Less". In it, he hints that
RADV_FORCE_VRS=2x2 can give a performance-boost of up to 30%. He does note that:
"Since we did not implement any postprocessing the quality loss can be pretty bad, so we restricted the reduced shading rate when we detect one of the following
- Something is rendered in 2D, as that is likely some UI where you’d really want some crispness
- When the shader can discard pixels, as this implicitly introduces geometry edges that the hardware doesn’t see but that significantly impact the visual quality.
As a result there are some games where this has barely any effect but you also don’t notice the quality regression and there are games where it really improves performance by 30%+ but you really notice the quality regression."
The Mesa developers seem to have made some wise trade-offs when the implemented variable rate shading. It is simply turned off in cases where there would be a huge impact on visual quality even if it is enabled with the
RADV_FORCE_VRS= variable. This won't apply on a per-game application, it is done on a per-frame basis. This means that some games will get a performance-boost up to 30% throughout the game, some will get a a boost in some parts and not others and some games will barely get any kind of performance-boost at all.
It is a shame that we do not have any shiny new RX 6000 GPU we can use to test how much of a performance-boost these latest patches provide and how the visual quality compares with and without
2x1. You will simply have to get a Mesa git snapshot and see for yourself if you have such a card and you're curious.
The patches are only for the Mesa graphics stack used on GNU/Linux, and they were written by a Valve-employee, not a AMD employee, so don't expect to see anything similar implemented in the Windows-driver for AMD cards in the immediate future.