Module: Mesa
Branch: main
Commit: 64a026626003ff969ab1615edcc99dc845930a8c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=64a026626003ff969ab1615edcc99dc845930a8c

Author: Caio Oliveira <[email protected]>
Date:   Sun Feb 26 21:40:16 2023 -0800

pan/compiler: Fix handling of nir_intrinsic_scoped_barrier

Only emit anything if this is a control barrier, i.e. contains an
execution scope.  Also change the assertion to look at that scope
instead of the memory scope.

Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339>

---

 src/panfrost/compiler/bifrost_compile.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/panfrost/compiler/bifrost_compile.c 
b/src/panfrost/compiler/bifrost_compile.c
index ba144dd277c..0931261f38b 100644
--- a/src/panfrost/compiler/bifrost_compile.c
+++ b/src/panfrost/compiler/bifrost_compile.c
@@ -1655,11 +1655,15 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr 
*instr)
       break;
 
    case nir_intrinsic_scoped_barrier:
-      assert(b->shader->stage != MESA_SHADER_FRAGMENT);
-      assert(nir_intrinsic_memory_scope(instr) > NIR_SCOPE_SUBGROUP &&
-             "todo: subgroup barriers (different divergence rules)");
-
-      bi_barrier(b);
+      if (nir_intrinsic_execution_scope(instr) != NIR_SCOPE_NONE) {
+         assert(b->shader->stage != MESA_SHADER_FRAGMENT);
+         assert(nir_intrinsic_execution_scope(instr) > NIR_SCOPE_SUBGROUP &&
+                "todo: subgroup barriers (different divergence rules)");
+         bi_barrier(b);
+      }
+      /* Blob doesn't seem to do anything for memory barriers, so no need to
+       * check nir_intrinsic_memory_scope().
+       */
       break;
 
    case nir_intrinsic_shared_atomic_add:

Reply via email to