diff --git a/patches/crashfix.patch b/patches/crashfix.patch new file mode 100644 index 0000000..797c1ff --- /dev/null +++ b/patches/crashfix.patch @@ -0,0 +1,36 @@ +From 8653abac095c76fc898cbd72bc67b10b828c3478 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timur=20Krist=C3=B3f?= +Date: Mon, 25 Nov 2024 22:19:28 +0100 +Subject: [PATCH] ac/nir/ngg: Remove erroneous NUW addition from workgroup + scan. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This may add constant -1 so naturally it can indeed cause +an unsigned wrap. + +Fixes: 492d8f37782c14fd4c34b81c10f0f6ed0daa807c +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12204 +Signed-off-by: Timur Kristóf +Reviewed-by: Georg Lehmann +Part-of: +--- + src/amd/common/ac_nir_lower_ngg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c +index d1c361165ffa4..c63441f06959c 100644 +--- a/src/amd/common/ac_nir_lower_ngg.c ++++ b/src/amd/common/ac_nir_lower_ngg.c +@@ -419,7 +419,7 @@ repack_invocations_in_workgroup(nir_builder *b, nir_def **input_bool, + + for (unsigned i = 0; i < num_repacks; ++i) { + nir_def *index_base_lane = nir_iadd_imm_nuw(b, wave_id, i * 16); +- nir_def *num_invocartions_lane = nir_iadd_imm_nuw(b, num_waves, i * 16 - 1); ++ nir_def *num_invocartions_lane = nir_iadd_imm(b, num_waves, i * 16 - 1); + nir_def *wg_repacked_index_base = + nir_isub(b, nir_read_invocation(b, sum, index_base_lane), surviving_invocations_in_current_wave[i]); + results[i].num_repacked_invocations = +-- +