mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-21 01:38:23 +02:00
radv: bump the sparse alignment requirement to 64K
4K sparse allocations are super slow because they thrash TLB, so it's better
to disallow them.
radeonsi already reports 64K alignment for sparse buffers, but RADV
reported 4K.
VMEM latency with 4K pages:
Size , 1024, 1536, 2K, 3K, 4K, 6K, 8K, 12K, 16K, 24K, 32K, 48K, 64K, 96K, 128K, 192K, 256K, 384K, 512K, 768K, 1024K, 1536K, 2M, 3M, 4M,
Latency, 86, 86, 86, 86, 89, 86, 86, 87, 87, 126, 127, 126, 128, 387, 409, 448, 423, 450, 446, 424, 430, 429, 428, 433, 432
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
VMEM latency with 64K pages (it's lower, up to 2x lower in some cases):
Size , 1024, 1536, 2K, 3K, 4K, 6K, 8K, 12K, 16K, 24K, 32K, 48K, 64K, 96K, 128K, 192K, 256K, 384K, 512K, 768K, 1024K, 1536K, 2M, 3M, 4M,
Latency, 87, 86, 86, 86, 86, 86, 86, 87, 87, 125, 127, 126, 128, 198, 196, 197, 198, 376, 392, 411, 381, 401, 392, 432, 451,
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42127>
This commit is contained in:
parent
0e5ad74a1d
commit
cb8da4bb41
2 changed files with 7 additions and 3 deletions
|
|
@ -98,8 +98,9 @@ radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreate
|
|||
(VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT | VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT))
|
||||
flags |= RADEON_FLAG_32BIT;
|
||||
|
||||
VkResult result = radv_bo_create(device, &buffer->vk.base, align64(buffer->vk.size, 4096), 4096, 0, flags,
|
||||
RADV_BO_PRIORITY_VIRTUAL, replay_address, is_internal, &buffer->bo);
|
||||
VkResult result = radv_bo_create(device, &buffer->vk.base, align64(buffer->vk.size, RADV_SPARSE_BUFFER_ALIGNMENT),
|
||||
RADV_SPARSE_BUFFER_ALIGNMENT, 0, flags, RADV_BO_PRIORITY_VIRTUAL, replay_address,
|
||||
is_internal, &buffer->bo);
|
||||
if (result != VK_SUCCESS) {
|
||||
radv_destroy_buffer(device, pAllocator, buffer);
|
||||
return vk_error(device, result);
|
||||
|
|
@ -201,7 +202,7 @@ radv_get_buffer_memory_requirements(struct radv_device *device, VkDeviceSize siz
|
|||
pMemoryRequirements->memoryRequirements.memoryTypeBits &= pdev->memory_types_protected;
|
||||
|
||||
if (flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) {
|
||||
pMemoryRequirements->memoryRequirements.alignment = 4096;
|
||||
pMemoryRequirements->memoryRequirements.alignment = RADV_SPARSE_BUFFER_ALIGNMENT;
|
||||
} else {
|
||||
if (usage & VK_BUFFER_USAGE_2_PREPROCESS_BUFFER_BIT_EXT)
|
||||
pMemoryRequirements->memoryRequirements.alignment = radv_dgc_get_buffer_alignment(device);
|
||||
|
|
|
|||
|
|
@ -156,4 +156,7 @@
|
|||
|
||||
#define RADV_MAX_SHADER_ABORT_MESSAGE_SIZE 65536
|
||||
|
||||
/* Don't use 4K alignment for sparse because 4K pages (both sparse and non-sparse) are super slow. */
|
||||
#define RADV_SPARSE_BUFFER_ALIGNMENT (64 * 1024)
|
||||
|
||||
#endif /* RADV_CONSTANTS_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue