winsys/amdgpu,pb_slab: add slabs with 3/4 of power of two sizes to save memory
authorMarek Olšák <marek.olsak@amd.com>
Sun, 24 Jan 2021 02:53:30 +0000 (21:53 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 3 Feb 2021 21:53:34 +0000 (21:53 +0000)
commite97af11ba95f2563579414c4c68f2cbd5af4928b
tree83e57f77bdc4678e5b7be948e56223d3fa0f6799
parent35005881bf969c934c57d5dffb76ad1a8efa2310
winsys/amdgpu,pb_slab: add slabs with 3/4 of power of two sizes to save memory

Instead of aligning slab allocations to powers of two (e.g. 129K -> 256K),
implement slab allocations with 3/4 of power of two sizes to reduce
overallocation. (e.g. 129K -> 192K)

The limitation is that the alignment must be 1/3rd of the allocation size.

DeusExMD allocates 2.1 GB of VRAM. Without this, slabs waste 194 MB due
to alignment, i.e. 9.2%. This commit reduces the waste to 102 MB, i.e. 4.9%.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8683>
src/gallium/auxiliary/pipebuffer/pb_slab.c
src/gallium/auxiliary/pipebuffer/pb_slab.h
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c