From 244cc152d1b20592120ce1d5dd9627509b73d0b9 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 28 Feb 2023 17:54:46 +0100 Subject: [PATCH] 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 Part-of: --- 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 08d0d29..20b8a29 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 cb90b40..f3ed268 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()) { -- 2.7.4