aco: give spiller more room to assign spilled SGPRs to VGPRs

On chordal graphs, a greedy coloring can be done in a way that never uses
more colors than are required for the largest clique. However, since we
have vector values and force phi resources into the same spill slots, the
interference graphs are not chordal, and thus, this assumption doesn't hold.

Use twice as many spill slots as upper bound.

Totals from 10 (0.01% of 79242) affected shaders: (GFX11)
MaxWaves: 52 -> 54 (+3.85%)
Instrs: 271386 -> 271779 (+0.14%)
CodeSize: 1362544 -> 1365432 (+0.21%)
VGPRs: 2536 -> 2532 (-0.16%)
SpillVGPRs: 778 -> 818 (+5.14%)
Scratch: 73472 -> 76800 (+4.53%)
Latency: 3331718 -> 3328798 (-0.09%); split: -0.14%, +0.05%
InvThroughput: 1665860 -> 1643350 (-1.35%); split: -1.40%, +0.05%
VClause: 3292 -> 3329 (+1.12%); split: -0.06%, +1.18%
Copies: 46082 -> 46257 (+0.38%)

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27011>
This commit is contained in:
Daniel Schürmann 2024-01-11 10:38:40 +01:00 committed by Marge Bot
parent 47d7d73eb3
commit e3098bb232

View file

@ -1938,7 +1938,7 @@ spill(Program* program, live& live_vars)
/* calculate extra VGPRs required for spilling SGPRs */
if (demand.sgpr > sgpr_limit) {
unsigned sgpr_spills = demand.sgpr - sgpr_limit;
extra_vgprs = DIV_ROUND_UP(sgpr_spills, program->wave_size) + 1;
extra_vgprs = DIV_ROUND_UP(sgpr_spills * 2, program->wave_size) + 1;
}
/* add extra SGPRs required for spilling VGPRs */
if (demand.vgpr + extra_vgprs > vgpr_limit) {
@ -1949,7 +1949,7 @@ spill(Program* program, live& live_vars)
if (demand.sgpr + extra_sgprs > sgpr_limit) {
/* re-calculate in case something has changed */
unsigned sgpr_spills = demand.sgpr + extra_sgprs - sgpr_limit;
extra_vgprs = DIV_ROUND_UP(sgpr_spills, program->wave_size) + 1;
extra_vgprs = DIV_ROUND_UP(sgpr_spills * 2, program->wave_size) + 1;
}
}
/* the spiller has to target the following register demand */