Mesa (master): nir/spirv: handle SpvStorageClassCrossWorkgroup

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 19 20:19:06 UTC 2019


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

Author: Karol Herbst <kherbst at redhat.com>
Date:   Tue Oct 23 14:06:16 2018 +0200

nir/spirv: handle SpvStorageClassCrossWorkgroup

v2: rename nir_var_global to nir_var_mem_global

Signed-off-by: Karol Herbst <kherbst at redhat.com>
Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/compiler/nir/nir.c             | 4 ++++
 src/compiler/nir/nir.h             | 1 +
 src/compiler/nir/nir_print.c       | 2 ++
 src/compiler/spirv/vtn_private.h   | 1 +
 src/compiler/spirv/vtn_variables.c | 4 ++++
 5 files changed, 12 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 446e256ecd..8ca8109351 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -152,6 +152,10 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
       exec_list_push_tail(&shader->shared, &var->node);
       break;
 
+   case nir_var_mem_global:
+      assert(!"nir_shader_add_variable cannot be used for global memory");
+      break;
+
    case nir_var_system_value:
       exec_list_push_tail(&shader->system_values, &var->node);
       break;
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 6fc4a831b5..3e36043205 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -104,6 +104,7 @@ typedef enum {
    nir_var_system_value    = (1 << 6),
    nir_var_mem_ssbo        = (1 << 7),
    nir_var_mem_shared      = (1 << 8),
+   nir_var_mem_global      = (1 << 9),
    nir_var_all             = ~0,
 } nir_variable_mode;
 
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index ab976af1c4..1bec387614 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -421,6 +421,8 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)
       return "ssbo";
    case nir_var_mem_shared:
       return "shared";
+   case nir_var_mem_global:
+      return "global";
    case nir_var_shader_temp:
       return want_local_global_mode ? "shader_temp" : "";
    case nir_var_function_temp:
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 09ae8b7145..a2b3dee751 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -419,6 +419,7 @@ enum vtn_variable_mode {
    vtn_variable_mode_ssbo,
    vtn_variable_mode_push_constant,
    vtn_variable_mode_workgroup,
+   vtn_variable_mode_cross_workgroup,
    vtn_variable_mode_input,
    vtn_variable_mode_output,
 };
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index d0c73f7530..ced02fd6f7 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1709,6 +1709,9 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
       nir_mode = nir_var_uniform;
       break;
    case SpvStorageClassCrossWorkgroup:
+      mode = vtn_variable_mode_cross_workgroup;
+      nir_mode = nir_var_mem_global;
+      break;
    case SpvStorageClassGeneric:
    default:
       vtn_fail("Unhandled variable storage class");
@@ -2059,6 +2062,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
    case vtn_variable_mode_ubo:
    case vtn_variable_mode_ssbo:
    case vtn_variable_mode_push_constant:
+   case vtn_variable_mode_cross_workgroup:
       /* These don't need actual variables. */
       break;
    }




More information about the mesa-commit mailing list