Mesa (main): spirv: Support SPV_KHR_subgroup_uniform_control_flow

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 25 23:15:25 UTC 2021


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

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Wed Jun 23 15:57:31 2021 -0700

spirv: Support SPV_KHR_subgroup_uniform_control_flow

There's no SPIR-V Capability associated, so check in the Execution
Mode.  For now, don't keep track of whether a shader uses uniform
control flow in the shader_info, we can add that when/if a driver
actually need that information.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

---

 src/compiler/shader_info.h        | 1 +
 src/compiler/spirv/spirv_to_nir.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 1bb2f8b966d..a35bd72b6ea 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -91,6 +91,7 @@ struct spirv_supported_capabilities {
    bool subgroup_basic;
    bool subgroup_quad;
    bool subgroup_shuffle;
+   bool subgroup_uniform_control_flow;
    bool subgroup_vote;
    bool tessellation;
    bool transform_feedback;
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 6690053ba97..c4e05878062 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -5033,6 +5033,12 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       /* Handled later by vtn_handle_execution_mode_id(). */
       break;
 
+   case SpvExecutionModeSubgroupUniformControlFlowKHR:
+      /* There's no corresponding SPIR-V capability, so check here. */
+      vtn_fail_if(!b->options->caps.subgroup_uniform_control_flow,
+                  "SpvExecutionModeSubgroupUniformControlFlowKHR not supported.");
+      break;
+
    default:
       vtn_fail("Unhandled execution mode: %s (%u)",
                spirv_executionmode_to_string(mode->exec_mode),



More information about the mesa-commit mailing list