radv: Use larger arena sizes.

For some games that take like 400 MiB of shader binaries, the
number of shader arenas ends up going >1500. Cut that down a bit
by using larger arenas.

8 MiB should still be decent with small BAR and should still cut
things down from ~1500 to ~50 buffers.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14591>
This commit is contained in:
Bas Nieuwenhuizen
2022-01-18 11:42:28 +01:00
committed by Marge Bot
parent 0f9756f480
commit 7adb3c0f7f
3 changed files with 8 additions and 1 deletions
+2
View File
@@ -99,6 +99,8 @@
#define RADV_SHADER_ALLOC_ALIGNMENT 256
#define RADV_SHADER_ALLOC_MIN_ARENA_SIZE (256 * 1024)
/* 256 KiB << 5 = 8 MiB */
#define RADV_SHADER_ALLOC_MAX_ARENA_SIZE_SHIFT 5u
#define RADV_SHADER_ALLOC_MIN_SIZE_CLASS 8
#define RADV_SHADER_ALLOC_MAX_SIZE_CLASS 15
#define RADV_SHADER_ALLOC_NUM_FREE_LISTS \
+1
View File
@@ -798,6 +798,7 @@ struct radv_device {
uint32_t fmask_mrt_offset_counter;
struct list_head shader_arenas;
unsigned shader_arena_shift;
uint8_t shader_free_list_mask;
struct list_head shader_free_lists[RADV_SHADER_ALLOC_NUM_FREE_LISTS];
struct list_head shader_block_obj_pool;
+5 -1
View File
@@ -1299,7 +1299,10 @@ radv_alloc_shader_memory(struct radv_device *device, uint32_t size, void *ptr)
if (!arena)
goto fail;
unsigned arena_size = MAX2(RADV_SHADER_ALLOC_MIN_ARENA_SIZE, size);
unsigned arena_size =
MAX2(RADV_SHADER_ALLOC_MIN_ARENA_SIZE
<< MIN2(RADV_SHADER_ALLOC_MAX_ARENA_SIZE_SHIFT, device->shader_arena_shift),
size);
VkResult result = device->ws->buffer_create(
device->ws, arena_size, RADV_SHADER_ALLOC_ALIGNMENT, RADEON_DOMAIN_VRAM,
RADEON_FLAG_NO_INTERPROCESS_SHARING | RADEON_FLAG_32BIT |
@@ -1335,6 +1338,7 @@ radv_alloc_shader_memory(struct radv_device *device, uint32_t size, void *ptr)
add_hole(device, hole);
}
++device->shader_arena_shift;
list_addtail(&arena->list, &device->shader_arenas);
mtx_unlock(&device->shader_arena_mutex);