From bc6b527b5202f39c02b2bbba28bf334531306605 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 7 Mar 2025 09:43:59 -0500 Subject: [PATCH] nir/lower_helper_writes: fix stores after discard We need to use nir_is_helper_invocation instead of nir_load_helper_invocation, to correctly predicate stores after demote. Identified in a Piglit on AGX a year ago but I forgot to upstream this. Fixes: 586da7b3290 ("nir: Add nir_lower_helper_writes pass") Signed-off-by: Alyssa Rosenzweig Reviewed-by: Mary Guillemard Part-of: --- src/compiler/nir/nir_lower_helper_writes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_helper_writes.c b/src/compiler/nir/nir_lower_helper_writes.c index e4edc7c9b75..1be2efa6cc1 100644 --- a/src/compiler/nir/nir_lower_helper_writes.c +++ b/src/compiler/nir/nir_lower_helper_writes.c @@ -53,7 +53,10 @@ lower(nir_builder *b, nir_intrinsic_instr *intr, void *data) bool has_dest = nir_intrinsic_infos[intr->intrinsic].has_dest; nir_def *undef = NULL; - nir_def *helper = nir_load_helper_invocation(b, 1); + /* We need to use nir_is_helper_invocation instead of + * nir_load_helper_invocation, to correctly predicate stores after demote. + */ + nir_def *helper = nir_is_helper_invocation(b, 1); nir_push_if(b, nir_inot(b, helper)); nir_instr_remove(&intr->instr); nir_builder_instr_insert(b, &intr->instr);