ir3: Fix constlen trimming when more than one stage is trimmed

The logic is supposed to find the stage with the maximum constlen to
trim for each time we have to trim a stage. But by not resetting
max_constlen each time, we would "trim" the same stage repeatedly,
leaving us thinking the total is below the limit when it actually isn't.

Cc: mesa-stable
(cherry picked from commit ae8928b638)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
Connor Abbott 2026-02-26 14:26:49 -05:00 committed by Eric Engestrom
parent 5840bf0b1b
commit ebfdb11193
2 changed files with 4 additions and 3 deletions

View file

@ -5254,7 +5254,7 @@
"description": "ir3: Fix constlen trimming when more than one stage is trimmed",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -830,11 +830,12 @@ trim_constlens(unsigned *constlens, unsigned first_stage, unsigned last_stage,
cur_total += constlens[i];
}
unsigned max_stage = 0;
unsigned max_const = 0;
uint32_t trimmed = 0;
while (cur_total > combined_limit) {
unsigned max_stage = 0;
unsigned max_const = 0;
for (unsigned i = first_stage; i <= last_stage; i++) {
if (constlens[i] >= max_const) {
max_stage = i;