radv: add a helper to get the maximum number of scratch waves per shader

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24502>
This commit is contained in:
Samuel Pitoiset 2023-08-04 17:43:20 +02:00 committed by Marge Bot
parent 9880224490
commit 44e82a6cf1
3 changed files with 11 additions and 3 deletions

View file

@ -134,9 +134,7 @@ radv_pipeline_init_scratch(const struct radv_device *device, struct radv_pipelin
pipeline->scratch_bytes_per_wave = MAX2(pipeline->scratch_bytes_per_wave, shader->config.scratch_bytes_per_wave);
unsigned max_stage_waves = device->scratch_waves;
max_stage_waves = MIN2(max_stage_waves, 4 * device->physical_device->rad_info.num_cu *
radv_get_max_waves(device, shader, shader->info.stage));
const unsigned max_stage_waves = radv_get_max_scratch_waves(device, shader);
pipeline->max_waves = MAX2(pipeline->max_waves, max_stage_waves);
}

View file

@ -2832,6 +2832,14 @@ radv_get_max_waves(const struct radv_device *device, struct radv_shader *shader,
return gfx_level >= GFX10 ? max_simd_waves * (wave_size / 32) : max_simd_waves;
}
unsigned
radv_get_max_scratch_waves(const struct radv_device *device, struct radv_shader *shader)
{
const unsigned num_cu = device->physical_device->rad_info.num_cu;
return MIN2(device->scratch_waves, 4 * num_cu * radv_get_max_waves(device, shader, shader->info.stage));
}
unsigned
radv_compute_spi_ps_input(const struct radv_pipeline_key *pipeline_key, const struct radv_shader_info *info)
{

View file

@ -699,6 +699,8 @@ struct radv_shader *radv_find_shader(struct radv_device *device, uint64_t pc);
unsigned radv_get_max_waves(const struct radv_device *device, struct radv_shader *shader, gl_shader_stage stage);
unsigned radv_get_max_scratch_waves(const struct radv_device *device, struct radv_shader *shader);
const char *radv_get_shader_name(const struct radv_shader_info *info, gl_shader_stage stage);
unsigned radv_compute_spi_ps_input(const struct radv_pipeline_key *pipeline_key, const struct radv_shader_info *info);