aco: apply literals to split mads
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 20 Nov 2019 19:09:25 +0000 (19:09 +0000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 14 Jan 2020 12:56:28 +0000 (12:56 +0000)
Removing the return is also needed to apply literals to mads (which can be
done on GFX10).

pipeline-db (Navi):
Totals from affected shaders:
SGPRS: 368787 -> 367555 (-0.33 %)
VGPRS: 312436 -> 312448 (0.00 %)
Spilled SGPRs: 461 -> 461 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Code Size: 26113388 -> 26098260 (-0.06 %) bytes
Max Waves: 35982 -> 35982 (0.00 %)
Instructions: 5038670 -> 5028941 (-0.19 %)

pipeline-db (Vega):
Totals from affected shaders:
SGPRS: 369843 -> 368659 (-0.32 %)
VGPRS: 317224 -> 317196 (-0.01 %)
Spilled SGPRs: 629 -> 629 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Code Size: 26310540 -> 26295156 (-0.06 %) bytes
Max Waves: 36324 -> 36326 (0.01 %)
Instructions: 5073957 -> 5064164 (-0.19 %)

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/2883>

src/amd/compiler/aco_optimizer.cpp

index 8e4d4d6d9c00b102c1ffca4b36598144b7244780..e7a2da1bcb1d4f296d0c610dc43978d70a6f8639 100644 (file)
@@ -2301,6 +2301,10 @@ void select_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr)
       /* first, check profitability */
       if (ctx.uses[info->mul_temp_id]) {
          ctx.uses[info->mul_temp_id]++;
+         if (instr->operands[0].isTemp())
+            ctx.uses[instr->operands[0].tempId()]--;
+         if (instr->operands[1].isTemp())
+            ctx.uses[instr->operands[1].tempId()]--;
          instr.swap(info->add_instr);
 
       /* second, check possible literals */
@@ -2333,7 +2337,6 @@ void select_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr)
             info->literal_idx = literal_idx;
          }
       }
-      return;
    }
 
    /* check for literals */