Mesa (main): turnip: Reduce the pipeline's CS allocation a bit.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 01:26:35 UTC 2022
Module: Mesa
Branch: main
Commit: 435d4f08b2adb167827389b748165d9509737d31
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=435d4f08b2adb167827389b748165d9509737d31
Author: Emma Anholt <emma at anholt.net>
Date: Wed Feb 23 14:45:59 2022 -0800
turnip: Reduce the pipeline's CS allocation a bit.
We don't return unused space to the suballocator, so it's a little useful
to limit how much we overallocate to reduce memory footprint. I took a
look through the tu_cs_emit_array() calls and accounted for a couple of
them in the variant-specific space calculation, then dropped the base
allocation by factors of 2 until we started throwing asserts.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15038>
---
src/freedreno/vulkan/tu_pipeline.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index c3bae9582b9..441ed0285fb 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -422,7 +422,16 @@ tu_xs_get_immediates_packet_size_dwords(const struct ir3_shader_variant *xs)
static uint32_t
tu_xs_get_additional_cs_size_dwords(const struct ir3_shader_variant *xs)
{
+ const struct ir3_const_state *const_state = ir3_const_state(xs);
+
uint32_t size = tu_xs_get_immediates_packet_size_dwords(xs);
+
+ /* Variable number of UBO upload ranges. */
+ size += 4 * const_state->ubo_state.num_enabled;
+
+ /* Variable number of dwords for the primitive map */
+ size += DIV_ROUND_UP(xs->input_size, 4);
+
return size;
}
@@ -2260,7 +2269,7 @@ tu_pipeline_allocate_cs(struct tu_device *dev,
struct tu_pipeline_cache *cache,
struct ir3_shader_variant *compute)
{
- uint32_t size = 2048 + tu6_load_state_size(pipeline, layout, compute);
+ uint32_t size = 1024 + tu6_load_state_size(pipeline, layout, compute);
/* graphics case: */
if (builder) {
More information about the mesa-commit
mailing list