Mesa (master): aco: optimize a*0.0

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 26 11:59:24 UTC 2021


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Wed Jun 17 14:57:57 2020 +0100

aco: optimize a*0.0

fossil-db (GFX10):
Totals from 1943 (1.39% of 139391) affected shaders:
SGPRs: 99952 -> 99544 (-0.41%); split: -0.44%, +0.03%
VGPRs: 60880 -> 60272 (-1.00%); split: -1.02%, +0.02%
CodeSize: 5138488 -> 5107500 (-0.60%); split: -0.61%, +0.01%
MaxWaves: 32193 -> 32380 (+0.58%)
Instrs: 983178 -> 975684 (-0.76%); split: -0.77%, +0.01%

fossil-db (GFX10.3):
Totals from 1943 (1.39% of 139391) affected shaders:
SGPRs: 99832 -> 99648 (-0.18%); split: -0.25%, +0.06%
VGPRs: 64708 -> 63944 (-1.18%); split: -1.27%, +0.09%
CodeSize: 5196732 -> 5157632 (-0.75%); split: -0.76%, +0.00%
MaxWaves: 27478 -> 27486 (+0.03%); split: +0.06%, -0.03%
Instrs: 1007222 -> 998737 (-0.84%); split: -0.84%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5523>

---

 src/amd/compiler/aco_optimizer.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index b4a63e7e580..b324f484075 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -1316,6 +1316,9 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
                        !(fp16 ? block.fp_mode.must_flush_denorms16_64 : block.fp_mode.must_flush_denorms32) &&
                        !instr->definitions[0].isPrecise()) { /* 1.0 */
                ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[i].getTemp());
+            } else if (instr->operands[!i].constantValue() == 0u &&
+                       !(fp16 ? block.fp_mode.preserve_signed_zero_inf_nan16_64 : block.fp_mode.preserve_signed_zero_inf_nan32)) { /* 0.0 */
+               ctx.info[instr->definitions[0].tempId()].set_constant(ctx.program->chip_class, 0u);
             } else {
                continue;
             }



More information about the mesa-commit mailing list