Module: Mesa Branch: main Commit: 63827751e136cbfd8f5eb5cd74df40442377972e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=63827751e136cbfd8f5eb5cd74df40442377972e
Author: Tatsuyuki Ishi <ishitatsuy...@gmail.com> Date: Thu Jan 11 17:18:15 2024 +0900 radv: Recompute max_waves after postprocessing RT config The max waves for RT prolog need to be recalculated after merging the resource usage of all shaders invoked from it. Note that there is no need to panic, as the info was only used to calculate maximum scratch size and with the RT prolog being low footprint, this likely only caused overestimation rather than underestimation. Fixes: 533ec9843e4 ("radv: Precompute shader max_waves.") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26998> --- src/amd/vulkan/radv_pipeline_rt.c | 2 ++ src/amd/vulkan/radv_shader.c | 2 +- src/amd/vulkan/radv_shader.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 171d6f33abf..c7f3047f561 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -732,6 +732,8 @@ compile_rt_prolog(struct radv_device *device, struct radv_ray_tracing_pipeline * combine_config(config, &pipeline->base.base.shaders[MESA_SHADER_INTERSECTION]->config); postprocess_rt_config(config, device->physical_device->rad_info.gfx_level, device->physical_device->rt_wave_size); + + pipeline->prolog->max_waves = radv_get_max_waves(device, config, &pipeline->prolog->info); } static VkResult diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 89185c059ba..a0ce999f8d5 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -2051,7 +2051,7 @@ radv_shader_upload(struct radv_device *device, struct radv_shader *shader, const return true; } -static unsigned +unsigned radv_get_max_waves(const struct radv_device *device, const struct ac_shader_config *conf, const struct radv_shader_info *info) { diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 3f0682eddb3..c4ceed01d1d 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -803,6 +803,9 @@ struct radv_shader_part *radv_shader_part_cache_get(struct radv_device *device, uint64_t radv_shader_get_va(const struct radv_shader *shader); struct radv_shader *radv_find_shader(struct radv_device *device, uint64_t pc); +unsigned radv_get_max_waves(const struct radv_device *device, const struct ac_shader_config *conf, + const struct radv_shader_info *info); + 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);