Mesa (main): radeonsi: improve memory instruction tracking

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 02:41:11 UTC 2021


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Nov  7 11:34:31 2021 -0500

radeonsi: improve memory instruction tracking

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13700>

---

 src/gallium/drivers/radeonsi/si_shader_nir.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 3d968dcda8a..77fa0770efb 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -235,8 +235,8 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info
       nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
       const char *intr_name = nir_intrinsic_infos[intr->intrinsic].name;
       bool is_ssbo = strstr(intr_name, "ssbo");
-      bool is_image = strstr(intr_name, "image_deref");
-      bool is_bindless_image = strstr(intr_name, "bindless_image");
+      bool is_image = strstr(intr_name, "image") == intr_name;
+      bool is_bindless_image = strstr(intr_name, "bindless_image") == intr_name;
 
       /* Gather the types of used VMEM instructions that return something. */
       if (nir_intrinsic_infos[intr->intrinsic].has_dest) {
@@ -267,7 +267,9 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info
             if (is_image ||
                 is_bindless_image ||
                 is_ssbo ||
-                strstr(intr_name, "global") ||
+                (strstr(intr_name, "global") == intr_name ||
+                 intr->intrinsic == nir_intrinsic_load_global ||
+                 intr->intrinsic == nir_intrinsic_store_global) ||
                 strstr(intr_name, "scratch"))
                info->uses_vmem_return_type_other = true;
             break;
@@ -277,15 +279,9 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info
       if (is_bindless_image)
          info->uses_bindless_images = true;
 
-      if (strstr(intr_name, "image_atomic") ||
-          strstr(intr_name, "image_store") ||
-          strstr(intr_name, "image_deref_atomic") ||
-          strstr(intr_name, "image_deref_store") ||
-          strstr(intr_name, "ssbo_atomic") ||
-          intr->intrinsic == nir_intrinsic_store_ssbo)
+      if (nir_intrinsic_writes_external_memory(intr))
          info->num_memory_stores++;
 
-
       if (is_image && nir_deref_instr_has_indirect(nir_src_as_deref(intr->src[0])))
          info->uses_indirect_descriptor = true;
 



More information about the mesa-commit mailing list