mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 15:40:11 +01:00
radeonsi: do late NIR optimizations after uniform inlining
This was missing. Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9028>
This commit is contained in:
parent
33ac9dec91
commit
19e6601413
3 changed files with 16 additions and 9 deletions
|
|
@ -1412,6 +1412,7 @@ struct nir_shader *si_get_nir_shader(struct si_shader_selector *sel,
|
|||
nir->info.inlinable_uniform_dw_offsets);
|
||||
|
||||
si_nir_opts(sel->screen, nir, true);
|
||||
si_nir_late_opts(nir);
|
||||
|
||||
/* This must be done again. */
|
||||
NIR_PASS_V(nir, nir_io_add_const_offset_to_base, nir_var_shader_in |
|
||||
|
|
|
|||
|
|
@ -877,6 +877,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
|
|||
/* si_shader_nir.c */
|
||||
void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *info);
|
||||
void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool first);
|
||||
void si_nir_late_opts(nir_shader *nir);
|
||||
void si_finalize_nir(struct pipe_screen *screen, void *nirptr, bool optimize);
|
||||
|
||||
/* si_state_shaders.c */
|
||||
|
|
|
|||
|
|
@ -550,6 +550,19 @@ void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool first)
|
|||
NIR_PASS_V(nir, nir_lower_var_copies);
|
||||
}
|
||||
|
||||
void si_nir_late_opts(nir_shader *nir)
|
||||
{
|
||||
bool more_late_algebraic = true;
|
||||
while (more_late_algebraic) {
|
||||
more_late_algebraic = false;
|
||||
NIR_PASS(more_late_algebraic, nir, nir_opt_algebraic_late);
|
||||
NIR_PASS_V(nir, nir_opt_constant_folding);
|
||||
NIR_PASS_V(nir, nir_copy_prop);
|
||||
NIR_PASS_V(nir, nir_opt_dce);
|
||||
NIR_PASS_V(nir, nir_opt_cse);
|
||||
}
|
||||
}
|
||||
|
||||
static int type_size_vec4(const struct glsl_type *type, bool bindless)
|
||||
{
|
||||
return glsl_count_attribute_slots(type, false);
|
||||
|
|
@ -765,15 +778,7 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
|
|||
si_nir_opts(sscreen, nir, false);
|
||||
|
||||
/* Run late optimizations to fuse ffma. */
|
||||
bool more_late_algebraic = true;
|
||||
while (more_late_algebraic) {
|
||||
more_late_algebraic = false;
|
||||
NIR_PASS(more_late_algebraic, nir, nir_opt_algebraic_late);
|
||||
NIR_PASS_V(nir, nir_opt_constant_folding);
|
||||
NIR_PASS_V(nir, nir_copy_prop);
|
||||
NIR_PASS_V(nir, nir_opt_dce);
|
||||
NIR_PASS_V(nir, nir_opt_cse);
|
||||
}
|
||||
si_nir_late_opts(nir);
|
||||
|
||||
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue