Mesa (main): microsoft/compiler: Change behavior for emitting inexpressible barriers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 1 21:17:12 UTC 2021


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

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Sun Apr 11 14:32:09 2021 -0700

microsoft/compiler: Change behavior for emitting inexpressible barriers

If the barrier tries to apply to memory that we can't express, just
don't apply the memory portion of the barrier. Similarly, if it tries
to apply a global memory barrier at invocation level, upgrade it to
thread-group.

Reviewed-by: Enrico Galli <enrico.galli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11670>

---

 src/microsoft/compiler/nir_to_dxil.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 434046bc86c..fe1d63a9561 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -2186,14 +2186,12 @@ emit_barrier(struct ntd_context *ctx, nir_intrinsic_instr *intr)
    nir_variable_mode modes = nir_intrinsic_memory_modes(intr);
    nir_scope mem_scope = nir_intrinsic_memory_scope(intr);
 
-   if (modes & ~(nir_var_mem_ssbo | nir_var_mem_global | nir_var_mem_shared))
-      return false;
-
-   if (mem_scope != NIR_SCOPE_DEVICE && mem_scope != NIR_SCOPE_WORKGROUP)
-      return false;
+   /* Currently vtn uses uniform to indicate image memory, which DXIL considers global */
+   if (modes & nir_var_uniform)
+      modes |= nir_var_mem_global;
 
    if (modes & (nir_var_mem_ssbo | nir_var_mem_global)) {
-      if (mem_scope == NIR_SCOPE_DEVICE)
+      if (mem_scope > NIR_SCOPE_WORKGROUP)
          flags |= DXIL_BARRIER_MODE_UAV_FENCE_GLOBAL;
       else
          flags |= DXIL_BARRIER_MODE_UAV_FENCE_THREAD_GROUP;



More information about the mesa-commit mailing list