Module: Mesa
Branch: main
Commit: 9cc42242d5defc917fc0d4d1123db3a2c7cf7d96
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cc42242d5defc917fc0d4d1123db3a2c7cf7d96

Author: Connor Abbott <[email protected]>
Date:   Wed Dec  1 16:33:57 2021 +0100

ir3/sched: Support multiple destinations

Note: this is a behavior change for arrays, because it will count the
entire array instead of just the components written in the register
pressure calculation. However this is more accurate since this matches
how RA works.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14107>

---

 src/freedreno/ir3/ir3_sched.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/freedreno/ir3/ir3_sched.c b/src/freedreno/ir3/ir3_sched.c
index d15bf0d0320..ccfc9c3f44d 100644
--- a/src/freedreno/ir3/ir3_sched.c
+++ b/src/freedreno/ir3/ir3_sched.c
@@ -544,6 +544,20 @@ is_only_nonscheduled_use(struct ir3_instruction *instr,
    return true;
 }
 
+static unsigned
+new_regs(struct ir3_instruction *instr)
+{
+   unsigned regs = 0;
+
+   foreach_dst (dst, instr) {
+      if (!is_dest_gpr(dst))
+         continue;
+      regs += reg_elems(dst);
+   }
+
+   return regs;
+}
+
 /* find net change to live values if instruction were scheduled: */
 static int
 live_effect(struct ir3_instruction *instr)
@@ -552,7 +566,7 @@ live_effect(struct ir3_instruction *instr)
    int new_live =
       (n->partially_live || !instr->uses || instr->uses->entries == 0)
          ? 0
-         : dest_regs(instr);
+         : new_regs(instr);
    int freed_live = 0;
 
    /* if we schedule something that causes a vecN to be live,
@@ -569,7 +583,7 @@ live_effect(struct ir3_instruction *instr)
          continue;
 
       if (is_only_nonscheduled_use(src, instr))
-         freed_live += dest_regs(src);
+         freed_live += new_regs(src);
    }
 
    return new_live - freed_live;
@@ -1072,12 +1086,6 @@ is_output_collect(struct ir3_instruction *instr)
 static bool
 is_output_only(struct ir3_instruction *instr)
 {
-   if (!writes_gpr(instr))
-      return false;
-
-   if (!(instr->dsts[0]->flags & IR3_REG_SSA))
-      return false;
-
    foreach_ssa_use (use, instr)
       if (!is_output_collect(use))
          return false;

Reply via email to