aco: insert NOP before dealloc_vgpr in the insert_NOPs pass

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24884>
This commit is contained in:
Rhys Perry 2024-09-03 12:12:06 +01:00 committed by Marge Bot
parent 4dfc564669
commit 295b7d606f
4 changed files with 7 additions and 10 deletions

View file

@ -1388,6 +1388,12 @@ handle_instruction_gfx11(State& state, NOP_ctx_gfx11& ctx, aco_ptr<Instruction>&
{
Builder bld(state.program, &new_instructions);
/* Due to a hazard, an s_nop is needed before "s_sendmsg sendmsg_dealloc_vgprs". */
if (instr->opcode == aco_opcode::s_sendmsg && instr->salu().imm == sendmsg_dealloc_vgprs &&
(new_instructions.empty() || new_instructions.back()->opcode != aco_opcode::s_nop)) {
bld.sopp(aco_opcode::s_nop, 0);
}
/* VcmpxPermlaneHazard
* Handle any permlane following a VOPC instruction writing exec, insert v_mov between them.
*/

View file

@ -1555,8 +1555,6 @@ dealloc_vgprs(Program* program)
Builder bld(program);
if (!block.instructions.empty() && block.instructions.back()->opcode == aco_opcode::s_endpgm) {
bld.reset(&block.instructions, block.instructions.begin() + (block.instructions.size() - 1));
/* Due to a hazard, an s_nop is needed before "s_sendmsg sendmsg_dealloc_vgprs". */
bld.sopp(aco_opcode::s_nop, 0);
bld.sopp(aco_opcode::s_sendmsg, sendmsg_dealloc_vgprs);
}

View file

@ -2397,10 +2397,8 @@ lower_to_hw_instr(Program* program)
if (program->stage == fragment_fs)
bld.exp(aco_opcode::exp, Operand(v1), Operand(v1), Operand(v1), Operand(v1), 0,
target, false, true, true);
if (should_dealloc_vgprs) {
bld.sopp(aco_opcode::s_nop, 0);
if (should_dealloc_vgprs)
bld.sopp(aco_opcode::s_sendmsg, sendmsg_dealloc_vgprs);
}
bld.sopp(aco_opcode::s_endpgm);
bld.reset(&ctx.instructions);

View file

@ -209,7 +209,6 @@ BEGIN_TEST(to_hw_instr.swap_subdword)
bld.pseudo(aco_opcode::p_parallelcopy, Definition(v128_hi, v2b), Definition(v129_lo, v2b),
Operand(v129_lo, v2b), Operand(v128_hi, v2b));
//~gfx11! s_nop
//~gfx11! s_sendmsg sendmsg(dealloc_vgprs)
//~gfx(8|9|11)! s_endpgm
@ -361,7 +360,6 @@ BEGIN_TEST(to_hw_instr.subdword_constant)
bld.pseudo(aco_opcode::p_unit_test, Operand::c32(17u));
bld.pseudo(aco_opcode::p_parallelcopy, Definition(v0_lo, v1b), Operand::zero(1));
//~gfx11! s_nop
//~gfx11! s_sendmsg sendmsg(dealloc_vgprs)
//! s_endpgm
@ -493,7 +491,6 @@ BEGIN_TEST(to_hw_instr.extract)
finish_to_hw_instr_test();
//~gfx11_.*! s_nop
//~gfx11_.*! s_sendmsg sendmsg(dealloc_vgprs)
//! s_endpgm
}
@ -612,7 +609,6 @@ BEGIN_TEST(to_hw_instr.insert)
finish_to_hw_instr_test();
//~gfx11! s_nop
//~gfx11! s_sendmsg sendmsg(dealloc_vgprs)
//! s_endpgm
}
@ -764,7 +760,6 @@ BEGIN_TEST(to_hw_instr.pack2x16_constant)
bld.pseudo(aco_opcode::p_parallelcopy, Definition(v0_lo, v2b), Definition(v0_hi, v2b),
Operand::zero(2), Operand(v1_lo, v2b));
//~gfx11! s_nop
//~gfx11! s_sendmsg sendmsg(dealloc_vgprs)
//! s_endpgm