intel/compiler: Use INFINITY spill cost to represent no_spill

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Antonio Ospite <None>
Reviewed-by: Kenneth Graunke <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32916>
This commit is contained in:
Caio Oliveira
2025-01-06 20:58:35 -08:00
committed by Marge Bot
parent 8ba718fb7d
commit e6a3770433
2 changed files with 6 additions and 10 deletions

View File

@@ -919,11 +919,9 @@ fs_reg_alloc::set_spill_costs()
{
float block_scale = 1.0;
float spill_costs[fs->alloc.count];
bool no_spill[fs->alloc.count];
for (unsigned i = 0; i < fs->alloc.count; i++) {
spill_costs[i] = 0.0;
no_spill[i] = false;
}
/* Calculate costs for spilling nodes. Call it a cost of 1 per
@@ -943,10 +941,10 @@ fs_reg_alloc::set_spill_costs()
if (_mesa_set_search(spill_insts, inst)) {
for (unsigned int i = 0; i < inst->sources; i++) {
if (inst->src[i].file == VGRF)
no_spill[inst->src[i].nr] = true;
spill_costs[inst->src[i].nr] = INFINITY;
}
if (inst->dst.file == VGRF)
no_spill[inst->dst.nr] = true;
spill_costs[inst->dst.nr] = INFINITY;
}
switch (inst->opcode) {
@@ -979,7 +977,7 @@ fs_reg_alloc::set_spill_costs()
* used in SCRATCH_READ/WRITE instructions so they'll always be flagged
* no_spill.
*/
if (no_spill[i])
if (isinf(spill_costs[i]))
continue;
int live_length = live.vgrf_end[i] - live.vgrf_start[i];

View File

@@ -841,11 +841,9 @@ elk_fs_reg_alloc::set_spill_costs()
{
float block_scale = 1.0;
float spill_costs[fs->alloc.count];
bool no_spill[fs->alloc.count];
for (unsigned i = 0; i < fs->alloc.count; i++) {
spill_costs[i] = 0.0;
no_spill[i] = false;
}
/* Calculate costs for spilling nodes. Call it a cost of 1 per
@@ -865,10 +863,10 @@ elk_fs_reg_alloc::set_spill_costs()
if (_mesa_set_search(spill_insts, inst)) {
for (unsigned int i = 0; i < inst->sources; i++) {
if (inst->src[i].file == VGRF)
no_spill[inst->src[i].nr] = true;
spill_costs[inst->src[i].nr] = INFINITY;
}
if (inst->dst.file == VGRF)
no_spill[inst->dst.nr] = true;
spill_costs[inst->dst.nr] = INFINITY;
}
switch (inst->opcode) {
@@ -902,7 +900,7 @@ elk_fs_reg_alloc::set_spill_costs()
* used in SCRATCH_READ/WRITE instructions so they'll always be flagged
* no_spill.
*/
if (no_spill[i])
if (isinf(spill_costs[i]))
continue;
int live_length = live.vgrf_end[i] - live.vgrf_start[i];