Mesa (main): nir/deref: stop assuming coherent accesses of different SSBOs may alias

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 22:03:45 UTC 2022


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri May 20 14:28:29 2022 +0100

nir/deref: stop assuming coherent accesses of different SSBOs may alias

Whether it's coherent should be irrelevant and the ACCESS_RESTRICT check
above should consider all cases aliasing unless NIR makes it clear they're
not.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Tested-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: M Henning <drawoc at darkrefraction.com>
Cc: mesa-stable at lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894>

---

 src/compiler/nir/nir_deref.c | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 4faad2657ca..c0b57c42155 100644
--- a/src/compiler/nir/nir_deref.c
+++ b/src/compiler/nir/nir_deref.c
@@ -442,28 +442,6 @@ modes_may_alias(nir_variable_mode a, nir_variable_mode b)
    return a & b;
 }
 
-static bool
-deref_path_contains_coherent_decoration(nir_deref_path *path)
-{
-   assert(path->path[0]->deref_type == nir_deref_type_var);
-
-   if (path->path[0]->var->data.access & ACCESS_COHERENT)
-      return true;
-
-   for (nir_deref_instr **p = &path->path[1]; *p; p++) {
-      if ((*p)->deref_type != nir_deref_type_struct)
-         continue;
-
-      const struct glsl_type *struct_type = (*(p - 1))->type;
-      const struct glsl_struct_field *field =
-         glsl_get_struct_field_data(struct_type, (*p)->strct.index);
-      if (field->memory_coherent)
-         return true;
-   }
-
-   return false;
-}
-
 nir_deref_compare_result
 nir_compare_deref_paths(nir_deref_path *a_path,
                         nir_deref_path *b_path)
@@ -485,16 +463,6 @@ nir_compare_deref_paths(nir_deref_path *a_path,
              !(b_path->path[0]->modes & ~temp_var_modes))
             return nir_derefs_do_not_alias;
 
-         /* If they are both declared coherent or have coherent somewhere in
-          * their path (due to a member of an interface being declared
-          * coherent), we have to assume we that we could have any kind of
-          * aliasing.  Otherwise, they could still alias but the client didn't
-          * tell us and that's their fault.
-          */
-         if (deref_path_contains_coherent_decoration(a_path) &&
-             deref_path_contains_coherent_decoration(b_path))
-            return nir_derefs_may_alias_bit;
-
          /* Per SPV_KHR_workgroup_memory_explicit_layout and GL_EXT_shared_memory_block,
           * shared blocks alias each other.
           */



More information about the mesa-commit mailing list