ir3/ra: Fix DOUBLE_ONLY limit pressure computation.

As the comment says, we want to limit our pressure based on underlying HW
reg file size, not max it out to HW reg file size.  This caused us to not
spill when we should when the HW reg size was bigger than the ISA reg file
size, leading to OOB writes in RA when it tried to allocate to the limit
pressure we spilled to.

Fixes segfaults in llama.cpp's test-backend-ops.

Fixes: e6e34883a9 ("ir3: Add wavesize control")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14846
(cherry picked from commit 0c6da326f8)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Emma Anholt 2026-02-19 11:40:26 -08:00 committed by Eric Engestrom
parent b7752ddbc3
commit 61f09295f3
2 changed files with 2 additions and 2 deletions

View file

@ -1554,7 +1554,7 @@
"description": "ir3/ra: Fix DOUBLE_ONLY limit pressure computation.",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e6e34883a9e75c49fe505fec4768f36b9779df1d",
"notes": null

View file

@ -2767,7 +2767,7 @@ ir3_ra_get_reg_file_limits(struct ir3_shader_variant *v)
*/
if (v->shader_options.real_wavesize == IR3_DOUBLE_ONLY) {
limit_pressure.full =
MAX2(limit_pressure.full, v->compiler->reg_size_vec4 / 2 * 16);
MIN2(limit_pressure.full, v->compiler->reg_size_vec4 / 2 * 16);
}
return limit_pressure;