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

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

rusticl: implement cl_khr_subgroup_shuffle and shuffle_relative

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

---

 docs/features.txt                                        | 4 ++--
 src/gallium/frontends/rusticl/core/device.rs             | 9 ++++++++-
 src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs | 1 +
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 8ce06da69c5..398f50a3282 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -944,8 +944,8 @@ Rusticl extensions that are not part of any OpenCL version:
   cl_khr_subgroup_non_uniform_arithmetic                not started
   cl_khr_subgroup_non_uniform_vote                      not started
   cl_khr_subgroup_rotate                                not started
-  cl_khr_subgroup_shuffle                               not started
-  cl_khr_subgroup_shuffle_relative                      not started
+  cl_khr_subgroup_shuffle                               DONE (iris, llvmpipe, 
radeonsi)
+  cl_khr_subgroup_shuffle_relative                      DONE (iris, llvmpipe, 
radeonsi)
   cl_khr_suggested_local_work_size                      not started
   cl_khr_terminate_context                              not started
   cl_khr_throttle_hints                                 not started
diff --git a/src/gallium/frontends/rusticl/core/device.rs 
b/src/gallium/frontends/rusticl/core/device.rs
index af524fce83f..5a0e7bdc915 100644
--- a/src/gallium/frontends/rusticl/core/device.rs
+++ b/src/gallium/frontends/rusticl/core/device.rs
@@ -643,6 +643,10 @@ impl Device {
             // requires CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
             //add_ext(1, 0, 0, "cl_khr_subgroups");
             add_feat(1, 0, 0, "__opencl_c_subgroups");
+
+            // we have lowering in `nir_lower_subgroups`, drivers can just use 
that
+            add_ext(1, 0, 0, "cl_khr_subgroup_shuffle");
+            add_ext(1, 0, 0, "cl_khr_subgroup_shuffle_relative");
         }
 
         if self.svm_supported() {
@@ -1021,6 +1025,7 @@ impl Device {
     }
 
     pub fn cl_features(&self) -> clc_optional_features {
+        let subgroups_supported = self.subgroups_supported();
         clc_optional_features {
             fp16: self.fp16_supported(),
             fp64: self.fp64_supported(),
@@ -1029,7 +1034,9 @@ impl Device {
             images_read_write: self.image_read_write_supported(),
             images_write_3d: self.image_3d_write_supported(),
             integer_dot_product: true,
-            subgroups: self.subgroups_supported(),
+            subgroups: subgroups_supported,
+            subgroups_shuffle: subgroups_supported,
+            subgroups_shuffle_relative: subgroups_supported,
             ..Default::default()
         }
     }
diff --git a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs 
b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs
index 813fff1e014..e6d8214eaa1 100644
--- a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs
+++ b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs
@@ -334,6 +334,7 @@ impl SPIRVBin {
                 float64: true,
                 generic_pointers: true,
                 groups: true,
+                subgroup_shuffle: true,
                 int8: true,
                 int16: true,
                 int64: true,

Reply via email to