Mesa (main): clc: add new feature options for intel_clc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 27 16:04:52 UTC 2022


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

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Mon Jun 27 13:12:46 2022 +0300

clc: add new feature options for intel_clc

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17253>

---

 src/compiler/clc/clc.h           | 3 +++
 src/compiler/clc/clc_helpers.cpp | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/compiler/clc/clc.h b/src/compiler/clc/clc.h
index c5c3a2b1c18..d5447306fd4 100644
--- a/src/compiler/clc/clc.h
+++ b/src/compiler/clc/clc.h
@@ -50,11 +50,14 @@ enum clc_spirv_version {
 };
 
 struct clc_optional_features {
+   bool fp16;
    bool fp64;
    bool int64;
    bool images;
    bool images_read_write;
    bool images_write_3d;
+   bool intel_subgroups;
+   bool subgroups;
 };
 
 struct clc_compile_args {
diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
index caee1fd81f7..4451c371933 100644
--- a/src/compiler/clc/clc_helpers.cpp
+++ b/src/compiler/clc/clc_helpers.cpp
@@ -871,6 +871,9 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
    c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_global_int32_extended_atomics");
    c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_local_int32_base_atomics");
    c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_local_int32_extended_atomics");
+   if (args->features.fp16) {
+      c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_fp16");
+   }
    if (args->features.fp64) {
       c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_fp64");
       c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+__opencl_c_fp64");
@@ -889,6 +892,12 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
       c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_3d_image_writes");
       c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+__opencl_c_3d_image_writes");
    }
+   if (args->features.intel_subgroups) {
+      c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_intel_subgroups");
+   }
+   if (args->features.subgroups) {
+      c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_subgroups");
+   }
 #endif
 
    if (args->num_headers) {



More information about the mesa-commit mailing list