From 62dbbe79ec2bc9f031002d034fa57c8c9c5cd04c Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Wed, 5 Feb 2025 12:49:26 +0100 Subject: [PATCH] ir3: fix emitting descriptor prefetches at end of preamble The fix in e7ac1094f69 to emit preamble defs in the correct block would move the cursor of the builder that is later used to insert descriptor prefetches, emitting them at the wrong place. Fix this by resetting the cursor before emitting the prefetches. Signed-off-by: Job Noorman Fixes: e7ac1094f69 ("ir3: rematerialize preamble defs in block dominated by sources") Part-of: (cherry picked from commit 8404e7428b6c25a32f8cbc3eb218dec5725bb5ff) --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_nir_opt_preamble.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 1939a5ddab6..d87ec26d60e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -494,7 +494,7 @@ "description": "ir3: fix emitting descriptor prefetches at end of preamble", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "e7ac1094f69830cb76e622525629ace68b757a10", "notes": null diff --git a/src/freedreno/ir3/ir3_nir_opt_preamble.c b/src/freedreno/ir3/ir3_nir_opt_preamble.c index 7c764fc6f40..ba458b1138f 100644 --- a/src/freedreno/ir3/ir3_nir_opt_preamble.c +++ b/src/freedreno/ir3/ir3_nir_opt_preamble.c @@ -752,6 +752,8 @@ ir3_nir_opt_prefetch_descriptors(nir_shader *nir, struct ir3_shader_variant *v) preamble_defs); } + /* ir3_rematerialize_def_for_preamble may have moved the cursor. */ + b.cursor = nir_after_impl(preamble); progress |= emit_descriptor_prefetch(&b, instr, preamble_descs, &state); if (state.sampler.num_prefetches == MAX_PREFETCHES &&