Mesa (master): compiler/spirv: Handle the LocalSizeHint execution modes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 04:25:33 UTC 2020


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Tue Apr 14 01:56:20 2020 -0700

compiler/spirv: Handle the LocalSizeHint execution modes

It's basically the same as the LocalSize version except it fills
the local_size_hint array.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565>

---

 src/compiler/shader_info.h        |  1 +
 src/compiler/spirv/spirv_to_nir.c | 15 +++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index e1be926e6e1..1acb1825fd5 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -347,6 +347,7 @@ typedef struct shader_info {
 
       struct {
          uint16_t local_size[3];
+         uint16_t local_size_hint[3];
 
          bool local_size_variable:1;
          uint8_t user_data_components_amd:3;
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index a5288a6032c..b8b6397c525 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -4639,6 +4639,13 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       b->shader->info.fs.depth_layout = FRAG_DEPTH_LAYOUT_UNCHANGED;
       break;
 
+   case SpvExecutionModeLocalSizeHint:
+      vtn_assert(b->shader->info.stage == MESA_SHADER_KERNEL);
+      b->shader->info.cs.local_size_hint[0] = mode->operands[0];
+      b->shader->info.cs.local_size_hint[1] = mode->operands[1];
+      b->shader->info.cs.local_size_hint[2] = mode->operands[2];
+      break;
+
    case SpvExecutionModeLocalSize:
       vtn_assert(gl_shader_stage_is_compute(b->shader->info.stage));
       b->shader->info.cs.local_size[0] = mode->operands[0];
@@ -4646,9 +4653,6 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       b->shader->info.cs.local_size[2] = mode->operands[2];
       break;
 
-   case SpvExecutionModeLocalSizeHint:
-      break; /* Nothing to do with this */
-
    case SpvExecutionModeOutputVertices:
       if (b->shader->info.stage == MESA_SHADER_TESS_CTRL ||
           b->shader->info.stage == MESA_SHADER_TESS_EVAL) {
@@ -4854,7 +4858,10 @@ vtn_handle_execution_mode_id(struct vtn_builder *b, struct vtn_value *entry_poin
       break;
 
    case SpvExecutionModeLocalSizeHintId:
-      /* Nothing to do with this hint. */
+      vtn_assert(b->shader->info.stage == MESA_SHADER_KERNEL);
+      b->shader->info.cs.local_size_hint[0] = vtn_constant_uint(b, mode->operands[0]);
+      b->shader->info.cs.local_size_hint[1] = vtn_constant_uint(b, mode->operands[1]);
+      b->shader->info.cs.local_size_hint[2] = vtn_constant_uint(b, mode->operands[2]);
       break;
 
    default:



More information about the mesa-commit mailing list