aco/spill: keep loop variables spilled during nested loops

Totals from 36 (0.05% of 79395) affected shaders: (GFX11)

Instrs: 2775993 -> 2781480 (+0.20%); split: -0.01%, +0.20%
CodeSize: 14184524 -> 14231956 (+0.33%); split: -0.01%, +0.34%
SpillSGPRs: 1441 -> 1207 (-16.24%)
SpillVGPRs: 477 -> 421 (-11.74%)
Scratch: 35840 -> 35072 (-2.14%)
Latency: 15559241 -> 15606047 (+0.30%); split: -0.01%, +0.31%
InvThroughput: 3787994 -> 3803749 (+0.42%); split: -0.02%, +0.44%
VClause: 76422 -> 76411 (-0.01%)
SClause: 55717 -> 55671 (-0.08%); split: -0.10%, +0.01%
Copies: 214877 -> 215185 (+0.14%); split: -0.04%, +0.18%
Branches: 93158 -> 93129 (-0.03%); split: -0.03%, +0.00%
VALU: 1520556 -> 1525425 (+0.32%); split: -0.00%, +0.32%
SALU: 341104 -> 341408 (+0.09%); split: -0.02%, +0.11%
VMEM: 119673 -> 119617 (-0.05%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27774>
This commit is contained in:
Daniel Schürmann
2024-03-14 15:16:02 +01:00
committed by Marge Bot
parent 80bc658efc
commit 898fd9227a
+13 -2
View File
@@ -144,8 +144,8 @@ struct spill_ctx {
const uint32_t spill_id = allocate_spill_id(to_spill.regClass());
for (auto pair : spills)
add_interference(spill_id, pair.second);
for (loop_info info : loop) {
for (auto pair : info.spills)
if (!loop.empty()) {
for (auto pair : loop.back().spills)
add_interference(spill_id, pair.second);
}
@@ -542,6 +542,17 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
spilled_registers += spilled.first;
loop_demand -= spilled.first;
}
if (!ctx.loop.empty()) {
/* If this is a nested loop, keep variables from the outer loop spilled. */
for (auto spilled : ctx.loop.back().spills) {
assert(next_use_distances.count(spilled.first));
if (ctx.spills_entry[block_idx].insert(spilled).second) {
spilled_registers += spilled.first;
loop_demand -= spilled.first;
}
}
}
/* select more live-through variables and constants */
RegType type = RegType::vgpr;