anv: align buffers to a cache line

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9217
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23794>
(cherry picked from commit 8509ebb68a)
This commit is contained in:
Lionel Landwerlin 2023-06-22 12:50:43 +03:00 committed by Eric Engestrom
parent be04c20aa7
commit 249c76e27b
2 changed files with 6 additions and 6 deletions

View file

@ -1219,7 +1219,7 @@
"description": "anv: align buffers to a cache line",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -4303,11 +4303,11 @@ anv_get_buffer_memory_requirements(struct anv_device *device,
*/
uint32_t memory_types = (1ull << device->physical->memory.type_count) - 1;
/* Base alignment requirement of a cache line */
uint32_t alignment = 16;
if (usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)
alignment = MAX2(alignment, ANV_UBO_ALIGNMENT);
/* The GPU appears to write back to main memory in cachelines. Writes to a
* buffers should not clobber with writes to another buffers so make sure
* those are in different cachelines.
*/
uint32_t alignment = 64;
pMemoryRequirements->memoryRequirements.size = size;
pMemoryRequirements->memoryRequirements.alignment = alignment;