r600/sfn: redirect copy propagation to alu parent group
authorGert Wollny <gert.wollny@collabora.com>
Tue, 28 Feb 2023 16:54:46 +0000 (17:54 +0100)
committerMarge Bot <emma+marge@anholt.net>
Sun, 5 Mar 2023 09:54:08 +0000 (09:54 +0000)
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 <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21684>

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

index 08d0d29..20b8a29 100644 (file)
@@ -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; }
 
index cb90b40..f3ed268 100644 (file)
@@ -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()) {