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

Author: Karol Herbst <[email protected]>
Date:   Mon Dec  4 16:26:24 2023 +0100

clc: add support for cl_khr_subgroup_shuffle and shuffle_relative

Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Jesse Natalie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26504>

---

 src/compiler/clc/clc.h                       | 2 ++
 src/compiler/clc/clc_helpers.cpp             | 8 ++++++++
 src/gallium/frontends/rusticl/core/device.rs | 3 +--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/compiler/clc/clc.h b/src/compiler/clc/clc.h
index 2e7542b3caf..9d736b16e66 100644
--- a/src/compiler/clc/clc.h
+++ b/src/compiler/clc/clc.h
@@ -64,6 +64,8 @@ struct clc_optional_features {
     * progress
     */
    bool subgroups_ifp;
+   bool subgroups_shuffle;
+   bool subgroups_shuffle_relative;
 };
 
 struct clc_compile_args {
diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
index 6cb65e3e579..96552f9cc9a 100644
--- a/src/compiler/clc/clc_helpers.cpp
+++ b/src/compiler/clc/clc_helpers.cpp
@@ -812,6 +812,14 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
       
clang_opts.push_back("-D__opencl_c_integer_dot_product_input_4x8bit_packed=1");
       clang_opts.push_back("-D__opencl_c_integer_dot_product_input_4x8bit=1");
    }
+   if (args->features.subgroups) {
+      if (args->features.subgroups_shuffle) {
+         clang_opts.push_back("-Dcl_khr_subgroup_shuffle=1");
+      }
+      if (args->features.subgroups_shuffle_relative) {
+         clang_opts.push_back("-Dcl_khr_subgroup_shuffle_relative=1");
+      }
+   }
 
    // We assume there's appropriate defines for __OPENCL_VERSION__ and 
__IMAGE_SUPPORT__
    // being provided by the caller here.
diff --git a/src/gallium/frontends/rusticl/core/device.rs 
b/src/gallium/frontends/rusticl/core/device.rs
index 35b2331368d..af524fce83f 100644
--- a/src/gallium/frontends/rusticl/core/device.rs
+++ b/src/gallium/frontends/rusticl/core/device.rs
@@ -1029,9 +1029,8 @@ impl Device {
             images_read_write: self.image_read_write_supported(),
             images_write_3d: self.image_3d_write_supported(),
             integer_dot_product: true,
-            intel_subgroups: false,
             subgroups: self.subgroups_supported(),
-            subgroups_ifp: false,
+            ..Default::default()
         }
     }
 }

Reply via email to