r600/sfn: add dependencies for kill instructions

GDS and image instructions have side effects, so they can't be
reordered with kill instructions.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23058>
This commit is contained in:
Gert Wollny 2023-05-17 08:07:51 +02:00 committed by Marge Bot
parent ab5f0affc8
commit b401e718d2
2 changed files with 23 additions and 1 deletions

View file

@ -1159,6 +1159,21 @@ Shader::emit_wait_ack()
return true;
}
void Shader::InstructionChain::visit(AluInstr *instr)
{
if (instr->is_kill()) {
last_kill_instr = instr;
// these instructions have side effects, they should
// not be re-order with kill
if (last_gds_instr)
instr->add_required_instr(last_gds_instr);
if (last_ssbo_instr)
instr->add_required_instr(last_ssbo_instr);
}
}
void
Shader::InstructionChain::visit(ScratchIOInstr *instr)
{
@ -1173,6 +1188,9 @@ Shader::InstructionChain::visit(GDSInstr *instr)
for (auto& loop : this_shader->m_loops) {
loop->set_instr_flag(flag);
}
if (last_kill_instr)
instr->add_required_instr(last_kill_instr);
}
void
@ -1189,6 +1207,9 @@ Shader::InstructionChain::visit(RatInstr *instr)
if (this_shader->m_current_block->inc_rat_emitted() > 15)
this_shader->start_new_block(0);
if (last_kill_instr)
instr->add_required_instr(last_kill_instr);
}
void

View file

@ -365,7 +365,6 @@ private:
class InstructionChain : public InstrVisitor {
public:
void visit(AluInstr *instr) override { (void)instr; }
void visit(AluGroup *instr) override { (void)instr; }
void visit(TexInstr *instr) override { (void)instr; }
void visit(ExportInstr *instr) override { (void)instr; }
@ -380,6 +379,7 @@ private:
void visit(LDSAtomicInstr *instr) override { (void)instr; }
void visit(LDSReadInstr *instr) override { (void)instr; }
void visit(AluInstr *instr) override;
void visit(ScratchIOInstr *instr) override;
void visit(GDSInstr *instr) override;
void visit(RatInstr *instr) override;
@ -390,6 +390,7 @@ private:
Instr *last_scratch_instr{nullptr};
Instr *last_gds_instr{nullptr};
Instr *last_ssbo_instr{nullptr};
Instr *last_kill_instr{nullptr};
bool prepare_mem_barrier{false};
};