Module: Mesa
Branch: main
Commit: f8ee0efd044084fa2f3ad72bca7d2452441d22e7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8ee0efd044084fa2f3ad72bca7d2452441d22e7

Author: Daniel Schürmann <[email protected]>
Date:   Wed Jun 24 16:22:54 2020 +0100

radv: move two NIR passes out of tight optimization loop

nir_remove_dead_variables
nir_opt_shrink_vectors

Acked-by: Timur Kristóf <[email protected]>
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5668>

---

 src/amd/vulkan/radv_shader.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index b0b0b8b45f6..6d446e32473 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -166,8 +166,6 @@ radv_optimize_nir(struct nir_shader *shader, bool 
optimize_conservatively, bool
 
       NIR_PASS(progress, shader, nir_opt_copy_prop_vars);
       NIR_PASS(progress, shader, nir_opt_dead_write_vars);
-      NIR_PASS(progress, shader, nir_remove_dead_variables,
-               nir_var_function_temp | nir_var_shader_in | nir_var_shader_out, 
NULL);
 
       NIR_PASS_V(shader, nir_lower_alu_to_scalar, NULL, NULL);
       NIR_PASS_V(shader, nir_lower_phis_to_scalar, true);
@@ -189,12 +187,15 @@ radv_optimize_nir(struct nir_shader *shader, bool 
optimize_conservatively, bool
       NIR_PASS(progress, shader, nir_opt_algebraic);
 
       NIR_PASS(progress, shader, nir_opt_undef);
-      NIR_PASS(progress, shader, nir_opt_shrink_vectors);
+
       if (shader->options->max_unroll_iterations) {
          NIR_PASS(progress, shader, nir_opt_loop_unroll);
       }
    } while (progress && !optimize_conservatively);
 
+   NIR_PASS(progress, shader, nir_opt_shrink_vectors);
+   NIR_PASS(progress, shader, nir_remove_dead_variables,
+            nir_var_function_temp | nir_var_shader_in | nir_var_shader_out, 
NULL);
    NIR_PASS(progress, shader, nir_opt_conditional_discard);
    NIR_PASS(progress, shader, nir_opt_move, nir_move_load_ubo);
 }

Reply via email to