radeonsi: move shared_size to si_shader_variant_info

For mesh shader which know this after ac_nir_lower_ngg_mesh.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38044>
This commit is contained in:
Qiang Yu 2025-10-17 17:11:02 +08:00 committed by Marge Bot
parent e3ab6249f2
commit 263cce11bd
5 changed files with 9 additions and 6 deletions

View file

@ -176,7 +176,6 @@ static void *si_create_compute_state(struct pipe_context *ctx, const struct pipe
si_const_and_shader_buffer_descriptors_idx(MESA_SHADER_COMPUTE);
sel->sampler_and_images_descriptors_index =
si_sampler_and_image_descriptors_idx(MESA_SHADER_COMPUTE);
sel->info.base.shared_size = cso->static_shared_mem;
program->shader.selector = &program->sel;
if (cso->ir_type == PIPE_SHADER_IR_TGSI) {
@ -352,7 +351,7 @@ static bool si_switch_compute_shader(struct si_context *sctx, struct si_compute
/* only do this for OpenCL */
if (variable_shared_size) {
unsigned shared_size = program->sel.info.base.shared_size + variable_shared_size;
unsigned shared_size = shader->info.shared_size + variable_shared_size;
unsigned lds_blocks = 0;
if (sctx->gfx_level <= GFX6) {

View file

@ -205,8 +205,10 @@ unsigned si_calculate_needed_lds_size(enum amd_gfx_level gfx_level, struct si_sh
lds_size = size_in_dw * 4;
}
if (stage == MESA_SHADER_COMPUTE) {
lds_size = shader->selector->info.base.shared_size;
if (stage == MESA_SHADER_COMPUTE ||
stage == MESA_SHADER_TASK ||
stage == MESA_SHADER_MESH) {
lds_size = shader->info.shared_size;
}
/* Check that the LDS size is within hw limits. */

View file

@ -428,7 +428,6 @@ void si_nir_scan_shader(struct si_screen *sscreen, struct nir_shader *nir,
info->base.image_buffers = nir->info.image_buffers[0];
info->base.msaa_images = nir->info.msaa_images[0];
info->base.shared_size = nir->info.shared_size;
info->base.task_payload_size = nir->info.task_payload_size;
memcpy(info->base.workgroup_size, nir->info.workgroup_size, sizeof(nir->info.workgroup_size));
info->base.workgroup_size_variable = nir->info.workgroup_size_variable;

View file

@ -32,7 +32,6 @@ struct si_shader_info {
uint32_t image_buffers;
uint32_t msaa_images;
unsigned shared_size;
unsigned task_payload_size;
uint16_t workgroup_size[3];
bool workgroup_size_variable:1;
@ -233,6 +232,7 @@ struct si_shader_variant_info {
uint8_t ngg_lds_scratch_size;
uint16_t private_mem_vgprs;
uint32_t ngg_lds_vertex_size; /* VS,TES: Cull+XFB, GS: GSVS size */
uint32_t shared_size;
ac_nir_legacy_gs_info legacy_gs;
};

View file

@ -300,6 +300,9 @@ void si_get_shader_variant_info(struct si_shader *shader,
void si_get_late_shader_variant_info(struct si_shader *shader, struct si_shader_args *args,
nir_shader *nir)
{
/* mesh shader know this after ac_nir_lower_ngg_mesh() */
shader->info.shared_size = nir->info.shared_size;
nir_foreach_block(block, nir_shader_get_entrypoint(nir)) {
nir_foreach_instr(instr, block) {
if (instr->type != nir_instr_type_intrinsic)