Valve Engineer Fixes Massive Performance Issue For RADV Driver With AMD FSR2
([Radeon] 3 Hours Ago
AMD FidelityFX Super Resolution 2)
- Reference: 0001503234
- News link: https://www.phoronix.com/news/AMD-FSR2-Mesa-24.3-Fix
- Source link:
With the upcoming [1]Mesa 24.3 release there is a huge improvement coming for those using the RADV Radeon Vulkan driver with games leveraging AMD FidelityFX Super Resolution 2.
Samuel Pitoiset of Valve's Linux driver team discovered a very important performance fix for the Mesa RADV driver so there isn't such a gpaing hole in the AMD FSR2 performance compared to using the AMDVLK/AMDGPU-PRO official Vulkan driver code from AMD.
The issue dates back to a [2]two year old bug report that the Mesa RADV driver performs "significantly less" than the AMDGPU-PRO driver for running the AMD FSR2 sample app. After not much activity on the issue the past two years, recently it ticked into interest of Valve engineers.
Samuel Pitoiset authored [3]this Mesa merge in the AMD NIR code to cull triangles/lines when all W positions are zero. He commented there that it " Fixes the massive performance difference between RADV and PRO with the FSR2 sample. " In the actual commit message Pitoiset elaborated:
"It looks like the fixed-func hardware is very slow to cull primitives with zero pos.w but shader based culling helps a lot.
This fixes a massive performance gap with the FSR2 demo compared to AMDGPU-PRO, +228% on RDNA2.
Based on my investigation, AMDGPU-PRO seems to always cull these primitives. Note that disabling NGG culling with AMDGPU-PRO reports the same performance as RADV without that fix. Also note that the FSR2 sample doesn't specify any cull mode (ie. VK_CULL_MODE_NONE is used), so this is the only reason PRO was culling more than RADV."
This 228% improvement for the AMD FidelityFX Super Resolution 2 (FSR2) performance comes with reworking less than one dozen lines of code.
The change is in Mesa 24.3-devel currently for this big improvement for those wanting to use FSR2 upscaling with the popular RADV driver.
[1] https://www.phoronix.com/search/Mesa+24.3
[2] https://gitlab.freedesktop.org/mesa/mesa/-/issues/7260
[3] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31891
Samuel Pitoiset of Valve's Linux driver team discovered a very important performance fix for the Mesa RADV driver so there isn't such a gpaing hole in the AMD FSR2 performance compared to using the AMDVLK/AMDGPU-PRO official Vulkan driver code from AMD.
The issue dates back to a [2]two year old bug report that the Mesa RADV driver performs "significantly less" than the AMDGPU-PRO driver for running the AMD FSR2 sample app. After not much activity on the issue the past two years, recently it ticked into interest of Valve engineers.
Samuel Pitoiset authored [3]this Mesa merge in the AMD NIR code to cull triangles/lines when all W positions are zero. He commented there that it " Fixes the massive performance difference between RADV and PRO with the FSR2 sample. " In the actual commit message Pitoiset elaborated:
"It looks like the fixed-func hardware is very slow to cull primitives with zero pos.w but shader based culling helps a lot.
This fixes a massive performance gap with the FSR2 demo compared to AMDGPU-PRO, +228% on RDNA2.
Based on my investigation, AMDGPU-PRO seems to always cull these primitives. Note that disabling NGG culling with AMDGPU-PRO reports the same performance as RADV without that fix. Also note that the FSR2 sample doesn't specify any cull mode (ie. VK_CULL_MODE_NONE is used), so this is the only reason PRO was culling more than RADV."
This 228% improvement for the AMD FidelityFX Super Resolution 2 (FSR2) performance comes with reworking less than one dozen lines of code.
The change is in Mesa 24.3-devel currently for this big improvement for those wanting to use FSR2 upscaling with the popular RADV driver.
[1] https://www.phoronix.com/search/Mesa+24.3
[2] https://gitlab.freedesktop.org/mesa/mesa/-/issues/7260
[3] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31891
dimko