radeonsi: don't pad esgs_vertex_stride if it's 0

so that we don't allocate any LDS for ES->GS varyings if it's unused.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31291>
This commit is contained in:
Marek Olšák 2024-08-23 16:29:47 -04:00 committed by Marge Bot
parent 02e9572335
commit 40d9616bd3
2 changed files with 7 additions and 5 deletions

View file

@ -844,10 +844,12 @@ void si_nir_scan_shader(struct si_screen *sscreen, const struct nir_shader *nir,
/* For the ESGS ring in LDS, add 1 dword to reduce LDS bank
* conflicts, i.e. each vertex will start on a different bank.
*/
if (sscreen->info.gfx_level >= GFX9)
info->esgs_vertex_stride += 4;
else
if (sscreen->info.gfx_level >= GFX9) {
if (info->esgs_vertex_stride)
info->esgs_vertex_stride += 4;
} else {
assert(((info->esgs_vertex_stride / 4) & C_028AAC_ITEMSIZE) == 0);
}
info->tcs_vgpr_only_inputs = ~info->base.tess.tcs_cross_invocation_inputs_read &
~info->base.inputs_read_indirectly &

View file

@ -925,8 +925,8 @@ void gfx9_get_gs_info(struct si_shader_selector *es, struct si_shader_selector *
static void gfx9_set_gs_sgpr_num_es_outputs(struct si_context *sctx, unsigned esgs_vertex_stride)
{
/* The stride must always be odd (e.g. a multiple of 4 + 1) to reduce LDS bank conflicts. */
assert(esgs_vertex_stride % 4 == 1);
unsigned num_es_outputs = (esgs_vertex_stride - 1) / 4;
assert(!esgs_vertex_stride || esgs_vertex_stride % 4 == 1);
unsigned num_es_outputs = esgs_vertex_stride / 4;
/* If there are no ES outputs, GS doesn't use this SGPR field, so only set it if the number
* is non-zero.