summaryrefslogtreecommitdiff
path: root/src/amd/compiler/aco_optimizer.cpp
diff options
context:
space:
mode:
authorRhys Perry <pendingchaos02@gmail.com>2021-03-18 11:33:41 +0000
committerMarge Bot <emma+marge@anholt.net>2021-12-13 11:22:33 +0000
commita487747ebd84c843356e86fdb6538383aa7c4083 (patch)
tree6887cfa6363f0fa0afccaee8526b33749c93c9e2 /src/amd/compiler/aco_optimizer.cpp
parent9a388beda7ba10675246bf782f8c362448d92c40 (diff)
aco: use more predictable tiebreaker when forming MADs
fossil-db (GFX10.3): Totals from 84981 (58.10% of 146267) affected shaders: VGPRs: 3829896 -> 3820480 (-0.25%); split: -0.33%, +0.08% CodeSize: 270860472 -> 270850132 (-0.00%); split: -0.08%, +0.08% MaxWaves: 2035822 -> 2042516 (+0.33%); split: +0.39%, -0.06% Instrs: 51285526 -> 51308869 (+0.05%); split: -0.03%, +0.08% Latency: 931503706 -> 932556231 (+0.11%); split: -0.19%, +0.30% InvThroughput: 217084232 -> 217070849 (-0.01%); split: -0.12%, +0.11% fossil-db (GFX10): Totals from 85520 (58.47% of 146267) affected shaders: VGPRs: 3729132 -> 3725344 (-0.10%); split: -0.21%, +0.10% CodeSize: 272796500 -> 272783084 (-0.00%); split: -0.09%, +0.08% MaxWaves: 2246410 -> 2249012 (+0.12%); split: +0.17%, -0.05% Instrs: 51643962 -> 51664865 (+0.04%); split: -0.04%, +0.08% Latency: 932331949 -> 933274979 (+0.10%); split: -0.19%, +0.29% InvThroughput: 214187040 -> 214130994 (-0.03%); split: -0.13%, +0.11% fossil-db (GFX9): Totals from 84619 (57.80% of 146401) affected shaders: SGPRs: 5366240 -> 5366944 (+0.01%); split: -0.09%, +0.10% VGPRs: 3765608 -> 3764972 (-0.02%); split: -0.23%, +0.22% CodeSize: 263634732 -> 263616320 (-0.01%); split: -0.08%, +0.08% MaxWaves: 546617 -> 547091 (+0.09%); split: +0.18%, -0.09% Instrs: 51426195 -> 51458334 (+0.06%); split: -0.03%, +0.10% Latency: 1164445660 -> 1161923480 (-0.22%); split: -0.46%, +0.24% InvThroughput: 542964697 -> 542329595 (-0.12%); split: -0.26%, +0.14% 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/9805>
Diffstat (limited to 'src/amd/compiler/aco_optimizer.cpp')
-rw-r--r--src/amd/compiler/aco_optimizer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 5727150a25d..b93532c2291 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -3372,9 +3372,16 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
Operand op[3] = {info.instr->operands[0], info.instr->operands[1], instr->operands[1 - i]};
if (info.instr->isSDWA() || info.instr->isDPP() || !check_vop3_operands(ctx, 3, op) ||
- ctx.uses[instr->operands[i].tempId()] >= uses)
+ ctx.uses[instr->operands[i].tempId()] > uses)
continue;
+ if (ctx.uses[instr->operands[i].tempId()] == uses) {
+ unsigned cur_idx = mul_instr->definitions[0].tempId();
+ unsigned new_idx = info.instr->definitions[0].tempId();
+ if (cur_idx > new_idx)
+ continue;
+ }
+
mul_instr = info.instr;
add_op_idx = 1 - i;
uses = ctx.uses[instr->operands[i].tempId()];