Mesa (master): radv/winsys: always allow GTT placements on APUs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 11:54:43 UTC 2020
Module: Mesa
Branch: master
Commit: 28c227c7ca33669d8857f810c23a21a67d53d571
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=28c227c7ca33669d8857f810c23a21a67d53d571
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Thu Apr 30 20:47:46 2020 +0200
radv/winsys: always allow GTT placements on APUs
When the VRAM size is small and the preferred heap only VRAM,
the kernel tries to always honor the requested heap and it does
a ton of evictions which is a disaster for performance.
On APUs, VRAM and GTT have similar performance, so allow the
kernel to choose the best placement (GTT or VRAM) itself.
This gives a huge performance boost with Doom Eternal on RAVEN.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5665>
---
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 5afb274f1e6..2d153873bfd 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -379,8 +379,19 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
request.alloc_size = size;
request.phys_alignment = alignment;
- if (initial_domain & RADEON_DOMAIN_VRAM)
+ if (initial_domain & RADEON_DOMAIN_VRAM) {
request.preferred_heap |= AMDGPU_GEM_DOMAIN_VRAM;
+
+ /* Since VRAM and GTT have almost the same performance on
+ * APUs, we could just set GTT. However, in order to decrease
+ * GTT(RAM) usage, which is shared with the OS, allow VRAM
+ * placements too. The idea is not to use VRAM usefully, but
+ * to use it so that it's not unused and wasted.
+ */
+ if (!ws->info.has_dedicated_vram)
+ request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
+ }
+
if (initial_domain & RADEON_DOMAIN_GTT)
request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
if (initial_domain & RADEON_DOMAIN_GDS)
More information about the mesa-commit
mailing list