Mesa (master): aco: call nir_opt_algebraic_late() exhaustively
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 30 10:02:35 UTC 2019
Module: Mesa
Branch: master
Commit: 1d29895e5b8f34fefc280964e65f883f7c491dfe
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d29895e5b8f34fefc280964e65f883f7c491dfe
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Thu Sep 26 12:08:13 2019 +0200
aco: call nir_opt_algebraic_late() exhaustively
57559 shaders in 28980 tests
Totals:
SGPRS: 2963407 -> 2959935 (-0.12 %)
VGPRS: 2014812 -> 2016328 (0.08 %)
Spilled SGPRs: 1077 -> 1077 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 10348 -> 10348 (0.00 %) dwords per thread
Code Size: 114545436 -> 114498084 (-0.04 %) bytes
LDS: 933 -> 933 (0.00 %) blocks
Max Waves: 375997 -> 375866 (-0.03 %)
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/amd/compiler/aco_instruction_selection_setup.cpp | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp b/src/amd/compiler/aco_instruction_selection_setup.cpp
index a1b2e4a7e57..a32ada0613e 100644
--- a/src/amd/compiler/aco_instruction_selection_setup.cpp
+++ b/src/amd/compiler/aco_instruction_selection_setup.cpp
@@ -1324,13 +1324,24 @@ setup_isel_context(Program* program,
nir_copy_prop(nir);
nir_opt_constant_folding(nir);
nir_opt_algebraic(nir);
- nir_opt_algebraic_late(nir);
- nir_opt_constant_folding(nir);
+
+ /* Do late algebraic optimization to turn add(a, neg(b)) back into
+ * subs, then the mandatory cleanup after algebraic. Note that it may
+ * produce fnegs, and if so then we need to keep running to squash
+ * fneg(fneg(a)).
+ */
+ 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);
+ }
/* cleanup passes */
nir_lower_load_const_to_scalar(nir);
- nir_opt_cse(nir);
- nir_opt_dce(nir);
nir_opt_shrink_load(nir);
nir_move_options move_opts = (nir_move_options)(
nir_move_const_undef | nir_move_load_ubo | nir_move_load_input | nir_move_comparisons);
More information about the mesa-commit
mailing list