Mesa (master): aco: fix operand kill flags when a temporary is used more than once

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 22 16:13:07 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Jan 21 14:24:01 2020 +0000

aco: fix operand kill flags when a temporary is used more than once

Helps create v_mac_f32 from v_mad_f32(b, a, b)

Totals from affected shaders:
SGPRS: 35824 -> 35824 (0.00 %)
VGPRS: 33460 -> 33456 (-0.01 %)
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: 2187264 -> 2180976 (-0.29 %) bytes
LDS: 127 -> 127 (0.00 %) blocks
Max Waves: 3802 -> 3802 (0.00 %)

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

---

 src/amd/compiler/aco_live_var_analysis.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_live_var_analysis.cpp b/src/amd/compiler/aco_live_var_analysis.cpp
index 44a3ea53430..c00325b92b7 100644
--- a/src/amd/compiler/aco_live_var_analysis.cpp
+++ b/src/amd/compiler/aco_live_var_analysis.cpp
@@ -111,6 +111,12 @@ void process_live_temps_per_block(Program *program, live& lives, Block* block,
       if (insn->opcode == aco_opcode::p_logical_end) {
          new_demand.sgpr += phi_sgpr_ops[block->index];
       } else {
+         /* we need to do this in a separate loop because the next one can
+          * setKill() for several operands at once and we don't want to
+          * overwrite that in a later iteration */
+         for (Operand& op : insn->operands)
+            op.setKill(false);
+
          for (unsigned i = 0; i < insn->operands.size(); ++i)
          {
             Operand& operand = insn->operands[i];
@@ -130,8 +136,6 @@ void process_live_temps_per_block(Program *program, live& lives, Block* block,
                   }
                }
                new_demand += temp;
-            } else {
-               operand.setKill(false);
             }
 
             if (operand.isFixed() && operand.physReg() == exec)



More information about the mesa-commit mailing list