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

Author: Gert Wollny <[email protected]>
Date:   Tue Feb 28 16:22:34 2023 +0100

r600/sfn: Add AluGroup method to update readport validation from scratch

Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8374

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21684>

---

 .../drivers/r600/sfn/sfn_instr_alugroup.cpp        | 35 ++++++++++++++++++++++
 src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h  |  2 ++
 2 files changed, 37 insertions(+)

diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp 
b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp
index 86c7cf98356..c8b144f55e6 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp
@@ -251,6 +251,41 @@ AluGroup::add_vec_instructions(AluInstr *instr)
    return false;
 }
 
+void AluGroup::update_readport_reserver()
+{
+   AluReadportReservation readports_evaluator;
+   for (int i = 0; i < 4;  ++i) {
+      if (!m_slots[i])
+         continue;
+
+      AluReadportReservation re = readports_evaluator;
+      AluBankSwizzle bs = alu_vec_012;
+      while (bs != alu_vec_unknown) {
+         if (re.schedule_vec_instruction(*m_slots[i], bs)) {
+            readports_evaluator = re;
+            break;
+         }
+         ++bs;
+      }
+      if (bs == alu_vec_unknown)
+         unreachable("Bank swizzle should have been checked before");
+   }
+
+   if (s_max_slots == 5 && m_slots[4]) {
+      AluReadportReservation re = readports_evaluator;
+      AluBankSwizzle bs = sq_alu_scl_201;
+      while (bs != sq_alu_scl_unknown) {
+         if (re.schedule_vec_instruction(*m_slots[4], bs)) {
+            readports_evaluator = re;
+            break;
+         }
+         ++bs;
+      }
+      if (bs == sq_alu_scl_unknown)
+         unreachable("Bank swizzle should have been checked before");
+   }
+}
+
 bool
 AluGroup::try_readport(AluInstr *instr, AluBankSwizzle cycle)
 {
diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h 
b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h
index b3906e4a585..05e71a0379f 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.h
@@ -86,6 +86,8 @@ public:
       m_readports_evaluator = rr;
    };
 
+   void update_readport_reserver();
+
    static bool has_t() { return s_max_slots == 5; }
 
    bool addr_for_src() const { return m_addr_for_src; }

Reply via email to