protonscr

32-bit games crash on AMD APUs with radv

dxvkclosed bug
doitsujin/dxvk#640 · opened 2018-09-15 by BNieuwenhuizen · updated 2018-09-18 · 5 comments · github
BBNieuwenhuizen 2018-09-15 github

It seems like DXVK by default maps every buffer which can be mapped. On an APU all buffers are going to be able to be mapped, resulting in running out of address space in 32-bit applications.

RADV patch to get an APU like memory configuration:

From cb7415972bbd39b96f17da252a141ba9ae469508 Mon Sep 17 00:00:00 2001
From: Bas Nieuwenhuizen <[email protected]>
Date: Sat, 15 Sep 2018 17:54:02 +0200
Subject: [PATCH] radv: Fake APU memory

---
 src/amd/vulkan/radv_device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 8989ec3553f..f2736b78dd3 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -118,9 +118,13 @@ static void
 radv_physical_device_init_mem_types(struct radv_physical_device *device)
 {
        STATIC_ASSERT(RADV_MEM_HEAP_COUNT <= VK_MAX_MEMORY_HEAPS);
+       device->rad_info.vram_size = (device->rad_info.vram_vis_size / 2 + 4095) & ~4095ull;
+       device->rad_info.has_dedicated_vram = false;
+       
        uint64_t visible_vram_size = MIN2(device->rad_info.vram_size,
                                          device->rad_info.vram_vis_size);

        int vram_index = -1, visible_vram_index = -1, gart_index = -1;
        device->memory_properties.memoryHeapCount = 0;
        if (device->rad_info.vram_size - visible_vram_size > 0) {
-- 
2.19.0
BBNieuwenhuizen 2018-09-15 github

I thought I got agreement with Philip that this should be fixed in DXVK instead of worked around in radv. If there is really no plan for DXVK to fix it I may have to reconsider ...

For context: even if it happens to some degree on all GPUs the issue at hand here is that it is much worse for APUs, because DXVK pulls considerably more into the address space for these.

Ddoitsujin maintainer 2018-09-15 github

I'll try to fix this in DXVK. It's going to be a bit of work though, because right now i'm not tracking whether an allocation needs to be mapped or not.

Ddoitsujin maintainer 2018-09-17 github

eac86fab1536e070c9af703de3c4140069c20a61 should fix this for now. It's a rather simple solution that might slightly increase overall memory consumption on such systems, but should be good enough in practice.

VVadikLeshy 2018-09-17 github

Thanks. It seems, like Grey Goo (32 bit) is now runs fine on RADV 18.3-git and AMD Raven.

Launch options