summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2020-05-07 12:25:50 +0300
committerMarge Bot <eric+marge@anholt.net>2020-05-08 08:59:02 +0000
commit8bcfce2fcd02e9b04b7edda5c0d8a0e4b77be39c (patch)
tree31178547ba6f80ff753aa1ca2f52ae188dbf270e
parentf105b69464d908ee8b54c0bddb51909ebde4d686 (diff)
anv: fix alignments for uniform buffers
We were not consistent with minimums reported in the physical device properties. Fixes a few CTS tests : dEQP-VK.memory.requirements.dedicated_allocation.buffer.regular dEQP-VK.memory.requirements.extended.buffer.regular dEQP-VK.memory.requirements.core.buffer.regular v2: Use define for the limit v3: Rename define Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes: a0de2e0090535b ("anv: increase minUniformBufferOffsetAlignment to 64") Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4940>
-rw-r--r--src/intel/vulkan/anv_descriptor_set.c2
-rw-r--r--src/intel/vulkan/anv_device.c10
-rw-r--r--src/intel/vulkan/anv_private.h7
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c4
4 files changed, 12 insertions, 11 deletions
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 11d6a9cfa87..d51721b22ea 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -1345,7 +1345,7 @@ anv_descriptor_set_write_buffer(struct anv_device *device,
*/
if (type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER ||
type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
- bind_range = align_u64(bind_range, ANV_UBO_BOUNDS_CHECK_ALIGNMENT);
+ bind_range = align_u64(bind_range, ANV_UBO_ALIGNMENT);
if (type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ||
type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) {
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 52ce55eeb84..348ce8f2978 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1505,10 +1505,7 @@ void anv_GetPhysicalDeviceProperties(
* case of R32G32B32A32 which is 16 bytes.
*/
.minTexelBufferOffsetAlignment = 16,
- /* We need 16 for UBO block reads to work and 32 for push UBOs.
- * However, we use 64 here to avoid cache issues.
- */
- .minUniformBufferOffsetAlignment = 64,
+ .minUniformBufferOffsetAlignment = ANV_UBO_ALIGNMENT,
.minStorageBufferOffsetAlignment = 4,
.minTexelOffset = -8,
.maxTexelOffset = 7,
@@ -1919,7 +1916,7 @@ void anv_GetPhysicalDeviceProperties2(
properties->robustStorageBufferAccessSizeAlignment =
ANV_SSBO_BOUNDS_CHECK_ALIGNMENT;
properties->robustUniformBufferAccessSizeAlignment =
- ANV_UBO_BOUNDS_CHECK_ALIGNMENT;
+ ANV_UBO_ALIGNMENT;
break;
}
@@ -3850,9 +3847,8 @@ void anv_GetBufferMemoryRequirements(
/* Base alignment requirement of a cache line */
uint32_t alignment = 16;
- /* We need an alignment of 32 for pushing UBOs */
if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)
- alignment = MAX2(alignment, 32);
+ alignment = MAX2(alignment, ANV_UBO_ALIGNMENT);
pMemoryRequirements->size = buffer->size;
pMemoryRequirements->alignment = alignment;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 522363b09f5..10938467ed1 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -173,7 +173,12 @@ struct gen_perf_config;
#define MAX_PUSH_DESCRIPTORS 32 /* Minimum requirement */
#define MAX_INLINE_UNIFORM_BLOCK_SIZE 4096
#define MAX_INLINE_UNIFORM_BLOCK_DESCRIPTORS 32
-#define ANV_UBO_BOUNDS_CHECK_ALIGNMENT 32
+/* We need 16 for UBO block reads to work and 32 for push UBOs. However, we
+ * use 64 here to avoid cache issues. This could most likely bring it back to
+ * 32 if we had different virtual addresses for the different views on a given
+ * GEM object.
+ */
+#define ANV_UBO_ALIGNMENT 64
#define ANV_SSBO_BOUNDS_CHECK_ALIGNMENT 4
#define MAX_VIEWS_FOR_PRIMITIVE_REPLICATION 16
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 1ba6dc2b987..f1b102c9805 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2664,7 +2664,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
/* Align the range for consistency */
if (desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
- range = align_u32(range, ANV_UBO_BOUNDS_CHECK_ALIGNMENT);
+ range = align_u32(range, ANV_UBO_ALIGNMENT);
struct anv_address address =
anv_address_add(desc->buffer->address, offset);
@@ -2993,7 +2993,7 @@ get_push_range_bound_size(struct anv_cmd_buffer *cmd_buffer,
uint32_t bound_range = MIN2(desc->range, desc->buffer->size - offset);
/* Align the range for consistency */
- bound_range = align_u32(bound_range, ANV_UBO_BOUNDS_CHECK_ALIGNMENT);
+ bound_range = align_u32(bound_range, ANV_UBO_ALIGNMENT);
return bound_range;
}