From c0bc23f1945be13bef452ed04e16fa87cc3ece50 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 17 Nov 2022 07:53:24 +0100 Subject: [PATCH] radv: stop overallocating LDS for VS/TES when NGG streamout is enabled The number of shader outputs should only be considered when the shader has XFB, otherwise we are overallocating LDS. fossils-db (GFX1100): Totals from 16602 (12.31% of 134913) affected shaders: LDS: 17000448 -> 8500224 (-50.00%) Cc: 22.3 mesa-stable Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: (cherry picked from commit 499abeba605da7f7395c84b0a75c917656c19949) --- .pick_status.json | 2 +- src/amd/vulkan/radv_shader.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5006741a5aa..6aae7e452ac 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -400,7 +400,7 @@ "description": "radv: stop overallocating LDS for VS/TES when NGG streamout is enabled", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 8a144d3e6de..cfb5fda3eda 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1349,10 +1349,11 @@ setup_ngg_lds_layout(struct radv_device *device, nir_shader *nir, struct radv_sh BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_INSTANCE_ID); bool uses_primtive_id = BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_PRIMITIVE_ID); + bool streamout_enabled = nir->xfb_info && device->physical_device->use_ngg_streamout; unsigned pervertex_lds_bytes = ac_ngg_nogs_get_pervertex_lds_size(stage, nir->num_outputs, - device->physical_device->use_ngg_streamout, + streamout_enabled, info->outinfo.export_prim_id, false, /* user edge flag */ info->has_ngg_culling,