From: Alyssa Rosenzweig Date: Wed, 5 May 2021 14:28:44 +0000 (-0400) Subject: pan/mdg: Remove midgard_opt_copy_prop_reg X-Git-Tag: upstream/21.2.3~3704 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad6e53da5c5498af12b604cf3c3d6562d6e7ebea;p=platform%2Fupstream%2Fmesa.git pan/mdg: Remove midgard_opt_copy_prop_reg This is known broken code, and the fix is highly nontrivial. It isn't doing terribly much for perf, so just rip off the band-aid. Prevents a dEQP regression, and likely fixes bugs in real apps too. total instructions in shared programs: 96640 -> 97089 (0.46%) instructions in affected programs: 27831 -> 28280 (1.61%) helped: 33 HURT: 301 helped stats (abs) min: 1 max: 6 x̄: 3.64 x̃: 5 helped stats (rel) min: 1.96% max: 10.00% x̄: 6.48% x̃: 7.94% HURT stats (abs) min: 1 max: 18 x̄: 1.89 x̃: 1 HURT stats (rel) min: 0.46% max: 15.00% x̄: 3.17% x̃: 2.38% 95% mean confidence interval for instructions value: 1.09 1.59 95% mean confidence interval for instructions %-change: 1.80% 2.63% Instructions are HURT. total bundles in shared programs: 45615 -> 45612 (<.01%) bundles in affected programs: 11257 -> 11254 (-0.03%) helped: 121 HURT: 146 helped stats (abs) min: 1 max: 7 x̄: 2.34 x̃: 1 helped stats (rel) min: 1.22% max: 23.33% x̄: 7.85% x̃: 5.26% HURT stats (abs) min: 1 max: 17 x̄: 1.92 x̃: 2 HURT stats (rel) min: 0.42% max: 25.00% x̄: 5.17% x̃: 3.85% 95% mean confidence interval for bundles value: -0.34 0.31 95% mean confidence interval for bundles %-change: -1.69% 0.23% Inconclusive result (value mean confidence interval includes 0). total quadwords in shared programs: 76662 -> 77275 (0.80%) quadwords in affected programs: 20148 -> 20761 (3.04%) helped: 28 HURT: 275 helped stats (abs) min: 1 max: 4 x̄: 1.54 x̃: 1 helped stats (rel) min: 0.43% max: 25.00% x̄: 4.89% x̃: 2.50% HURT stats (abs) min: 1 max: 12 x̄: 2.39 x̃: 2 HURT stats (rel) min: 0.51% max: 28.57% x̄: 5.18% x̃: 4.26% 95% mean confidence interval for quadwords value: 1.80 2.25 95% mean confidence interval for quadwords %-change: 3.64% 4.86% Quadwords are HURT. total registers in shared programs: 7078 -> 7081 (0.04%) registers in affected programs: 1028 -> 1031 (0.29%) helped: 62 HURT: 70 helped stats (abs) min: 1 max: 2 x̄: 1.11 x̃: 1 helped stats (rel) min: 8.33% max: 50.00% x̄: 15.03% x̃: 12.50% HURT stats (abs) min: 1 max: 2 x̄: 1.03 x̃: 1 HURT stats (rel) min: 8.33% max: 66.67% x̄: 20.13% x̃: 11.25% 95% mean confidence interval for registers value: -0.17 0.21 95% mean confidence interval for registers %-change: -0.14% 7.38% Inconclusive result (value mean confidence interval includes 0). total threads in shared programs: 5032 -> 5036 (0.08%) threads in affected programs: 31 -> 35 (12.90%) helped: 12 HURT: 6 helped stats (abs) min: 1 max: 2 x̄: 1.08 x̃: 1 helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00% HURT stats (abs) min: 1 max: 2 x̄: 1.50 x̃: 1 HURT stats (rel) min: 50.00% max: 50.00% x̄: 50.00% x̃: 50.00% 95% mean confidence interval for threads value: -0.43 0.87 95% mean confidence interval for threads %-change: 13.82% 86.18% Inconclusive result (value mean confidence interval includes 0). total loops in shared programs: 19 -> 19 (0.00%) loops in affected programs: 0 -> 0 helped: 0 HURT: 0 total spills in shared programs: 0 -> 2 spills in affected programs: 0 -> 2 helped: 0 HURT: 1 total fills in shared programs: 0 -> 15 fills in affected programs: 0 -> 15 helped: 0 HURT: 1 Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/midgard/midgard_opt_copy_prop.c b/src/panfrost/midgard/midgard_opt_copy_prop.c index 331c3d1..667440a 100644 --- a/src/panfrost/midgard/midgard_opt_copy_prop.c +++ b/src/panfrost/midgard/midgard_opt_copy_prop.c @@ -25,42 +25,6 @@ #include "compiler.h" #include "midgard_ops.h" -/* Special case for copypropagating the results of vectors */ - -static bool -midgard_opt_copy_prop_reg(compiler_context *ctx, midgard_block *block) -{ - bool progress = false; - - mir_foreach_instr_in_block_safe(block, ins) { - if (ins->type != TAG_ALU_4) continue; - if (!OP_IS_MOVE(ins->op)) continue; - if (ins->is_pack) continue; - - unsigned from = ins->src[1]; - unsigned to = ins->dest; - - if (!(to & PAN_IS_REG)) continue; - if (from & PAN_IS_REG) continue; - - if (ins->has_inline_constant) continue; - if (ins->has_constants) continue; - if (mir_nontrivial_mod(ins, 1, true)) continue; - if (mir_nontrivial_outmod(ins)) continue; - if (!mir_single_use(ctx, from)) continue; - - /* Ensure mask is continguous from 0 */ - if (!(ins->mask & (1 << COMPONENT_X))) continue; - if (ins->mask & (ins->mask + 1)) continue; - - mir_rewrite_index_dst(ctx, from, ins->dest); - mir_remove_instruction(ins); - progress |= true; - } - - return progress; -} - bool midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block) { @@ -129,5 +93,5 @@ midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block) progress |= true; } - return progress | midgard_opt_copy_prop_reg(ctx, block); + return progress; } diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c index 1ad223a..426eab8 100644 --- a/src/panfrost/midgard/mir.c +++ b/src/panfrost/midgard/mir.c @@ -98,6 +98,12 @@ mir_use_count(compiler_context *ctx, unsigned value) ++used_count; } + if (ctx->blend_input == value) + ++used_count; + + if (ctx->blend_src1 == value) + ++used_count; + return used_count; }