aco/spill: keep loop-carried variables spilled at loop headers

Now, that we avoid re-spilling loop-carried variables, we can
keep them spilled at loop-headers.

Totals from 31 (0.04% of 79395) affected shaders: (GFX11)

Instrs: 1539175 -> 1538109 (-0.07%); split: -0.14%, +0.07%
CodeSize: 7877948 -> 7871916 (-0.08%); split: -0.16%, +0.08%
SpillSGPRs: 1936 -> 1523 (-21.33%)
SpillVGPRs: 160 -> 146 (-8.75%)
Scratch: 18176 -> 16896 (-7.04%)
Latency: 9439964 -> 9441197 (+0.01%); split: -0.01%, +0.02%
InvThroughput: 2406253 -> 2406700 (+0.02%); split: -0.01%, +0.03%
VClause: 38903 -> 38922 (+0.05%)
SClause: 33347 -> 33349 (+0.01%); split: -0.01%, +0.02%
Copies: 131420 -> 130974 (-0.34%); split: -0.57%, +0.23%
Branches: 53091 -> 53212 (+0.23%); split: -0.03%, +0.26%
VALU: 844372 -> 843876 (-0.06%); split: -0.12%, +0.06%
SALU: 190329 -> 189891 (-0.23%); split: -0.40%, +0.17%
VMEM: 60491 -> 60510 (+0.03%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27774>
This commit is contained in:
Daniel Schürmann 2024-02-22 17:12:17 +01:00 committed by Marge Bot
parent e968a18652
commit 971407bd2f

View file

@ -540,15 +540,13 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
if (it == next_use_distances.end())
continue;
/* keep constants and live-through variables spilled */
if (it->second.first >= loop_end || ctx.remat.count(spilled.first)) {
ctx.spills_entry[block_idx][spilled.first] = spilled.second;
spilled_registers += spilled.first;
loop_demand -= spilled.first;
}
/* keep live-through variables spilled */
ctx.spills_entry[block_idx][spilled.first] = spilled.second;
spilled_registers += spilled.first;
loop_demand -= spilled.first;
}
/* select live-through variables and constants */
/* select more live-through variables and constants */
RegType type = RegType::vgpr;
while (loop_demand.exceeds(ctx.target_pressure)) {
/* if VGPR demand is low enough, select SGPRs */