aco: don't create vector affinities for operands which are not killed or are duplicates
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 15 Apr 2020 11:05:55 +0000 (12:05 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Apr 2020 18:23:23 +0000 (18:23 +0000)
Totals from affected shaders:
SGPRS: 825184 -> 825184 (0.00 %)
VGPRS: 697640 -> 697240 (-0.06 %)
Code Size: 79244104 -> 79201072 (-0.05 %) bytes
Max Waves: 42388 -> 42386 (-0.00 %)

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573>

src/amd/compiler/aco_register_allocation.cpp

index a6792679da1bf7115359aae7edaffaabb51c28de..a3e01b11c68359ea6b78a3b2f40edeaa968a68c8 100644 (file)
@@ -1410,7 +1410,7 @@ void register_allocation(Program *program, std::vector<TempSet>& live_out_per_bl
          /* add vector affinities */
          if (instr->opcode == aco_opcode::p_create_vector) {
             for (const Operand& op : instr->operands) {
-               if (op.isTemp() && op.getTemp().type() == instr->definitions[0].getTemp().type())
+               if (op.isTemp() && op.isFirstKill() && op.getTemp().type() == instr->definitions[0].getTemp().type())
                   ctx.vectors[op.tempId()] = instr.get();
             }
          }