Mesa (main): radeonsi/nir: enable nir_opt_move_discards_to_top pass
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 19 18:25:51 UTC 2021
Module: Mesa
Branch: main
Commit: 764047902885848222d82a20e308beb5299d673f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=764047902885848222d82a20e308beb5299d673f
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Thu Apr 29 11:26:49 2021 +0200
radeonsi/nir: enable nir_opt_move_discards_to_top pass
Since it affects discards and demotes, this commit also moves the
usage of nir_lower_discard_or_demote ealier.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10522>
---
src/gallium/drivers/radeonsi/si_shader_nir.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 8296c15a124..6f97254773a 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -595,6 +595,9 @@ void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool first)
NIR_PASS(progress, nir, nir_opt_loop_unroll, 0);
}
+ if (nir->info.stage == MESA_SHADER_FRAGMENT)
+ NIR_PASS_V(nir, nir_opt_move_discards_to_top);
+
if (sscreen->options.fp16)
NIR_PASS(progress, nir, nir_opt_vectorize, NULL, NULL);
} while (progress);
@@ -822,6 +825,9 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
};
NIR_PASS_V(nir, nir_lower_subgroups, &subgroups_options);
+ NIR_PASS_V(nir, nir_lower_discard_or_demote,
+ sscreen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL));
+
/* Lower load constants to scalar and then clean up the mess */
NIR_PASS_V(nir, nir_lower_load_const_to_scalar);
NIR_PASS_V(nir, nir_lower_var_copies);
@@ -883,9 +889,6 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
si_late_optimize_16bit_samplers(sscreen, nir);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
-
- NIR_PASS_V(nir, nir_lower_discard_or_demote,
- sscreen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL));
}
void si_finalize_nir(struct pipe_screen *screen, void *nirptr, bool optimize)
More information about the mesa-commit
mailing list