Skip to content

Commit e6afe60

Browse files
committed
Fixing tests, specifically tests with std kernels
1 parent e678857 commit e6afe60

17 files changed

+192
-224
lines changed

clang/test/CodeGenSYCL/stdtypes_kernel_type.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@
77
//
88
// CHECK: static constexpr
99
// CHECK-NEXT: const char* const kernel_names[] = {
10-
// CHECK-NEXT: "_ZTSSt4byte"
1110
// CHECK-NEXT: "_ZTSm",
1211
// CHECK-NEXT: "_ZTSl"
1312
// CHECK-NEXT: };
1413
//
1514
// CHECK: static constexpr
1615
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {
17-
// CHECK-NEXT: //--- _ZTSSt4byte
18-
// CHECK-EMPTY:
1916
// CHECK-NEXT: //--- _ZTSm
2017
// CHECK-EMPTY:
2118
// CHECK-NEXT: //--- _ZTSl
@@ -24,12 +21,10 @@
2421
//
2522
// CHECK: static constexpr
2623
// CHECK-NEXT: const unsigned kernel_signature_start[] = {
27-
// CHECK-NEXT: 0, // _ZTSSt4byte
28-
// CHECK-NEXT: 1, // _ZTSm
29-
// CHECK-NEXT: 2 // _ZTSl
24+
// CHECK-NEXT: 0, // _ZTSm
25+
// CHECK-NEXT: 1 // _ZTSl
3026
// CHECK-NEXT: };
3127

32-
// CHECK: template <> struct KernelInfo<::std::byte> {
3328
// CHECK: template <> struct KernelInfo<unsigned long> {
3429
// CHECK: template <> struct KernelInfo<long> {
3530

@@ -40,7 +35,6 @@ namespace std {
4035
typedef long unsigned int size_t;
4136
typedef long int ptrdiff_t;
4237
typedef decltype(nullptr) nullptr_t;
43-
enum class byte : unsigned char {};
4438
class T;
4539
class U;
4640
} // namespace std
@@ -62,7 +56,6 @@ int main() {
6256
#endif
6357

6458
// Although in the std namespace, these resolve to builtins such as `int` that are allowed in kernel names
65-
kernel_single_task<std::byte>([=]() {});
6659
kernel_single_task<std::size_t>([=]() {});
6760
kernel_single_task<std::ptrdiff_t>([=]() {});
6861

sycl/test/reduction/reduction_ctor.cpp

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
using namespace cl::sycl;
1212

13-
1413
template <typename T, typename Reduction>
1514
void test_reducer(Reduction &Redu, T A, T B) {
1615
typename Reduction::reducer_type Reducer;
@@ -35,10 +34,8 @@ void test_reducer(Reduction &Redu, T Identity, T A, T B) {
3534
"Wrong result of binary operation.");
3635
}
3736

38-
template <typename T, int Dim, class BinaryOperation>
39-
class Known;
40-
template <typename T, int Dim, class BinaryOperation>
41-
class Unknown;
37+
template <typename... Ts>
38+
class KernelNameGroup;
4239

4340
template <typename T>
4441
struct Point {
@@ -65,7 +62,7 @@ struct PointPlus {
6562
}
6663
};
6764

68-
template <typename T, int Dim, class BinaryOperation>
65+
template <typename SpecializationKernelName, typename T, int Dim, class BinaryOperation>
6966
void testKnown(T Identity, T A, T B) {
7067

7168
BinaryOperation BOp;
@@ -84,11 +81,11 @@ void testKnown(T Identity, T A, T B) {
8481
test_reducer(Redu, Identity, A, B);
8582

8683
// Command group must have at least one task in it. Use an empty one.
87-
CGH.single_task<Known<T, Dim, BinaryOperation>>([=]() {});
84+
CGH.single_task<SpecializationKernelName>([=]() {});
8885
});
8986
}
9087

91-
template <typename T, int Dim, class BinaryOperation>
88+
template <typename SpecializationKernelName, typename T, int Dim, class BinaryOperation>
9289
void testUnknown(T Identity, T A, T B) {
9390

9491
BinaryOperation BOp;
@@ -105,35 +102,35 @@ void testUnknown(T Identity, T A, T B) {
105102
test_reducer(Redu, Identity, A, B);
106103

107104
// Command group must have at least one task in it. Use an empty one.
108-
CGH.single_task<Unknown<T, Dim, BinaryOperation>>([=]() {});
105+
CGH.single_task<SpecializationKernelName>([=]() {});
109106
});
110107
}
111108

112-
template <typename T, class BinaryOperation>
109+
template <typename SpecializationKernelName, typename T, class BinaryOperation>
113110
void testBoth(T Identity, T A, T B) {
114-
testKnown<T, 0, BinaryOperation>(Identity, A, B);
115-
testKnown<T, 1, BinaryOperation>(Identity, A, B);
116-
testUnknown<T, 0, BinaryOperation>(Identity, A, B);
117-
testUnknown<T, 1, BinaryOperation>(Identity, A, B);
111+
testKnown<KernelNameGroup<SpecializationKernelName, class KernelName_SpronAvHpacKFL>, T, 0, BinaryOperation>(Identity, A, B);
112+
testKnown<KernelNameGroup<SpecializationKernelName, class KernelName_XFxrYatPJlU>, T, 1, BinaryOperation>(Identity, A, B);
113+
testUnknown<KernelNameGroup<SpecializationKernelName, class KernelName_oUFYMyQSlL>, T, 0, BinaryOperation>(Identity, A, B);
114+
testUnknown<KernelNameGroup<SpecializationKernelName, class KernelName_Ndbp>, T, 1, BinaryOperation>(Identity, A, B);
118115
}
119116

120117
int main() {
121118
// testKnown does not pass identity to reduction ctor.
122-
testBoth<int, intel::plus<int>>(0, 1, 7);
123-
testBoth<int, std::multiplies<int>>(1, 1, 7);
124-
testBoth<int, intel::bit_or<int>>(0, 1, 8);
125-
testBoth<int, intel::bit_xor<int>>(0, 7, 3);
126-
testBoth<int, intel::bit_and<int>>(~0, 7, 3);
127-
testBoth<int, intel::minimum<int>>((std::numeric_limits<int>::max)(), 7, 3);
128-
testBoth<int, intel::maximum<int>>((std::numeric_limits<int>::min)(), 7, 3);
129-
130-
testBoth<float, intel::plus<float>>(0, 1, 7);
131-
testBoth<float, std::multiplies<float>>(1, 1, 7);
132-
testBoth<float, intel::minimum<float>>(getMaximumFPValue<float>(), 7, 3);
133-
testBoth<float, intel::maximum<float>>(getMinimumFPValue<float>(), 7, 3);
134-
135-
testUnknown<Point<float>, 0, PointPlus<float>>(Point<float>(0), Point<float>(1), Point<float>(7));
136-
testUnknown<Point<float>, 1, PointPlus<float>>(Point<float>(0), Point<float>(1), Point<float>(7));
119+
testBoth<class KernelName_DpWavJTNjhJtrHmLWt, int, intel::plus<int>>(0, 1, 7);
120+
testBoth<class KernelName_MHRtc, int, std::multiplies<int>>(1, 1, 7);
121+
testBoth<class KernelName_eYhurMyKBZvzctmqwUZ, int, intel::bit_or<int>>(0, 1, 8);
122+
testBoth<class KernelName_DpVPIUBjUMGZEwBFHH, int, intel::bit_xor<int>>(0, 7, 3);
123+
testBoth<class KernelName_vGKFactgrkngMXd, int, intel::bit_and<int>>(~0, 7, 3);
124+
testBoth<class KernelName_GLpknSBxclKWjm, int, intel::minimum<int>>((std::numeric_limits<int>::max)(), 7, 3);
125+
testBoth<class KernelName_EvOaOYQ, int, intel::maximum<int>>((std::numeric_limits<int>::min)(), 7, 3);
126+
127+
testBoth<class KernelName_iFbcoTtPeDtUEK, float, intel::plus<float>>(0, 1, 7);
128+
testBoth<class KernelName_PEMJanstdNezDSXnP, float, std::multiplies<float>>(1, 1, 7);
129+
testBoth<class KernelName_wOEuftXSjCLpoTOMrYHR, float, intel::minimum<float>>(getMaximumFPValue<float>(), 7, 3);
130+
testBoth<class KernelName_HzFCIZQKeV, float, intel::maximum<float>>(getMinimumFPValue<float>(), 7, 3);
131+
132+
testUnknown<class KernelName_sJOZPgFeiALyqwIWnFP, Point<float>, 0, PointPlus<float>>(Point<float>(0), Point<float>(1), Point<float>(7));
133+
testUnknown<class KernelName_jMA, Point<float>, 1, PointPlus<float>>(Point<float>(0), Point<float>(1), Point<float>(7));
137134

138135
std::cout << "Test passed\n";
139136
return 0;

sycl/test/reduction/reduction_nd_conditional.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ void initInputData(buffer<T, 1> &InBuf, T &ExpectedOut, T Identity,
3535
}
3636
};
3737

38-
template <typename T, int Dim, class BinaryOperation>
39-
class SomeClass;
40-
4138
template <typename T>
4239
struct Vec {
4340
Vec() : X(0), Y(0) {}
@@ -69,7 +66,7 @@ struct VecPlus {
6966
}
7067
};
7168

72-
template <typename T, int Dim, class BinaryOperation>
69+
template <typename SpecializationKernelName, typename T, int Dim, class BinaryOperation>
7370
void test(T Identity, size_t WGSize, size_t NWItems) {
7471
buffer<T, 1> InBuf(NWItems);
7572
buffer<T, 1> OutBuf(1);
@@ -90,7 +87,7 @@ void test(T Identity, size_t WGSize, size_t NWItems) {
9087
range<1> GlobalRange(NWItems);
9188
range<1> LocalRange(WGSize);
9289
nd_range<1> NDRange(GlobalRange, LocalRange);
93-
CGH.parallel_for<SomeClass<T, Dim, BinaryOperation>>(
90+
CGH.parallel_for<SpecializationKernelName>(
9491
NDRange, Redu, [=](nd_item<1> NDIt, auto &Sum) {
9592
size_t I = NDIt.get_global_linear_id();
9693
if (I < 2)
@@ -114,10 +111,10 @@ void test(T Identity, size_t WGSize, size_t NWItems) {
114111
}
115112

116113
int main() {
117-
test<int, 0, intel::plus<int>>(0, 2, 2);
118-
test<int, 1, intel::plus<int>>(0, 7, 7);
119-
test<int, 0, intel::plus<int>>(0, 2, 64);
120-
test<short, 1, intel::plus<short>>(0, 16, 256);
114+
test<class KernelName_lAx, int, 0, intel::plus<int>>(0, 2, 2);
115+
test<class KernelName_eVBkBK, int, 1, intel::plus<int>>(0, 7, 7);
116+
test<class KernelName_vMSyszeYKJbaXATnPL, int, 0, intel::plus<int>>(0, 2, 64);
117+
test<class KernelName_UPKnfG, short, 1, intel::plus<short>>(0, 16, 256);
121118

122119
std::cout << "Test passed\n";
123120
return 0;

sycl/test/reduction/reduction_nd_s0_dw.cpp

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
using namespace cl::sycl;
1818

19-
template <typename T, int Dim, class BinaryOperation>
20-
class SomeClass;
21-
22-
template <typename T, int Dim, class BinaryOperation>
19+
template <typename SpecializationKernelName, typename T, int Dim, class BinaryOperation>
2320
void test(T Identity, size_t WGSize, size_t NWItems) {
2421
buffer<T, 1> InBuf(NWItems);
2522
buffer<T, 1> OutBuf(1);
@@ -40,7 +37,7 @@ void test(T Identity, size_t WGSize, size_t NWItems) {
4037
range<1> GlobalRange(NWItems);
4138
range<1> LocalRange(WGSize);
4239
nd_range<1> NDRange(GlobalRange, LocalRange);
43-
CGH.parallel_for<SomeClass<T, Dim, BinaryOperation>>(
40+
CGH.parallel_for<SpecializationKernelName>(
4441
NDRange, Redu, [=](nd_item<1> NDIt, auto &Sum) {
4542
Sum.combine(In[NDIt.get_global_linear_id()]);
4643
});
@@ -59,36 +56,36 @@ void test(T Identity, size_t WGSize, size_t NWItems) {
5956

6057
int main() {
6158
// Check some less standards WG sizes and corner cases first.
62-
test<int, 0, intel::plus<int>>(0, 2, 2);
63-
test<int, 0, intel::plus<int>>(0, 7, 7);
64-
test<int, 0, intel::plus<int>>(0, 9, 18);
65-
test<int, 0, intel::plus<int>>(0, 49, 49 * 5);
59+
test<class KernelName_TeSOazfnXqV, int, 0, intel::plus<int>>(0, 2, 2);
60+
test<class KernelName_sDrWF, int, 0, intel::plus<int>>(0, 7, 7);
61+
test<class KernelName_WClNhs, int, 0, intel::plus<int>>(0, 9, 18);
62+
test<class KernelName_dGBzKHqZ, int, 0, intel::plus<int>>(0, 49, 49 * 5);
6663

6764
// Try some power-of-two work-group sizes.
68-
test<int, 0, intel::plus<int>>(0, 2, 64);
69-
test<int, 0, intel::plus<int>>(0, 4, 64);
70-
test<int, 0, intel::plus<int>>(0, 8, 128);
71-
test<int, 0, intel::plus<int>>(0, 16, 256);
72-
test<int, 0, intel::plus<int>>(0, 32, 256);
73-
test<int, 0, intel::plus<int>>(0, 64, 256);
74-
test<int, 0, intel::plus<int>>(0, 128, 256);
75-
test<int, 0, intel::plus<int>>(0, 256, 256);
65+
test<class KernelName_BBFqAKecrI, int, 0, intel::plus<int>>(0, 2, 64);
66+
test<class KernelName_HMUbvvJOFTCETQHk, int, 0, intel::plus<int>>(0, 4, 64);
67+
test<class KernelName_JocyLVjSXVPjdkezas, int, 0, intel::plus<int>>(0, 8, 128);
68+
test<class KernelName_vXMabsyZtboaYDgkmuW, int, 0, intel::plus<int>>(0, 16, 256);
69+
test<class KernelName_jmOMSDBPkCezwz, int, 0, intel::plus<int>>(0, 32, 256);
70+
test<class KernelName_BZD, int, 0, intel::plus<int>>(0, 64, 256);
71+
test<class KernelName_xAMTrtueBCmu, int, 0, intel::plus<int>>(0, 128, 256);
72+
test<class KernelName_iIqMmgijPHeP, int, 0, intel::plus<int>>(0, 256, 256);
7673

7774
// Check with various operations.
78-
test<int, 0, std::multiplies<int>>(1, 8, 256);
79-
test<int, 0, intel::bit_or<int>>(0, 8, 256);
80-
test<int, 0, intel::bit_xor<int>>(0, 8, 256);
81-
test<int, 0, intel::bit_and<int>>(~0, 8, 256);
82-
test<int, 0, intel::minimum<int>>((std::numeric_limits<int>::max)(), 8, 256);
83-
test<int, 0, intel::maximum<int>>((std::numeric_limits<int>::min)(), 8, 256);
75+
test<class KernelName_JbXMe, int, 0, std::multiplies<int>>(1, 8, 256);
76+
test<class KernelName_yxrYAlH, int, 0, intel::bit_or<int>>(0, 8, 256);
77+
test<class KernelName_bclQP, int, 0, intel::bit_xor<int>>(0, 8, 256);
78+
test<class KernelName_SEfBIfWrrGb, int, 0, intel::bit_and<int>>(~0, 8, 256);
79+
test<class KernelName_dVCBKeW, int, 0, intel::minimum<int>>((std::numeric_limits<int>::max)(), 8, 256);
80+
test<class KernelName_kFuGbwFvu, int, 0, intel::maximum<int>>((std::numeric_limits<int>::min)(), 8, 256);
8481

8582
// Check with various types.
86-
test<float, 0, std::multiplies<float>>(1, 8, 256);
87-
test<float, 0, intel::minimum<float>>(getMaximumFPValue<float>(), 8, 256);
88-
test<float, 0, intel::maximum<float>>(getMinimumFPValue<float>(), 8, 256);
83+
test<class KernelName_UjmZVKjKReluws, float, 0, std::multiplies<float>>(1, 8, 256);
84+
test<class KernelName_OszhECIDUagcinKGeWO, float, 0, intel::minimum<float>>(getMaximumFPValue<float>(), 8, 256);
85+
test<class KernelName_LpCicWZckILZRxZP, float, 0, intel::maximum<float>>(getMinimumFPValue<float>(), 8, 256);
8986

9087
// Check with CUSTOM type.
91-
test<CustomVec<long long>, 0, CustomVecPlus<long long>>(CustomVec<long long>(0), 8, 256);
88+
test<class KernelName_puwIibWWpn, CustomVec<long long>, 0, CustomVecPlus<long long>>(CustomVec<long long>(0), 8, 256);
9289

9390
std::cout << "Test passed\n";
9491
return 0;

sycl/test/reduction/reduction_nd_s0_rw.cpp

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
using namespace cl::sycl;
1818

19-
template <typename T, int Dim, class BinaryOperation>
20-
class SomeClass;
21-
22-
template <typename T, int Dim, class BinaryOperation>
19+
template <typename SpecializationKernelName, typename T, int Dim, class BinaryOperation>
2320
void test(T Identity, size_t WGSize, size_t NWItems) {
2421
buffer<T, 1> InBuf(NWItems);
2522
buffer<T, 1> OutBuf(1);
@@ -42,7 +39,7 @@ void test(T Identity, size_t WGSize, size_t NWItems) {
4239
range<1> GlobalRange(NWItems);
4340
range<1> LocalRange(WGSize);
4441
nd_range<1> NDRange(GlobalRange, LocalRange);
45-
CGH.parallel_for<SomeClass<T, Dim, BinaryOperation>>(
42+
CGH.parallel_for<SpecializationKernelName>(
4643
NDRange, Redu, [=](nd_item<1> NDIt, auto &Sum) {
4744
Sum.combine(In[NDIt.get_global_linear_id()]);
4845
});
@@ -61,36 +58,36 @@ void test(T Identity, size_t WGSize, size_t NWItems) {
6158

6259
int main() {
6360
// Check some less standards WG sizes and corner cases first.
64-
test<int, 0, intel::plus<int>>(0, 2, 2);
65-
test<int, 0, intel::plus<int>>(0, 7, 7);
66-
test<int, 0, intel::plus<int>>(0, 9, 18);
67-
test<int, 0, intel::plus<int>>(0, 49, 49 * 5);
61+
test<class KernelName_oXfFQUctpKif, int, 0, intel::plus<int>>(0, 2, 2);
62+
test<class KernelName_YnoUqtntrJ, int, 0, intel::plus<int>>(0, 7, 7);
63+
test<class KernelName_hfCsGycSpg, int, 0, intel::plus<int>>(0, 9, 18);
64+
test<class KernelName_OtxLfwQuVfGAUEXMIs, int, 0, intel::plus<int>>(0, 49, 49 * 5);
6865

6966
// Try some power-of-two work-group sizes.
70-
test<int, 0, intel::plus<int>>(0, 2, 64);
71-
test<int, 0, intel::plus<int>>(0, 4, 64);
72-
test<int, 0, intel::plus<int>>(0, 8, 128);
73-
test<int, 0, intel::plus<int>>(0, 16, 256);
74-
test<int, 0, intel::plus<int>>(0, 32, 256);
75-
test<int, 0, intel::plus<int>>(0, 64, 256);
76-
test<int, 0, intel::plus<int>>(0, 128, 256);
77-
test<int, 0, intel::plus<int>>(0, 256, 256);
67+
test<class KernelName_lMJpe, int, 0, intel::plus<int>>(0, 2, 64);
68+
test<class KernelName_jikSUrEuFUxYGGfXNet, int, 0, intel::plus<int>>(0, 4, 64);
69+
test<class KernelName_cByxQmddzgEGUeboDDbO, int, 0, intel::plus<int>>(0, 8, 128);
70+
test<class KernelName_pggyS, int, 0, intel::plus<int>>(0, 16, 256);
71+
test<class KernelName_CWZouFJ, int, 0, intel::plus<int>>(0, 32, 256);
72+
test<class KernelName_IjuYfJxWZdaVMdE, int, 0, intel::plus<int>>(0, 64, 256);
73+
test<class KernelName_tcKhlzfhg, int, 0, intel::plus<int>>(0, 128, 256);
74+
test<class KernelName_eWffIBPdwvvUwPFZFeG, int, 0, intel::plus<int>>(0, 256, 256);
7875

7976
// Check with various operations.
80-
test<int, 0, std::multiplies<int>>(1, 8, 256);
81-
test<int, 0, intel::bit_or<int>>(0, 8, 256);
82-
test<int, 0, intel::bit_xor<int>>(0, 8, 256);
83-
test<int, 0, intel::bit_and<int>>(~0, 8, 256);
84-
test<int, 0, intel::minimum<int>>((std::numeric_limits<int>::max)(), 8, 256);
85-
test<int, 0, intel::maximum<int>>((std::numeric_limits<int>::min)(), 8, 256);
77+
test<class KernelName_rWAaJsLUS, int, 0, std::multiplies<int>>(1, 8, 256);
78+
test<class KernelName_jZoWyBoLxybjrbk, int, 0, intel::bit_or<int>>(0, 8, 256);
79+
test<class KernelName_jdixaAPjypPSGPCbXIw, int, 0, intel::bit_xor<int>>(0, 8, 256);
80+
test<class KernelName_FNGt, int, 0, intel::bit_and<int>>(~0, 8, 256);
81+
test<class KernelName_KPtKKagKhZzwSibEl, int, 0, intel::minimum<int>>((std::numeric_limits<int>::max)(), 8, 256);
82+
test<class KernelName_xdNhx, int, 0, intel::maximum<int>>((std::numeric_limits<int>::min)(), 8, 256);
8683

8784
// Check with various types.
88-
test<float, 0, std::multiplies<float>>(1, 8, 256);
89-
test<float, 0, intel::minimum<float>>(getMaximumFPValue<float>(), 8, 256);
90-
test<float, 0, intel::maximum<float>>(getMinimumFPValue<float>(), 8, 256);
85+
test<class KernelName_IxDwu, float, 0, std::multiplies<float>>(1, 8, 256);
86+
test<class KernelName_NpYzX, float, 0, intel::minimum<float>>(getMaximumFPValue<float>(), 8, 256);
87+
test<class KernelName_dofjVNlXWgJ, float, 0, intel::maximum<float>>(getMinimumFPValue<float>(), 8, 256);
9188

9289
// Check with CUSTOM type.
93-
test<CustomVec<long long>, 0, CustomVecPlus<long long>>(CustomVec<long long>(0), 8, 256);
90+
test<class KernelName_XrOnrVnB, CustomVec<long long>, 0, CustomVecPlus<long long>>(CustomVec<long long>(0), 8, 256);
9491

9592
std::cout << "Test passed\n";
9693
return 0;

0 commit comments

Comments
 (0)