From 56ded410af82002ecc6cff0534fd7a6bb12fa4a6 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 12 Sep 2022 19:00:53 +0200 Subject: [PATCH] r600/sfn: Add a free-channel mask when testing whether a register can switch channel This should avoid making 4 slot ops out of 3-slot ops on Cayman Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp index 3799194..e7c7e43 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp @@ -137,10 +137,17 @@ public: using AluInstrVisitor::visit; void visit(AluInstr *alu) { - yes = (alu->alu_slots() == 1 || alu->has_alu_flag(alu_is_cayman_trans)); + if (alu->alu_slots() != 1) { + if (alu->has_alu_flag(alu_is_cayman_trans)) { + free_mask &= (1 << alu->alu_slots()) - 1; + } else { + yes = false; + } + } } - bool yes{false}; + bool yes{true}; + uint8_t free_mask{0xf}; }; @@ -182,18 +189,19 @@ bool AluGroup::add_vec_instructions(AluInstr *instr) auto dest = instr->dest(); if (dest && dest->pin() == pin_free) { + AluAllowSlotSwitch swich_allowed; for (auto u : dest->uses()) { - AluAllowSlotSwitch swich_allowed; u->accept(swich_allowed); if (!swich_allowed.yes) return false; } int free_chan = 0; - while (m_slots[free_chan] && free_chan < 4) + while (free_chan < 4 && (m_slots[free_chan] || + !(swich_allowed.free_mask & (1 << free_chan)))) free_chan++; - if (!m_slots[free_chan] && free_chan < 4) { + if (free_chan < 4) { sfn_log << SfnLog::schedule << "V: Try force channel " << free_chan << "\n"; dest->set_chan(free_chan); if (instr->bank_swizzle() != alu_vec_unknown) { -- 2.7.4