RADV Preference On Spilling Buffers To Help Discrete GPUs For Some Games
Hitting Mesa 21.1-devel on Saturday and marked for back-porting to stable series of Mesa is a change to improve spilling on discrete GPUs. Up to now the preferred heap for buffers has only set GTT (RAM) for APUs given that all the memory ends up being system RAM on current platforms with the integrated graphics. But this simple change drops the check over dedicated vRAM or not, thereby having the same behavior for discrete GPUs.
With this change is improved buffer spilling for discrete GPUs that helps in case of graphics cards with limited amounts of dedicated video memory relative to what is being sought by the game/application. As noted in the code comment for the reasoning, "Otherwise AMDGPU tries to place the buffers in VRAM really hard to the extent that we are getting a lot of unnecessary movement. This helps significantly when e.g. Horizon Zero Dawn allocates more memory than we have VRAM."
All that unnecessary movement up to now in trying to avoid buffer spilling has been hurting the performance for select games. The issue originally was reported via this bug report over the RADV Vulkan driver performing much slower than the likes of the AMDVLK driver when running Doom Eternal. But with this simple change, the performance is now much better for this and other games. AMDGPU will still prefer video memory for the initial buffer/heap placement so it shouldn't cause any problems otherwise.
This change, which helps out graphics cards with smaller amounts of video memory, should work its way to stable Mesa releases soon.