aco/spill: fix faulty assertions

By unintentionally using integer division for score(), these
assertions were likely to be raised by accident.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31769>
(cherry picked from commit 30d85b23ef)
This commit is contained in:
Daniel Schürmann 2024-10-21 17:25:10 +02:00 committed by Eric Engestrom
parent 2533e38af6
commit 5aac8d24fb
2 changed files with 6 additions and 6 deletions

View file

@ -2044,7 +2044,7 @@
"description": "aco/spill: fix faulty assertions",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -386,7 +386,7 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
while (reg_pressure.exceeds(ctx.target_pressure)) {
float score = 0;
Temp to_spill;
Temp to_spill = Temp();
type = reg_pressure.vgpr > ctx.target_pressure.vgpr ? RegType::vgpr : RegType::sgpr;
for (aco_ptr<Instruction>& phi : block->instructions) {
if (!is_phi(phi))
@ -400,7 +400,7 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
score = ctx.ssa_infos[var.id()].score();
}
}
assert(score != 0.0);
assert(to_spill != Temp());
ctx.add_to_spills(to_spill, ctx.spills_entry[block_idx]);
spilled_registers += to_spill;
reg_pressure -= to_spill;
@ -539,7 +539,7 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
}
++it;
}
assert(score != 0.0);
assert(to_spill != Temp());
ctx.add_to_spills(to_spill, ctx.spills_entry[block_idx]);
partial_spills.erase(to_spill);
spilled_registers += to_spill;
@ -920,7 +920,7 @@ process_block(spill_ctx& ctx, unsigned block_idx, Block* block, RegisterDemand s
/* if reg pressure is too high, spill variable with furthest next use */
while ((new_demand - spilled_registers).exceeds(ctx.target_pressure)) {
float score = 0.0;
Temp to_spill;
Temp to_spill = Temp();
unsigned do_rematerialize = 0;
unsigned avoid_respill = 0;
RegType type = RegType::sgpr;
@ -951,7 +951,7 @@ process_block(spill_ctx& ctx, unsigned block_idx, Block* block, RegisterDemand s
avoid_respill = loop_variable;
}
}
assert(score != 0.0);
assert(to_spill != Temp());
if (avoid_respill) {
/* This variable is spilled at the loop-header of the current loop.