From: Rhys Perry Date: Thu, 6 Aug 2020 14:57:05 +0000 (+0100) Subject: aco: fix spills_entry heuristic for branch blocks in init_live_in_vars() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75d6c30572ce78952f76ee62a71332a424ca886a;p=mesa.git aco: fix spills_entry heuristic for branch blocks in init_live_in_vars() fossil-db (Navi): Totals from 222 (0.16% of 135946) affected shaders: SpillSGPRs: 9121 -> 9117 (-0.04%) SpillVGPRs: 2820 -> 1821 (-35.43%) CodeSize: 5134264 -> 5053336 (-1.58%); split: -1.63%, +0.05% Instrs: 953435 -> 938761 (-1.54%); split: -1.59%, +0.05% Cycles: 100567688 -> 97252432 (-3.30%); split: -3.34%, +0.04% VMEM: 40752 -> 39219 (-3.76%); split: +0.04%, -3.80% SMEM: 15416 -> 15509 (+0.60%); split: +0.64%, -0.03% VClause: 20120 -> 19091 (-5.11%) SClause: 23540 -> 23544 (+0.02%); split: -0.11%, +0.12% Copies: 125912 -> 122017 (-3.09%); split: -3.36%, +0.26% Branches: 31131 -> 30009 (-3.60%) Mostly affects parallel-rdp ubershaders. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Cc: 20.2 Part-of: --- diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 45c67469d94..94364bfa54e 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -502,7 +502,7 @@ RegisterDemand init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_id for (std::pair pair : ctx.spills_exit[pred_idx]) { if (pair.first.type() == RegType::sgpr && ctx.next_use_distances_start[block_idx].find(pair.first) != ctx.next_use_distances_start[block_idx].end() && - ctx.next_use_distances_start[block_idx][pair.first].second > block_idx) { + ctx.next_use_distances_start[block_idx][pair.first].first != block_idx) { ctx.spills_entry[block_idx].insert(pair); spilled_registers.sgpr += pair.first.size(); } @@ -512,7 +512,7 @@ RegisterDemand init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_id for (std::pair pair : ctx.spills_exit[pred_idx]) { if (pair.first.type() == RegType::vgpr && ctx.next_use_distances_start[block_idx].find(pair.first) != ctx.next_use_distances_start[block_idx].end() && - ctx.next_use_distances_start[block_idx][pair.first].second > block_idx) { + ctx.next_use_distances_start[block_idx][pair.first].first != block_idx) { ctx.spills_entry[block_idx].insert(pair); spilled_registers.vgpr += pair.first.size(); }