aco: set has_VMEM,has_DS=false after a branch
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 21 Jul 2022 18:24:46 +0000 (19:24 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 8 Aug 2022 13:59:17 +0000 (13:59 +0000)
fossil-db (navi10):
Totals from 161 (0.10% of 161220) affected shaders:
Instrs: 206726 -> 207179 (+0.22%); split: -0.02%, +0.24%
CodeSize: 1114152 -> 1116032 (+0.17%); split: -0.01%, +0.18%
Latency: 2119380 -> 2147403 (+1.32%); split: -0.16%, +1.48%
InvThroughput: 462960 -> 461922 (-0.22%); split: -0.42%, +0.19%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17697>

src/amd/compiler/aco_insert_NOPs.cpp

index 6d07813..10a6a8a 100644 (file)
@@ -770,8 +770,9 @@ handle_instruction_gfx10(State& state, NOP_ctx_gfx10& ctx, aco_ptr<Instruction>&
       /* Mitigation for VMEM is needed only if there was already a branch after */
       ctx.has_VMEM = ctx.has_branch_after_VMEM;
    } else if (instr_is_branch(instr)) {
-      ctx.has_branch_after_VMEM = ctx.has_VMEM;
-      ctx.has_branch_after_DS = ctx.has_DS;
+      ctx.has_branch_after_VMEM |= ctx.has_VMEM;
+      ctx.has_branch_after_DS |= ctx.has_DS;
+      ctx.has_VMEM = ctx.has_DS = false;
    } else if (instr->opcode == aco_opcode::s_waitcnt_vscnt) {
       /* Only s_waitcnt_vscnt can mitigate the hazard */
       const SOPK_instruction& sopk = instr->sopk();