From 61f09295f30936273a13fbfa736a43b9e986e1d3 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 19 Feb 2026 11:40:26 -0800 Subject: [PATCH] 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: e6e34883a9e7 ("ir3: Add wavesize control") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14846 (cherry picked from commit 0c6da326f8c91de95f926558978fe0239ab41185) Part-of: --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_ra.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 381125a2e24..bb8c09c8d27 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index 25286ca82a4..3ffa3f85648 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -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;