Mesa (master): aco: consider affinities when creating v_mac_f32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 13 13:22:06 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri May  8 17:58:07 2020 +0100

aco: consider affinities when creating v_mac_f32

Totals from 8487 (6.65% of 127638) affected shaders:
CodeSize: 62061988 -> 62058020 (-0.01%); split: -0.01%, +0.01%
Instrs: 11910757 -> 11885409 (-0.21%); split: -0.21%, +0.00%
Copies: 1065244 -> 1040945 (-2.28%); split: -2.30%, +0.02%
Branches: 349665 -> 348914 (-0.21%)

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/4990>

---

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

diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index a0a4a4f444f..897a5bc50c7 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -1738,8 +1738,14 @@ void register_allocation(Program *program, std::vector<TempSet>& live_out_per_bl
              instr->operands[1].isTemp() &&
              instr->operands[1].getTemp().type() == RegType::vgpr &&
              !instr->usesModifiers()) {
-            instr->format = Format::VOP2;
-            instr->opcode = aco_opcode::v_mac_f32;
+            unsigned def_id = instr->definitions[0].tempId();
+            auto it = ctx.affinities.find(def_id);
+            if (it == ctx.affinities.end() || !ctx.assignments[it->second].assigned ||
+                instr->operands[2].physReg() == ctx.assignments[it->second].reg ||
+                register_file.test(ctx.assignments[it->second].reg, instr->operands[2].bytes())) {
+               instr->format = Format::VOP2;
+               instr->opcode = aco_opcode::v_mac_f32;
+            }
          }
 
          /* handle definitions which must have the same register as an operand */



More information about the mesa-commit mailing list