radv: take LDS into account for compute shader occupancy stats
Ported from d205faeb6c
.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
parent
a53d68d318
commit
9b9ccee4d6
|
@ -3372,9 +3372,9 @@ ac_setup_rings(struct radv_shader_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned
|
||||
ac_nir_get_max_workgroup_size(enum chip_class chip_class,
|
||||
const struct nir_shader *nir)
|
||||
unsigned
|
||||
radv_nir_get_max_workgroup_size(enum chip_class chip_class,
|
||||
const struct nir_shader *nir)
|
||||
{
|
||||
switch (nir->info.stage) {
|
||||
case MESA_SHADER_TESS_CTRL:
|
||||
|
|
|
@ -1934,6 +1934,9 @@ void radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm,
|
|||
int nir_count,
|
||||
const struct radv_nir_compiler_options *options);
|
||||
|
||||
unsigned radv_nir_get_max_workgroup_size(enum chip_class chip_class,
|
||||
const struct nir_shader *nir);
|
||||
|
||||
/* radv_shader_info.h */
|
||||
struct radv_shader_info;
|
||||
|
||||
|
|
|
@ -733,7 +733,8 @@ generate_shader_stats(struct radv_device *device,
|
|||
gl_shader_stage stage,
|
||||
struct _mesa_string_buffer *buf)
|
||||
{
|
||||
unsigned lds_increment = device->physical_device->rad_info.chip_class >= CIK ? 512 : 256;
|
||||
enum chip_class chip_class = device->physical_device->rad_info.chip_class;
|
||||
unsigned lds_increment = chip_class >= CIK ? 512 : 256;
|
||||
struct ac_shader_config *conf;
|
||||
unsigned max_simd_waves;
|
||||
unsigned lds_per_wave = 0;
|
||||
|
@ -746,12 +747,17 @@ generate_shader_stats(struct radv_device *device,
|
|||
lds_per_wave = conf->lds_size * lds_increment +
|
||||
align(variant->info.fs.num_interp * 48,
|
||||
lds_increment);
|
||||
} else if (stage == MESA_SHADER_COMPUTE) {
|
||||
unsigned max_workgroup_size =
|
||||
ac_nir_get_max_workgroup_size(chip_class, variant->nir);
|
||||
lds_per_wave = (conf->lds_size * lds_increment) /
|
||||
DIV_ROUND_UP(max_workgroup_size, 64);
|
||||
}
|
||||
|
||||
if (conf->num_sgprs)
|
||||
max_simd_waves =
|
||||
MIN2(max_simd_waves,
|
||||
ac_get_num_physical_sgprs(device->physical_device->rad_info.chip_class) / conf->num_sgprs);
|
||||
ac_get_num_physical_sgprs(chip_class) / conf->num_sgprs);
|
||||
|
||||
if (conf->num_vgprs)
|
||||
max_simd_waves =
|
||||
|
|
Loading…
Reference in New Issue