nir: Filter modes of scoped memory barrier in nir_opt_load_store_vectorize
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 11 Jan 2020 01:33:31 +0000 (17:33 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 17:57:13 +0000 (17:57 +0000)
Otherwise a scoped memory barrier containing nir_var_mem_ubo (which
memoryBarrier() does lower to) would incorrectly prevent the
optimization to happen in UBOs.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5980>

src/compiler/nir/nir_opt_load_store_vectorize.c

index f9b6774aa4e32c14e6530c4f5aa790e988b3bae1..96c9eb41cee006670736d3f03bd3c6cea09c8bfb 100644 (file)
@@ -1229,7 +1229,9 @@ handle_barrier(struct vectorize_ctx *ctx, bool *progress, nir_function_impl *imp
         if (nir_intrinsic_memory_scope(intrin) == NIR_SCOPE_NONE)
             break;
 
-         modes = nir_intrinsic_memory_modes(intrin);
+         modes = nir_intrinsic_memory_modes(intrin) & (nir_var_mem_ssbo |
+                                                       nir_var_mem_shared |
+                                                       nir_var_mem_global);
          acquire = nir_intrinsic_memory_semantics(intrin) & NIR_MEMORY_ACQUIRE;
          release = nir_intrinsic_memory_semantics(intrin) & NIR_MEMORY_RELEASE;
          switch (nir_intrinsic_memory_scope(intrin)) {