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 <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27431>
This commit is contained in:
Samuel Pitoiset
2024-02-02 11:25:40 +01:00
committed by Marge Bot
parent 35c9631162
commit 90e354afb0

View File

@@ -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;
}
}