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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 16 20:50:26 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: ee6630d2069856d1bbb280aa6f2c1f7cbabded5f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee6630d2069856d1bbb280aa6f2c1f7cbabded5f

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>
(cherry picked from commit cb5c1bcb7c660e1966b891841f94020a36d348a1)

---

 .pick_status.json            |  2 +-
 src/compiler/nir/nir_deref.c | 32 --------------------------------
 2 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index d40f56db367..4df8331dad7 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4045,7 +4045,7 @@
         "description": "nir/deref: stop assuming coherent accesses of different SSBOs may alias",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 15e96908bf4..7f1dea60a47 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