From a4f6acece1771f0eff74c010256115faf8fea86d Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 25 Aug 2022 20:40:31 +0100 Subject: [PATCH] aco: improve VMEMtoScalarWriteHazard s_waitcnt mitigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fossil-db (navi10): Totals from 171 (0.13% of 134563) affected shaders: Instrs: 69348 -> 69144 (-0.29%) CodeSize: 381112 -> 380296 (-0.21%) Latency: 451534 -> 451387 (-0.03%) InvThroughput: 88692 -> 88686 (-0.01%) Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_insert_NOPs.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/amd/compiler/aco_insert_NOPs.cpp b/src/amd/compiler/aco_insert_NOPs.cpp index 0742190ae10..b63f2755d77 100644 --- a/src/amd/compiler/aco_insert_NOPs.cpp +++ b/src/amd/compiler/aco_insert_NOPs.cpp @@ -673,6 +673,10 @@ handle_instruction_gfx10(State& state, NOP_ctx_gfx10& ctx, aco_ptr& wait_imm imm(state.program->gfx_level, instr->sopp().imm); if (imm.vm == 0) ctx.sgprs_read_by_VMEM.reset(); + if (imm.lgkm == 0) + ctx.sgprs_read_by_DS.reset(); + } else if (instr->opcode == aco_opcode::s_waitcnt_vscnt && instr->sopk().imm == 0) { + ctx.sgprs_read_by_VMEM_store.reset(); } else if (instr->opcode == aco_opcode::s_waitcnt_depctr && instr->sopp().imm == 0xffe3) { /* Hazard is mitigated by a s_waitcnt_depctr with a magic imm */ ctx.sgprs_read_by_VMEM.reset();