Skip to content

Commit 3d13482

Browse files
[SYCL] Fix post-commit issues from ballot_group (#9164)
- Remove __builtin_unreachable() - Suppress warnings about unused parameters for host device - Rename cluster_group in end-to-end tests (see #8978) --------- Signed-off-by: John Pennycook <[email protected]> Co-authored-by: Larsen, Steffen <[email protected]>
1 parent e6eb283 commit 3d13482

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

sycl/include/sycl/ext/oneapi/experimental/non_uniform_groups.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ inline uint32_t IdToMaskPosition(NonUniformGroup Group, uint32_t Id) {
5454
}
5555
}
5656
}
57-
__builtin_unreachable();
5857
return Count;
5958
}
6059

sycl/include/sycl/ext/oneapi/group_algorithm.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ detail::enable_if_t<(detail::is_generic_group<Group>::value &&
151151
#ifdef __SYCL_DEVICE_ONLY__
152152
return sycl::detail::spirv::GroupBroadcast(g, x, local_id);
153153
#else
154+
(void)g;
154155
(void)x;
155156
(void)local_id;
156157
throw runtime_error("Group algorithms are not supported on host device.",

sycl/include/sycl/group_algorithm.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ reduce_over_group(Group g, T x, BinaryOperation binary_op) {
208208
return sycl::detail::calc<__spv::GroupOperation::Reduce>(
209209
g, typename sycl::detail::GroupOpTag<T>::type(), x, binary_op);
210210
#else
211+
(void)g;
211212
throw runtime_error("Group algorithms are not supported on host.",
212213
PI_ERROR_INVALID_DEVICE);
213214
#endif
@@ -379,6 +380,7 @@ any_of_group(Group g, bool pred) {
379380
#ifdef __SYCL_DEVICE_ONLY__
380381
return sycl::detail::spirv::GroupAny(g, pred);
381382
#else
383+
(void)g;
382384
(void)pred;
383385
throw runtime_error("Group algorithms are not supported on host.",
384386
PI_ERROR_INVALID_DEVICE);
@@ -418,6 +420,7 @@ all_of_group(Group g, bool pred) {
418420
#ifdef __SYCL_DEVICE_ONLY__
419421
return sycl::detail::spirv::GroupAll(g, pred);
420422
#else
423+
(void)g;
421424
(void)pred;
422425
throw runtime_error("Group algorithms are not supported on host.",
423426
PI_ERROR_INVALID_DEVICE);
@@ -457,6 +460,7 @@ none_of_group(Group g, bool pred) {
457460
#ifdef __SYCL_DEVICE_ONLY__
458461
return sycl::detail::spirv::GroupAll(g, !pred);
459462
#else
463+
(void)g;
460464
(void)pred;
461465
throw runtime_error("Group algorithms are not supported on host.",
462466
PI_ERROR_INVALID_DEVICE);
@@ -574,6 +578,7 @@ group_broadcast(Group g, T x, typename Group::id_type local_id) {
574578
#ifdef __SYCL_DEVICE_ONLY__
575579
return sycl::detail::spirv::GroupBroadcast(g, x, local_id);
576580
#else
581+
(void)g;
577582
(void)x;
578583
(void)local_id;
579584
throw runtime_error("Group algorithms are not supported on host.",
@@ -637,6 +642,7 @@ exclusive_scan_over_group(Group g, T x, BinaryOperation binary_op) {
637642
return sycl::detail::calc<__spv::GroupOperation::ExclusiveScan>(
638643
g, typename sycl::detail::GroupOpTag<T>::type(), x, binary_op);
639644
#else
645+
(void)g;
640646
throw runtime_error("Group algorithms are not supported on host.",
641647
PI_ERROR_INVALID_DEVICE);
642648
#endif
@@ -870,6 +876,7 @@ inclusive_scan_over_group(Group g, T x, BinaryOperation binary_op) {
870876
return sycl::detail::calc<__spv::GroupOperation::InclusiveScan>(
871877
g, typename sycl::detail::GroupOpTag<T>::type(), x, binary_op);
872878
#else
879+
(void)g;
873880
throw runtime_error("Group algorithms are not supported on host.",
874881
PI_ERROR_INVALID_DEVICE);
875882
#endif

sycl/include/sycl/group_barrier.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ group_barrier(Group G, memory_scope FenceScope = Group::fence_scope) {
2929
#ifdef __SYCL_DEVICE_ONLY__
3030
detail::spirv::ControlBarrier(G, FenceScope, memory_order::seq_cst);
3131
#else
32+
(void)G;
33+
(void)FenceScope;
3234
throw sycl::runtime_error("Barriers are not supported on host device",
3335
PI_ERROR_INVALID_DEVICE);
3436
#endif

sycl/test-e2e/NonUniformGroups/cluster_group.cpp renamed to sycl/test-e2e/NonUniformGroups/fixed_size_group.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <vector>
88
namespace syclex = sycl::ext::oneapi::experimental;
99

10-
template <size_t ClusterSize> class TestKernel;
10+
template <size_t PartitionSize> class TestKernel;
1111

12-
template <size_t ClusterSize> void test() {
12+
template <size_t PartitionSize> void test() {
1313
sycl::queue Q;
1414

1515
auto SGSizes = Q.get_device().get_info<sycl::info::device::sub_group_sizes>();
@@ -30,24 +30,24 @@ template <size_t ClusterSize> void test() {
3030
auto WI = item.get_global_id();
3131
auto SG = item.get_sub_group();
3232

33-
auto ClusterGroup = syclex::get_cluster_group<ClusterSize>(SG);
33+
auto Partition = syclex::get_fixed_size_group<PartitionSize>(SG);
3434

3535
bool Match = true;
36-
Match &= (ClusterGroup.get_group_id() == (WI / ClusterSize));
37-
Match &= (ClusterGroup.get_local_id() == (WI % ClusterSize));
38-
Match &= (ClusterGroup.get_group_range() == (32 / ClusterSize));
39-
Match &= (ClusterGroup.get_local_range() == ClusterSize);
36+
Match &= (Partition.get_group_id() == (WI / PartitionSize));
37+
Match &= (Partition.get_local_id() == (WI % PartitionSize));
38+
Match &= (Partition.get_group_range() == (32 / PartitionSize));
39+
Match &= (Partition.get_local_range() == PartitionSize);
4040
MatchAcc[WI] = Match;
41-
LeaderAcc[WI] = ClusterGroup.leader();
41+
LeaderAcc[WI] = Partition.leader();
4242
};
43-
CGH.parallel_for<TestKernel<ClusterSize>>(NDR, KernelFunc);
43+
CGH.parallel_for<TestKernel<PartitionSize>>(NDR, KernelFunc);
4444
});
4545

4646
sycl::host_accessor MatchAcc{MatchBuf, sycl::read_only};
4747
sycl::host_accessor LeaderAcc{LeaderBuf, sycl::read_only};
4848
for (int WI = 0; WI < 32; ++WI) {
4949
assert(MatchAcc[WI] == true);
50-
assert(LeaderAcc[WI] == ((WI % ClusterSize) == 0));
50+
assert(LeaderAcc[WI] == ((WI % PartitionSize) == 0));
5151
}
5252
}
5353

sycl/test-e2e/NonUniformGroups/is_user_constructed.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ namespace syclex = sycl::ext::oneapi::experimental;
66
static_assert(
77
syclex::is_user_constructed_group_v<syclex::ballot_group<sycl::sub_group>>);
88
static_assert(syclex::is_user_constructed_group_v<
9-
syclex::cluster_group<1, sycl::sub_group>>);
9+
syclex::fixed_size_group<1, sycl::sub_group>>);
1010
static_assert(syclex::is_user_constructed_group_v<
11-
syclex::cluster_group<2, sycl::sub_group>>);
11+
syclex::fixed_size_group<2, sycl::sub_group>>);
1212
static_assert(
1313
syclex::is_user_constructed_group_v<syclex::tangle_group<sycl::sub_group>>);
1414
static_assert(syclex::is_user_constructed_group_v<syclex::opportunistic_group>);

0 commit comments

Comments
 (0)