diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2020-08-06 17:38:41 +0100 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2020-08-28 11:27:03 -0700 |
commit | 90ccdf42705a0f717f6f3693c5944323176baff8 (patch) | |
tree | 52ae3349bc3159d9c354e27ce3dfa53440cec2fd | |
parent | ed64b3d8e989ea1045b54447593265aba99fbf5d (diff) |
aco: keep loop live-through variables spilled
fossil-db (Navi):
Totals from 3149 (2.32% of 135946) affected shaders:
VGPRs: 280928 -> 280932 (+0.00%)
SpillSGPRs: 51133 -> 30042 (-41.25%)
CodeSize: 43063076 -> 41377252 (-3.91%); split: -3.92%, +0.00%
Instrs: 8278435 -> 8037133 (-2.91%); split: -2.92%, +0.00%
Cycles: 709575456 -> 683366172 (-3.69%); split: -3.69%, +0.00%
VMEM: 542887 -> 542937 (+0.01%); split: +0.05%, -0.04%
SMEM: 210255 -> 206368 (-1.85%); split: +0.12%, -1.97%
SClause: 258847 -> 258019 (-0.32%); split: -0.52%, +0.20%
Copies: 731836 -> 684784 (-6.43%); split: -6.44%, +0.01%
Branches: 305422 -> 292844 (-4.12%); split: -4.12%, +0.00%
PreSGPRs: 333103 -> 332701 (-0.12%)
PreVGPRs: 280086 -> 280089 (+0.00%)
Helps mostly Detroit: Become Human and the single spilling Doom Eternal
shader.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: 20.2 <mesa-stable>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6212>
(cherry picked from commit e8ac14527a2fd384c1f2cce56e44a9e93e0a13ec)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/amd/compiler/aco_spill.cpp | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json index 17c657c7025..bc03cb7e3c2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -715,7 +715,7 @@ "description": "aco: keep loop live-through variables spilled", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 94364bfa54e..7d3055e33e0 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -383,6 +383,20 @@ RegisterDemand init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_id } unsigned loop_end = i; + /* keep live-through spilled */ + for (std::pair<Temp, std::pair<uint32_t, uint32_t>> pair : ctx.next_use_distances_end[block_idx - 1]) { + if (pair.second.first < loop_end) + continue; + + Temp to_spill = pair.first; + auto it = ctx.spills_exit[block_idx - 1].find(to_spill); + if (it == ctx.spills_exit[block_idx - 1].end()) + continue; + + ctx.spills_entry[block_idx][to_spill] = it->second; + spilled_registers += to_spill; + } + /* select live-through vgpr variables */ while (new_demand.vgpr - spilled_registers.vgpr > ctx.target_pressure.vgpr) { unsigned distance = 0; |