Mesa (master): aco: run opt_algebraic in a loop

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 21 19:55:35 UTC 2019


Module: Mesa
Branch: master
Commit: 73184e51d1cbb9f22b02e8c9f46e9dec116c63dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=73184e51d1cbb9f22b02e8c9f46e9dec116c63dc

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Oct  3 17:15:34 2019 +0100

aco: run opt_algebraic in a loop

Totals from affected shaders:
SGPRS: 13920 -> 13656 (-1.90 %)
VGPRS: 12972 -> 12960 (-0.09 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 1005680 -> 1000648 (-0.50 %) bytes
LDS: 91 -> 91 (0.00 %) blocks
Max Waves: 688 -> 688 (0.00 %)

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>

---

 src/amd/compiler/aco_instruction_selection_setup.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp b/src/amd/compiler/aco_instruction_selection_setup.cpp
index 9727020a8a9..b100ace3c8c 100644
--- a/src/amd/compiler/aco_instruction_selection_setup.cpp
+++ b/src/amd/compiler/aco_instruction_selection_setup.cpp
@@ -1331,9 +1331,14 @@ setup_isel_context(Program* program,
       nir_lower_idiv(nir, nir_lower_idiv_precise);
 
       /* optimize the lowered ALU operations */
-      nir_copy_prop(nir);
-      nir_opt_constant_folding(nir);
-      nir_opt_algebraic(nir);
+      bool more_algebraic = true;
+      while (more_algebraic) {
+         more_algebraic = false;
+         NIR_PASS_V(nir, nir_copy_prop);
+         NIR_PASS_V(nir, nir_opt_dce);
+         NIR_PASS_V(nir, nir_opt_constant_folding);
+         NIR_PASS(more_algebraic, nir, nir_opt_algebraic);
+      }
 
       /* Do late algebraic optimization to turn add(a, neg(b)) back into
       * subs, then the mandatory cleanup after algebraic.  Note that it may




More information about the mesa-commit mailing list