From f4a7f286085a476bf60ff5def695deb5b59f4af7 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Mon, 31 Oct 2022 23:19:03 -0700 Subject: [PATCH] nir: Don't reorder volatile intrinsics Fixes issue with "is helper invocation" that in recent SPIR-V is mapped to a volatile Load. The CSE was catching the loads before they were transformed in the new is_helper_invocation intrinsic (that is not reorderable). Fixes: 729df14e452 ("nir: Handle volatile semantics for loading HelperInvocation builtin") Reviewed-by: Jason Ekstrand Reviewed-by: Kenneth Graunke Reviewed-by: M Henning Part-of: (cherry picked from commit 8ab628ab2e4d4f460e2eabdb11876997c0ab13bc) --- .pick_status.json | 2 +- src/compiler/nir/nir.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index dc774b7..072240a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -211,7 +211,7 @@ "description": "nir: Don't reorder volatile intrinsics", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "729df14e4528b70e63332e4255571729253e9791" }, diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index afc53ac..349c8a3 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1965,6 +1965,9 @@ void nir_rewrite_image_intrinsic(nir_intrinsic_instr *instr, static inline bool nir_intrinsic_can_reorder(nir_intrinsic_instr *instr) { + if (nir_intrinsic_has_access(instr) && + nir_intrinsic_access(instr) & ACCESS_VOLATILE) + return false; if (instr->intrinsic == nir_intrinsic_load_deref) { nir_deref_instr *deref = nir_src_as_deref(instr->src[0]); return nir_deref_mode_is_in_set(deref, nir_var_read_only_modes) || -- 2.7.4