Mesa (main): ir3: Don't emit barriers for make_available/make_visible

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Oct 30 00:00:19 UTC 2021


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Fri Oct 29 19:02:25 2021 +0200

ir3: Don't emit barriers for make_available/make_visible

When looking at the output of some CTS tests, I realized that the
barriers vtn currently inserts to emulate coherent memory accesses
were being turned into fences, even though we never needed to do
anything special for coherent accesses before so presumably accesses are
already cache-coherent by default. Ignore make_visible/make_available
semantics to get us back to parity with the old path.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13599>

---

 src/freedreno/ir3/ir3_compiler_nir.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 4af7da861af..6302f293072 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -1412,6 +1412,12 @@ emit_intrinsic_barrier(struct ir3_context *ctx, nir_intrinsic_instr *intr)
    case nir_intrinsic_scoped_barrier: {
       nir_scope exec_scope = nir_intrinsic_execution_scope(intr);
       nir_variable_mode modes = nir_intrinsic_memory_modes(intr);
+      /* loads/stores are always cache-coherent so we can filter out
+       * available/visible.
+       */
+      nir_memory_semantics semantics =
+         nir_intrinsic_memory_semantics(intr) & (NIR_MEMORY_ACQUIRE |
+                                                 NIR_MEMORY_RELEASE);
 
       if (ctx->so->type == MESA_SHADER_TESS_CTRL) {
          /* Remove mode corresponding to nir_intrinsic_memory_barrier_tcs_patch,
@@ -1429,7 +1435,7 @@ emit_intrinsic_barrier(struct ir3_context *ctx, nir_intrinsic_instr *intr)
 
       if ((modes &
            (nir_var_mem_shared | nir_var_mem_ssbo | nir_var_mem_global |
-            nir_var_image))) {
+            nir_var_image)) && semantics) {
          barrier = ir3_FENCE(b);
          barrier->cat7.r = true;
          barrier->cat7.w = true;



More information about the mesa-commit mailing list