r600/sfn: pass group into AluInstr::split instead of creating it

This is in preparation of splitting multi-slot ops late, when scheduling.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36860>
This commit is contained in:
Gert Wollny 2025-08-11 22:09:42 +02:00 committed by Marge Bot
parent 2797069e9a
commit ebe5765d0a
4 changed files with 17 additions and 16 deletions

View file

@ -839,16 +839,14 @@ r600_multislot_get_last_opcode_and_slot(EAluOp opcode, int dest_chan)
}
}
AluGroup *
AluInstr::split(ValueFactory& vf)
bool
AluInstr::split(ValueFactory& vf, AluGroup& group)
{
if (m_alu_slots == 1)
return nullptr;
return false;
sfn_log << SfnLog::instr << "Split " << *this << "\n";
auto group = new AluGroup();
m_dest->del_parent(this);
auto [last_opcode, start_slot] =
@ -909,13 +907,12 @@ AluInstr::split(ValueFactory& vf)
m_dest->add_parent(instr);
sfn_log << SfnLog::instr << " " << *instr << "\n";
if (!group->add_instruction(instr)) {
std::cerr << "Unable to schedule '" << *instr << "' into\n" << *group << "\n";
if (!group.add_instruction(instr)) {
std::cerr << "Unable to schedule '" << *instr << "' into\n" << group << "\n";
UNREACHABLE("Invalid group instruction");
}
}
group->set_blockid(block_id(), index());
group.set_blockid(block_id(), index());
for (auto s : m_src) {
auto r = s->as_register();
@ -923,9 +920,9 @@ AluInstr::split(ValueFactory& vf)
r->del_use(this);
}
}
group->set_origin(this);
set_scheduled();
return group;
return true;
}
/* Alu instructions that have SSA dest registers increase the regietsr

View file

@ -147,7 +147,7 @@ public:
int alu_slots() const { return m_alu_slots; }
AluGroup *split(ValueFactory& vf);
bool split(ValueFactory& vf, AluGroup& dest_group);
bool end_group() const override { return m_alu_flags.test(alu_last_instr); }

View file

@ -39,8 +39,11 @@ public:
else {
if (instr->alu_slots() == 1)
alu_vec.push_back(instr);
else
alu_groups.push_back(instr->split(m_value_factory));
else {
auto group = new AluGroup();
instr->split(m_value_factory, *group);
alu_groups.push_back(group);
}
}
}
void visit(AluGroup *instr) override { alu_groups.push_back(instr); }

View file

@ -333,9 +333,10 @@ TEST_F(InstrTest, test_alu_dot4_grouped)
EXPECT_EQ(alu, alu);
ValueFactory vf;
auto group = alu.split(vf);
auto group = new AluGroup();
bool result = alu.split(vf, *group);
group->fix_last_flag();
ASSERT_TRUE(group);
ASSERT_TRUE(result);
auto i = group->begin();
EXPECT_NE(i, group->end());