radv: stop overallocating LDS for VS/TES when NGG streamout is enabled
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 17 Nov 2022 06:53:24 +0000 (07:53 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Nov 2022 19:25:51 +0000 (19:25 +0000)
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 <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19801>

src/amd/vulkan/radv_shader.c

index 0eb9a77..e633afe 100644 (file)
@@ -1352,10 +1352,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,