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

Author: Gert Wollny <[email protected]>
Date:   Tue Feb 28 17:54:46 2023 +0100

r600/sfn: redirect copy propagation to alu parent group

If an ALU instruction was emitted from the get-go as group, then
we have to make sure that replacing a source doesn't violate the
readport configuration in the group.

Closes: 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>

---

 src/gallium/drivers/r600/sfn/sfn_instr_alu.h   | 1 +
 src/gallium/drivers/r600/sfn/sfn_optimizer.cpp | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h 
b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h
index 08d0d290779..20b8a2973ce 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h
@@ -179,6 +179,7 @@ public:
    void inc_priority() { ++m_priority; }
 
    void set_parent_group(AluGroup *group) { m_parent_group = group; }
+   AluGroup *parent_group() { return m_parent_group;}
 
    AluInstr *as_alu() override { return this; }
 
diff --git a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp 
b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp
index cb90b402ccd..f3ed26822a4 100644
--- a/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_optimizer.cpp
@@ -407,7 +407,11 @@ CopyPropFwdVisitor::visit(AluInstr *instr)
       if (can_propagate) {
          sfn_log << SfnLog::opt << "   Try replace in " << i->block_id() << ":"
                  << i->index() << *i << "\n";
-         progress |= i->replace_source(dest, src);
+
+         if (i->as_alu() && i->as_alu()->parent_group()) {
+            progress |= i->as_alu()->parent_group()->replace_source(dest, src);
+         } else
+            progress |= i->replace_source(dest, src);
       }
    }
    if (instr->dest()) {

Reply via email to