From b17e59a03b2c31460145b691dc5b39b13e340003 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 21 Jul 2022 19:23:38 +0100 Subject: [PATCH] aco: fix LdsBranchVmemWARHazard with 2+ branch chains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example, "DS -> branch -> VMEM -> branch -> DS". fossil-db (navi10): Totals from 639 (0.40% of 161220) affected shaders: Instrs: 629090 -> 628254 (-0.13%); split: -0.19%, +0.06% CodeSize: 3410164 -> 3406748 (-0.10%); split: -0.14%, +0.04% Latency: 7834755 -> 7821011 (-0.18%); split: -0.70%, +0.52% InvThroughput: 1369698 -> 1374495 (+0.35%); split: -0.12%, +0.47% A lot of the fossil-db changes are noise. threekingdoms.8db138826c386a62.1.foz/0b222ed175eebad0 is an example of a shader that actually has this issue. Signed-off-by: Rhys Perry Reviewed-by: Timur Kristóf Fixes: c037ba1bb7a ("aco/gfx10: Mitigate LdsBranchVmemWARHazard.") Part-of: --- src/amd/compiler/aco_insert_NOPs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/compiler/aco_insert_NOPs.cpp b/src/amd/compiler/aco_insert_NOPs.cpp index b0523868524..6d07813b736 100644 --- a/src/amd/compiler/aco_insert_NOPs.cpp +++ b/src/amd/compiler/aco_insert_NOPs.cpp @@ -787,6 +787,9 @@ handle_instruction_gfx10(State& state, NOP_ctx_gfx10& ctx, aco_ptr& wait->definitions[0] = Definition(sgpr_null, s1); wait->imm = 0; new_instructions.emplace_back(std::move(wait)); + + ctx.has_VMEM = instr->isVMEM() || instr->isGlobal() || instr->isScratch(); + ctx.has_DS = instr->isDS(); } /* NSAToVMEMBug