r600/sfn: count LDS queue pop reads separately in assembler
authorGert Wollny <gert.wollny@collabora.com>
Thu, 21 Jul 2022 15:52:05 +0000 (17:52 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sat, 23 Jul 2022 13:10:45 +0000 (13:10 +0000)
Otherwise the check whether the fetches and reads are balanced
could fail.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17678>

src/gallium/drivers/r600/sfn/sfn_assembler.cpp
src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
src/gallium/drivers/r600/sfn/sfn_instr_alu.h

index dc8a767..75c3e59 100644 (file)
@@ -309,7 +309,7 @@ void AssamblerVisitor::emit_alu_op(const AluInstr& ai)
          alu.src[i].kc_rel = 1;
       }
 
-      if (ai.has_lds_access()) {
+      if (ai.has_lds_queue_read()) {
          assert(m_bc->cf_last->nlds_read > 0);
          m_bc->cf_last->nlds_read--;
       }
index 886adf5..fa02181 100644 (file)
@@ -788,14 +788,20 @@ bool AluInstr::propagate_death()
 
 bool AluInstr::has_lds_access() const
 {
-   if (has_alu_flag(alu_is_lds))
-      return true;
+   return has_alu_flag(alu_is_lds) || has_lds_queue_read();
+}
 
-   for (auto& s : m_src)
-      if (s->as_inline_const() &&
-          (s->as_inline_const()->sel() == ALU_SRC_LDS_OQ_A_POP))
-         return true;
+bool AluInstr::has_lds_queue_read() const
+{
+   for (auto& s : m_src) {
+      auto ic = s->as_inline_const();
+      if (!ic)
+         continue;
 
+      if (ic->sel() == ALU_SRC_LDS_OQ_A_POP ||
+          ic->sel() == ALU_SRC_LDS_OQ_B_POP)
+         return true;
+   }
    return false;
 }
 
index 2d9a24e..1d54e30 100644 (file)
@@ -127,6 +127,7 @@ public:
    bool is_equal_to(const AluInstr& lhs) const;
 
    bool has_lds_access() const;
+   bool has_lds_queue_read() const;
 
    static const std::map<ECFAluOpCode, std::string> cf_map;
    static const std::map<AluBankSwizzle, std::string> bank_swizzle_map;