From 755b2d59a9d1cbb731f2ef867ee6e61ae44454b9 Mon Sep 17 00:00:00 2001 From: Ivan Avdeev Date: Thu, 14 Sep 2023 13:57:59 -0400 Subject: [PATCH] vk: fixup BLAS preallocation on Linux/amdgpu Fixing pool allocator to properly signal allocation failure uncovered an existing issue where we were lacking enough memory for dynamic model BLASes on Linux/amdgpu. Erroneously the same memory region was used for >1 BLAS. Surprisingly this hasn't led to any noticeable issues so far. Increasing accels buffer size fixes the issue. --- ref/vk/vk_ray_accel.c | 2 +- ref/vk/vk_ray_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ref/vk/vk_ray_accel.c b/ref/vk/vk_ray_accel.c index 1f40a798..e3c49bb4 100644 --- a/ref/vk/vk_ray_accel.c +++ b/ref/vk/vk_ray_accel.c @@ -80,7 +80,7 @@ static VkAccelerationStructureKHR createAccel(const char *name, VkAccelerationSt const alo_block_t block = aloPoolAllocate(g_accel.accels_buffer_alloc, size, /*TODO why? align=*/256); if (block.offset == ALO_ALLOC_FAILED) { - ERR("Failed to allocated %u bytes for blas \"%s\"", size, name); + ERR("Failed to allocate %u bytes for blas \"%s\"", size, name); return VK_NULL_HANDLE; } diff --git a/ref/vk/vk_ray_internal.h b/ref/vk/vk_ray_internal.h index 33a48b06..decf0f51 100644 --- a/ref/vk/vk_ray_internal.h +++ b/ref/vk/vk_ray_internal.h @@ -40,7 +40,7 @@ struct vk_combuf_s; qboolean createOrUpdateAccelerationStructure(struct vk_combuf_s *combuf, const as_build_args_t *args); #define MAX_SCRATCH_BUFFER (32*1024*1024) -#define MAX_ACCELS_BUFFER (64*1024*1024) +#define MAX_ACCELS_BUFFER (128*1024*1024) typedef struct { // Geometry metadata. Lifetime is similar to geometry lifetime itself.