aco: improve VMEMtoScalarWriteHazard s_waitcnt mitigation

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 <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18270>
This commit is contained in:
Rhys Perry 2022-08-25 20:40:31 +01:00 committed by Marge Bot
parent 2bd16256a6
commit a4f6acece1

View file

@ -673,6 +673,10 @@ handle_instruction_gfx10(State& state, NOP_ctx_gfx10& ctx, aco_ptr<Instruction>&
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();