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

Author: Rhys Perry <[email protected]>
Date:   Tue Apr 21 17:37:44 2020 +0100

aco: copy-propagate p_create_vector copies of vectors

Instead of copying the operands of the other p_create_vector and labelling
the definition with label_vec, copy the operands and label it with
label_temp so that it can be copy-propagated.

This was found while removing a redundant copy in load_input_from_temps()
which removed duplicate p_create_vector instructions.

shader-db (Navi):
Totals from 139 (0.11% of 127638) affected shaders:
VGPRs: 8472 -> 7948 (-6.19%)
CodeSize: 514592 -> 512368 (-0.43%)
MaxWaves: 1089 -> 1195 (+9.73%)
Instrs: 100214 -> 99658 (-0.55%)
Cycles: 400856 -> 398632 (-0.55%)
VMEM: 15545 -> 15338 (-1.33%)
Copies: 5140 -> 4584 (-10.82%)

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

---

 src/amd/compiler/aco_optimizer.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/amd/compiler/aco_optimizer.cpp 
b/src/amd/compiler/aco_optimizer.cpp
index 491df9404ba..3c87d061468 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -898,6 +898,11 @@ void label_instruction(opt_ctx &ctx, Block& block, 
aco_ptr<Instruction>& instr)
 
    switch (instr->opcode) {
    case aco_opcode::p_create_vector: {
+      if (instr->operands.size() == 1 && instr->operands[0].isTemp())
+         
ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[0].getTemp());
+      else
+         ctx.info[instr->definitions[0].tempId()].set_vec(instr.get());
+
       unsigned num_ops = instr->operands.size();
       for (const Operand& op : instr->operands) {
          if (op.isTemp() && ctx.info[op.tempId()].is_vec())
@@ -923,10 +928,6 @@ void label_instruction(opt_ctx &ctx, Block& block, 
aco_ptr<Instruction>& instr)
          }
          assert(k == num_ops);
       }
-      if (instr->operands.size() == 1 && instr->operands[0].isTemp())
-         
ctx.info[instr->definitions[0].tempId()].set_temp(instr->operands[0].getTemp());
-      else
-         ctx.info[instr->definitions[0].tempId()].set_vec(instr.get());
       break;
    }
    case aco_opcode::p_split_vector: {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to