From 90e354afb021ed28173ecf6cc535279eeafc2c9e Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 2 Feb 2024 11:25:40 +0100 Subject: [PATCH] radv: determine the workgroup size for GS non-NGG earlier The wavesize for VS/TES/GS is always the same, so this can be computed earlier. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_shader_info.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 8d9892ca573..e7d36cd45bb 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -1259,6 +1259,21 @@ radv_nir_shader_info_pass(struct radv_device *device, const struct nir_shader *n info->workgroup_size = 256; } break; + case MESA_SHADER_GEOMETRY: + if (!info->is_ngg) { + unsigned es_verts_per_subgroup = G_028A44_ES_VERTS_PER_SUBGRP(info->gs_ring_info.vgt_gs_onchip_cntl); + unsigned gs_inst_prims_in_subgroup = G_028A44_GS_INST_PRIMS_IN_SUBGRP(info->gs_ring_info.vgt_gs_onchip_cntl); + + info->workgroup_size = + ac_compute_esgs_workgroup_size(device->physical_device->rad_info.gfx_level, info->wave_size, + es_verts_per_subgroup, gs_inst_prims_in_subgroup); + } else { + /* Set the maximum possible value by default, this will be optimized during linking if + * possible. + */ + info->workgroup_size = 256; + } + break; case MESA_SHADER_MESH: calc_mesh_workgroup_size(device, nir, info); break; @@ -1625,15 +1640,8 @@ radv_link_shaders_info(struct radv_device *device, struct radv_shader_stage *pro } else if (consumer && consumer->stage == MESA_SHADER_GEOMETRY) { struct radv_shader_info *gs_info = &consumer->info; struct radv_shader_info *es_info = &producer->info; - unsigned es_verts_per_subgroup = G_028A44_ES_VERTS_PER_SUBGRP(gs_info->gs_ring_info.vgt_gs_onchip_cntl); - unsigned gs_inst_prims_in_subgroup = - G_028A44_GS_INST_PRIMS_IN_SUBGRP(gs_info->gs_ring_info.vgt_gs_onchip_cntl); - unsigned workgroup_size = - ac_compute_esgs_workgroup_size(device->physical_device->rad_info.gfx_level, es_info->wave_size, - es_verts_per_subgroup, gs_inst_prims_in_subgroup); - es_info->workgroup_size = workgroup_size; - gs_info->workgroup_size = workgroup_size; + es_info->workgroup_size = gs_info->workgroup_size; } }