Skip to content

Commit 2985395

Browse files
authored
[SYCL] Clean up sub-group class API (#12945)
This PR cleans up the API of the sub-group class by either removing functions that do not appear in the spec or marking them deprecated. The only exception is the set of load/store functions, which after some discussion with the spec team, it was suggested to leave them as is for now.
1 parent 80d23d0 commit 2985395

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

sycl/include/sycl/sub_group.hpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ struct sub_group {
219219

220220
/* --- one-input shuffles --- */
221221
/* indices in [0 , sub_group size) */
222-
223-
template <typename T> T shuffle(T x, id_type local_id) const {
222+
template <typename T>
223+
__SYCL_DEPRECATED("Shuffles in the sub-group class are deprecated.")
224+
T shuffle(T x, id_type local_id) const {
224225
#ifdef __SYCL_DEVICE_ONLY__
225226
return sycl::detail::spirv::SubgroupShuffle(x, local_id);
226227
#else
@@ -231,7 +232,9 @@ struct sub_group {
231232
#endif
232233
}
233234

234-
template <typename T> T shuffle_down(T x, uint32_t delta) const {
235+
template <typename T>
236+
__SYCL_DEPRECATED("Shuffles in the sub-group class are deprecated.")
237+
T shuffle_down(T x, uint32_t delta) const {
235238
#ifdef __SYCL_DEVICE_ONLY__
236239
return sycl::detail::spirv::SubgroupShuffleDown(x, delta);
237240
#else
@@ -242,7 +245,9 @@ struct sub_group {
242245
#endif
243246
}
244247

245-
template <typename T> T shuffle_up(T x, uint32_t delta) const {
248+
template <typename T>
249+
__SYCL_DEPRECATED("Shuffles in the sub-group class are deprecated.")
250+
T shuffle_up(T x, uint32_t delta) const {
246251
#ifdef __SYCL_DEVICE_ONLY__
247252
return sycl::detail::spirv::SubgroupShuffleUp(x, delta);
248253
#else
@@ -253,7 +258,9 @@ struct sub_group {
253258
#endif
254259
}
255260

256-
template <typename T> T shuffle_xor(T x, id_type value) const {
261+
template <typename T>
262+
__SYCL_DEPRECATED("Shuffles in the sub-group class are deprecated.")
263+
T shuffle_xor(T x, id_type value) const {
257264
#ifdef __SYCL_DEVICE_ONLY__
258265
return sycl::detail::spirv::SubgroupShuffleXor(x, value);
259266
#else
@@ -358,7 +365,7 @@ struct sub_group {
358365
}
359366
return res;
360367
}
361-
#else // __NVPTX__ || __AMDGCN__
368+
#else // __NVPTX__ || __AMDGCN__
362369
template <int N, typename CVT, access::address_space Space,
363370
access::decorated IsDecorated, typename T = std::remove_cv_t<CVT>>
364371
std::enable_if_t<
@@ -608,6 +615,7 @@ struct sub_group {
608615
}
609616

610617
/* --- synchronization functions --- */
618+
__SYCL_DEPRECATED("Sub-group barrier with no arguments is deprecated.")
611619
void barrier() const {
612620
#ifdef __SYCL_DEVICE_ONLY__
613621
__spirv_ControlBarrier(
@@ -636,6 +644,7 @@ struct sub_group {
636644
#endif
637645
}
638646

647+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES__
639648
/* --- deprecated collective functions --- */
640649
template <typename T>
641650
__SYCL_DEPRECATED("Collectives in the sub-group class are deprecated. Use "
@@ -752,6 +761,7 @@ struct sub_group {
752761
"Sub-groups are not supported on host.");
753762
#endif
754763
}
764+
#endif // __INTEL_PREVIEW_BREAKING_CHANGES__
755765

756766
linear_id_type get_group_linear_range() const {
757767
#ifdef __SYCL_DEVICE_ONLY__

0 commit comments

Comments
 (0)