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

Author: Jason Ekstrand <[email protected]>
Date:   Mon Sep 14 13:39:47 2020 -0500

spirv: Handle the SubgroupSize execution mode

Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12959>

---

 src/compiler/shader_info.h        | 5 +++++
 src/compiler/spirv/spirv_to_nir.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 91421db9b74..56ee81aa061 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -431,6 +431,11 @@ typedef struct shader_info {
           */
          enum gl_derivative_group derivative_group:2;
 
+         /**
+          * Explicit subgroup size if set by the shader, otherwise 0.
+          */
+         unsigned subgroup_size;
+
          /**
           * pointer size is:
           *   AddressingModelLogical:    0    (default)
diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index 4b86a10a30a..bd164c234da 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -5137,6 +5137,11 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct 
vtn_value *entry_point,
       /* Handled later by vtn_handle_execution_mode_id(). */
       break;
 
+   case SpvExecutionModeSubgroupSize:
+      vtn_assert(b->shader->info.stage == MESA_SHADER_KERNEL);
+      b->shader->info.cs.subgroup_size = mode->operands[0];
+      break;
+
    case SpvExecutionModeSubgroupUniformControlFlowKHR:
       /* There's no corresponding SPIR-V capability, so check here. */
       vtn_fail_if(!b->options->caps.subgroup_uniform_control_flow,

Reply via email to