r600/sfn: move kill handling fully to scheduling

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-14 14:48:51 +02:00 committed by Marge Bot
parent b401e718d2
commit fe881bf097
3 changed files with 23 additions and 11 deletions

View file

@ -49,16 +49,14 @@ AluGroup::add_instruction(AluInstr *instr)
ASSERTED auto opinfo = alu_ops.find(instr->opcode());
assert(opinfo->second.can_channel(AluOp::t, s_chip_class));
if (add_trans_instructions(instr)) {
if (instr->is_kill())
m_has_kill_op = true;
m_has_kill_op |= instr->is_kill();
return true;
}
}
if (add_vec_instructions(instr) && !instr->has_alu_flag(alu_is_trans)) {
instr->set_parent_group(this);
if (instr->is_kill())
m_has_kill_op = true;
m_has_kill_op |= instr->is_kill();
return true;
}
@ -68,8 +66,7 @@ AluGroup::add_instruction(AluInstr *instr)
if (s_max_slots > 4 && opinfo->second.can_channel(AluOp::t, s_chip_class) &&
add_trans_instructions(instr)) {
instr->set_parent_group(this);
if (instr->is_kill())
m_has_kill_op = true;
m_has_kill_op |= instr->is_kill();
return true;
}
@ -143,6 +140,8 @@ AluGroup::add_trans_instructions(AluInstr *instr)
/* We added a vector op in the trans channel, so we have to
* make sure the corresponding vector channel is used */
assert(instr->has_alu_flag(alu_is_trans) || m_slots[instr->dest_chan()]);
m_has_kill_op |= instr->is_kill();
return true;
}
}
@ -183,12 +182,16 @@ AluGroup::add_vec_instructions(AluInstr *instr)
int preferred_chan = instr->dest_chan();
if (!m_slots[preferred_chan]) {
if (instr->bank_swizzle() != alu_vec_unknown) {
if (try_readport(instr, instr->bank_swizzle()))
if (try_readport(instr, instr->bank_swizzle())) {
m_has_kill_op |= instr->is_kill();
return true;
}
} else {
for (AluBankSwizzle i = alu_vec_012; i != alu_vec_unknown; ++i) {
if (try_readport(instr, i))
if (try_readport(instr, i)) {
m_has_kill_op |= instr->is_kill();
return true;
}
}
}
} else {
@ -218,12 +221,16 @@ AluGroup::add_vec_instructions(AluInstr *instr)
dest->set_chan(free_chan);
if (instr->bank_swizzle() != alu_vec_unknown) {
if (try_readport(instr, instr->bank_swizzle()))
if (try_readport(instr, instr->bank_swizzle())) {
m_has_kill_op |= instr->is_kill();
return true;
}
} else {
for (AluBankSwizzle i = alu_vec_012; i != alu_vec_unknown; ++i) {
if (try_readport(instr, i))
if (try_readport(instr, i)) {
m_has_kill_op |= instr->is_kill();
return true;
}
}
}
}

View file

@ -325,6 +325,7 @@ BlockScheduler::schedule_block(Block& in_block,
bool have_instr = collect_ready(cir);
m_current_block = new Block(in_block.nesting_depth(), in_block.id());
m_current_block->set_instr_flag(Instr::force_cf);
assert(m_current_block->id() >= 0);
while (have_instr) {
@ -775,6 +776,10 @@ BlockScheduler::schedule_alu_to_group_vec(AluGroup *group)
continue;
}
// precausion: don't kill while we hae LDS queue reads in the pipeline
if ((*i)->is_kill() && m_current_block->lds_group_active())
continue;
if (!m_current_block->try_reserve_kcache(**i)) {
sfn_log << SfnLog::schedule << " failed (kcache)\n";
++i;

View file

@ -172,7 +172,7 @@ FragmentShader::process_stage_intrinsic(nir_intrinsic_instr *intr)
value_factory().src(intr->src[0], 0),
value_factory().zero(),
{AluInstr::last}));
start_new_block(0);
return true;
case nir_intrinsic_discard:
m_uses_discard = true;