Skip to content

Commit deeb664

Browse files
authored
[SYCL][E2E] Remove subgroup supported checks from e2e tests (#14313)
Subgroups are core sycl functionality which should be tested on all backends.
1 parent 7ce48cf commit deeb664

18 files changed

+55
-137
lines changed

sycl/test-e2e/Basic/linear-sub_group.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
#include "../SubGroup/helper.hpp"
1312
#include <algorithm>
1413
#include <cstdio>
1514
#include <cstdlib>
@@ -20,10 +19,6 @@ using namespace sycl;
2019

2120
int main(int argc, char *argv[]) {
2221
queue q;
23-
if (!core_sg_supported(q.get_device())) {
24-
std::cout << "Skipping test\n";
25-
return 0;
26-
}
2722

2823
// Fill output array with sub-group IDs
2924
const uint32_t outer = 2;

sycl/test-e2e/Regression/get_subgroup_sizes.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// UNSUPPORTED: accelerator
2+
// TODO: FPGAs currently report `sub_group_sizes` as non-empty list,
3+
// despite not having extension `cl_intel_required_subgroup_size`
4+
// UNSUPPORTED: cuda || hip
5+
// TODO: Similar issue to FPGAs
6+
17
// RUN: %{build} -o %t.out
28
// RUN: %{run} %t.out
39

@@ -18,13 +24,15 @@ int main() {
1824
queue Q;
1925
auto Dev = Q.get_device();
2026
auto Vec = Dev.get_info<info::device::extensions>();
27+
std::vector<size_t> SubGroupSizes =
28+
Dev.get_info<sycl::info::device::sub_group_sizes>();
2129
if (std::find(Vec.begin(), Vec.end(), "cl_intel_required_subgroup_size") !=
2230
std::end(Vec)) {
23-
std::vector<size_t> SubGroupSizes =
24-
Dev.get_info<sycl::info::device::sub_group_sizes>();
25-
std::vector<size_t>::const_iterator MaxIter =
26-
std::max_element(SubGroupSizes.begin(), SubGroupSizes.end());
27-
int MaxSubGroup_size = *MaxIter;
31+
assert(!SubGroupSizes.empty() &&
32+
"Required sub-group size list should not be empty");
33+
} else {
34+
assert(SubGroupSizes.empty() &&
35+
"Required sub-group size list should be empty");
2836
}
2937
return 0;
3038
}

sycl/test-e2e/SubGroup/attributes.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
// UNSUPPORTED: accelerator
2+
// TODO: FPGAs currently report supported subgroups as {4,8,16,32,64}, causing
3+
// this test to fail
4+
// UNSUPPORTED: cuda || hip
5+
// TODO: Device subgroup sizes reports {32}, but when we try to use it with a
6+
// kernel attribute and check it, we get a subgroup size of 0.
7+
18
// RUN: %{build} -fsycl-device-code-split=per_kernel -o %t.out
29
// RUN: %{run} %t.out
310
//==------- attributes.cpp - SYCL sub_group attributes test ----*- C++ -*---==//
@@ -13,7 +20,7 @@
1320
#define KERNEL_FUNCTOR_WITH_SIZE(SIZE) \
1421
class KernelFunctor##SIZE { \
1522
public: \
16-
[[intel::reqd_sub_group_size(SIZE)]] void \
23+
[[sycl::reqd_sub_group_size(SIZE)]] void \
1724
operator()(sycl::nd_item<1> Item) const { \
1825
const auto GID = Item.get_global_id(); \
1926
} \
@@ -49,19 +56,6 @@ int main() {
4956
queue Queue;
5057
device Device = Queue.get_device();
5158

52-
// According to specification, this kernel query requires `cl_khr_subgroups`
53-
// or `cl_intel_subgroups`, and also `cl_intel_required_subgroup_size`
54-
auto Vec = Device.get_info<info::device::extensions>();
55-
if (std::find(Vec.begin(), Vec.end(), "cl_intel_subgroups") ==
56-
std::end(Vec) &&
57-
std::find(Vec.begin(), Vec.end(), "cl_khr_subgroups") ==
58-
std::end(Vec) ||
59-
std::find(Vec.begin(), Vec.end(), "cl_intel_required_subgroup_size") ==
60-
std::end(Vec)) {
61-
std::cout << "Skipping test\n";
62-
return 0;
63-
}
64-
6559
try {
6660
const auto SGSizes = Device.get_info<info::device::sub_group_sizes>();
6761

sycl/test-e2e/SubGroup/helper.hpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,3 @@ void exit_if_not_equal_vec(vec<T, N> val, vec<T, N> ref, const char *name) {
164164
exit(1);
165165
}
166166
}
167-
168-
bool core_sg_supported(const device &Device) {
169-
auto Vec = Device.get_info<info::device::extensions>();
170-
if (std::find(Vec.begin(), Vec.end(), "cl_khr_subgroups") != std::end(Vec))
171-
return true;
172-
173-
if (std::find(Vec.begin(), Vec.end(), "cl_intel_subgroups") != std::end(Vec))
174-
return true;
175-
176-
if (Device.get_backend() == sycl::backend::opencl) {
177-
// Extract the numerical version from the version string, OpenCL version
178-
// string have the format "OpenCL <major>.<minor> <vendor specific data>".
179-
std::string ver = Device.get_info<info::device::version>().substr(7, 3);
180-
181-
// cl_khr_subgroups was core in OpenCL 2.1 and 2.2, but went back to
182-
// optional in 3.0
183-
return ver >= "2.1" && ver < "3.0";
184-
}
185-
186-
return false;
187-
}

sycl/test-e2e/SubGroup/info.cpp

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// UNSUPPORTED: accelerator
2+
// TODO: FPGAs currently report supported subgroups as {4,8,16,32,64}, causing
3+
// this test to fail. Additionally, the kernel max_sub_group_size checks
4+
// crash on FPGAs
15
// RUN: %{build} -o %t.out
26
// RUN: %{run} %t.out
37

@@ -17,14 +21,20 @@ int main() {
1721
queue Queue;
1822
device Device = Queue.get_device();
1923

20-
/* Basic sub-group functionality is supported as part of cl_khr_subgroups
21-
* extension or as core OpenCL 2.1 feature. */
22-
if (!core_sg_supported(Device)) {
23-
std::cout << "Skipping test\n";
24-
return 0;
24+
bool old_opencl = false;
25+
if (Device.get_backend() == sycl::backend::opencl) {
26+
// Extract the numerical version from the version string, OpenCL version
27+
// string have the format "OpenCL <major>.<minor> <vendor specific data>".
28+
std::string ver = Device.get_info<info::device::version>().substr(7, 3);
29+
old_opencl = (ver < "2.1");
2530
}
31+
2632
/* Check info::device parameters. */
27-
Device.get_info<info::device::sub_group_independent_forward_progress>();
33+
if (!old_opencl) {
34+
// Independent forward progress is missing on OpenCL backend prior to
35+
// version 2.1
36+
Device.get_info<info::device::sub_group_independent_forward_progress>();
37+
}
2838
Device.get_info<info::device::max_num_sub_groups>();
2939

3040
try {
@@ -49,30 +59,24 @@ int main() {
4959
});
5060
uint32_t Res = 0;
5161

52-
/* sub_group_sizes can be queried only if cl_intel_required_subgroup_size
53-
* extension is supported by device*/
54-
auto Vec = Device.get_info<info::device::extensions>();
55-
if (std::find(Vec.begin(), Vec.end(), "cl_intel_required_subgroup_size") !=
56-
std::end(Vec)) {
57-
auto sg_sizes = Device.get_info<info::device::sub_group_sizes>();
62+
auto sg_sizes = Device.get_info<info::device::sub_group_sizes>();
63+
64+
// Max sub-group size for a particular kernel might not be the max
65+
// supported size on the device in general. Can only check that it is
66+
// contained in list of valid sizes.
67+
Res = Kernel.get_info<info::kernel_device_specific::max_sub_group_size>(
68+
Device);
69+
bool Expected =
70+
std::find(sg_sizes.begin(), sg_sizes.end(), Res) != sg_sizes.end();
71+
exit_if_not_equal<bool>(Expected, true, "max_sub_group_size");
5872

59-
// Max sub-group size for a particular kernel might not be the max
60-
// supported size on the device in general. Can only check that it is
61-
// contained in list of valid sizes.
73+
for (auto r : {range<3>(3, 4, 5), range<3>(1, 1, 1), range<3>(4, 2, 1),
74+
range<3>(32, 3, 4), range<3>(7, 9, 11)}) {
6275
Res = Kernel.get_info<info::kernel_device_specific::max_sub_group_size>(
6376
Device);
64-
bool Expected =
77+
Expected =
6578
std::find(sg_sizes.begin(), sg_sizes.end(), Res) != sg_sizes.end();
6679
exit_if_not_equal<bool>(Expected, true, "max_sub_group_size");
67-
68-
for (auto r : {range<3>(3, 4, 5), range<3>(1, 1, 1), range<3>(4, 2, 1),
69-
range<3>(32, 3, 4), range<3>(7, 9, 11)}) {
70-
Res = Kernel.get_info<info::kernel_device_specific::max_sub_group_size>(
71-
Device);
72-
Expected =
73-
std::find(sg_sizes.begin(), sg_sizes.end(), Res) != sg_sizes.end();
74-
exit_if_not_equal<bool>(Expected, true, "max_sub_group_size");
75-
}
7680
}
7781

7882
Res = Kernel.get_info<info::kernel_device_specific::compile_num_sub_groups>(
@@ -81,21 +85,11 @@ int main() {
8185
/* Sub-group size is not specified in kernel or IL*/
8286
exit_if_not_equal<uint32_t>(Res, 0, "compile_num_sub_groups");
8387

84-
// According to specification, this kernel query requires `cl_khr_subgroups`
85-
// or `cl_intel_subgroups`
86-
if ((std::find(Vec.begin(), Vec.end(), "cl_khr_subgroups") !=
87-
std::end(Vec)) ||
88-
std::find(Vec.begin(), Vec.end(), "cl_intel_subgroups") !=
89-
std::end(Vec) &&
90-
std::find(Vec.begin(), Vec.end(),
91-
"cl_intel_required_subgroup_size") != std::end(Vec)) {
92-
Res =
93-
Kernel.get_info<info::kernel_device_specific::compile_sub_group_size>(
94-
Device);
95-
96-
/* Required sub-group size is not specified in kernel or IL*/
97-
exit_if_not_equal<uint32_t>(Res, 0, "compile_sub_group_size");
98-
}
88+
Res = Kernel.get_info<info::kernel_device_specific::compile_sub_group_size>(
89+
Device);
90+
91+
/* Required sub-group size is not specified in kernel or IL*/
92+
exit_if_not_equal<uint32_t>(Res, 0, "compile_sub_group_size");
9993

10094
} catch (exception e) {
10195
std::cout << "SYCL exception caught: " << e.what();

sycl/test-e2e/SubGroup/reduce.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
#include <iostream>
1414
int main() {
1515
queue Queue;
16-
if (!core_sg_supported(Queue.get_device())) {
17-
std::cout << "Skipping test\n";
18-
return 0;
19-
}
2016
check<class KernelName_AJprOaCZgUmsYFRTTGNw, int>(Queue);
2117
check<class KernelName_ShKFIYTqaI, unsigned int>(Queue);
2218
check<class KernelName_TovsKTk, long>(Queue);

sycl/test-e2e/SubGroup/reduce_fp16.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010

1111
int main() {
1212
queue Queue;
13-
if (!core_sg_supported(Queue.get_device())) {
14-
std::cout << "Skipping test\n";
15-
return 0;
16-
}
1713
check<class KernelName_oMg, sycl::half>(Queue);
1814
std::cout << "Test passed." << std::endl;
1915
return 0;

sycl/test-e2e/SubGroup/reduce_fp64.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
int main() {
1010
queue Queue;
11-
if (!core_sg_supported(Queue.get_device())) {
12-
std::cout << "Skipping test\n";
13-
return 0;
14-
}
1511
check<class KernelName_alTnImqzYasRyHjYg, double>(Queue);
1612
std::cout << "Test passed." << std::endl;
1713
return 0;

sycl/test-e2e/SubGroup/reduce_spirv13.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include <iostream>
99
int main() {
1010
queue Queue;
11-
if (!core_sg_supported(Queue.get_device())) {
12-
std::cout << "Skipping test\n";
13-
return 0;
14-
}
1511

1612
check_mul<class MulA, int>(Queue);
1713
check_mul<class MulB, unsigned int>(Queue);

sycl/test-e2e/SubGroup/reduce_spirv13_fp16.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
int main() {
1313
queue Queue;
14-
if (!core_sg_supported(Queue.get_device())) {
15-
std::cout << "Skipping test\n";
16-
return 0;
17-
}
1814
check_mul<class MulHalf, sycl::half>(Queue);
1915
std::cout << "Test passed." << std::endl;
2016
return 0;

sycl/test-e2e/SubGroup/reduce_spirv13_fp64.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#include <iostream>
1111
int main() {
1212
queue Queue;
13-
if (!core_sg_supported(Queue.get_device())) {
14-
std::cout << "Skipping test\n";
15-
return 0;
16-
}
1713
check_mul<class MulDouble, double>(Queue);
1814
std::cout << "Test passed." << std::endl;
1915
return 0;

sycl/test-e2e/SubGroup/scan.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
int main() {
1616
queue Queue;
17-
if (!core_sg_supported(Queue.get_device())) {
18-
std::cout << "Skipping test\n";
19-
return 0;
20-
}
2117
check<class KernelName_QTbNYAsEmawQ, int>(Queue);
2218
check<class KernelName_FQFNSdcVGrCLUbn, unsigned int>(Queue);
2319
check<class KernelName_kWYnyHJx, long>(Queue);

sycl/test-e2e/SubGroup/scan_fp16.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
#include <iostream>
1212
int main() {
1313
queue Queue;
14-
if (!core_sg_supported(Queue.get_device())) {
15-
std::cout << "Skipping test\n";
16-
return 0;
17-
}
1814
check<class KernelName_dlpo, sycl::half>(Queue);
1915
std::cout << "Test passed." << std::endl;
2016
return 0;

sycl/test-e2e/SubGroup/scan_fp64.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
#include <iostream>
1010
int main() {
1111
queue Queue;
12-
if (!core_sg_supported(Queue.get_device())) {
13-
std::cout << "Skipping test\n";
14-
return 0;
15-
}
1612
check<class KernelName_cYZflKkIXS, double>(Queue);
1713
std::cout << "Test passed." << std::endl;
1814
return 0;

sycl/test-e2e/SubGroup/scan_spirv13.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99

1010
int main() {
1111
queue Queue;
12-
if (!core_sg_supported(Queue.get_device())) {
13-
std::cout << "Skipping test\n";
14-
return 0;
15-
}
1612
check_mul<class MulA, int>(Queue);
1713
check_mul<class MulB, unsigned int>(Queue);
1814
check_mul<class MulC, long>(Queue);

sycl/test-e2e/SubGroup/scan_spirv13_fp16.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
int main() {
1414
queue Queue;
15-
if (!core_sg_supported(Queue.get_device())) {
16-
std::cout << "Skipping test\n";
17-
return 0;
18-
}
1915
check_mul<class MulHalf, sycl::half>(Queue);
2016
std::cout << "Test passed." << std::endl;
2117
return 0;

sycl/test-e2e/SubGroup/scan_spirv13_fp64.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
int main() {
1313
queue Queue;
14-
if (!core_sg_supported(Queue.get_device())) {
15-
std::cout << "Skipping test\n";
16-
return 0;
17-
}
1814
check<class MulDouble, double>(Queue);
1915
std::cout << "Test passed." << std::endl;
2016
return 0;

sycl/test-e2e/SubGroup/vote.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ void check(queue Queue, const int G, const int L, const int D, const int R) {
6969
}
7070
int main() {
7171
queue Queue;
72-
if (!core_sg_supported(Queue.get_device())) {
73-
std::cout << "Skipping test\n";
74-
return 0;
75-
}
7672
check(Queue, 240, 80, 3, 1);
7773
check(Queue, 24, 12, 3, 4);
7874
check(Queue, 1024, 256, 3, 1);

0 commit comments

Comments
 (0)