Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 9113955

Browse files
[SYCL] Do not use cl_* types in DeviceLib tests (#1555)
`cl_*` types are only defined by SYCL 2020 spec for interoperability with OpenCL backend. We should be focusing on core SYCL types instead.
1 parent e2c55ae commit 9113955

12 files changed

+816
-879
lines changed

SYCL/DeviceLib/built-ins/nan.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ template <typename T, typename R> void check_nan(s::queue &Queue) {
3838
}
3939

4040
int main() {
41-
test_nan_call<s::ushort, s::half>();
42-
test_nan_call<s::uint, float>();
43-
test_nan_call<s::ulong, double>();
44-
test_nan_call<s::ulonglong, double>();
41+
test_nan_call<unsigned short, s::half>();
42+
test_nan_call<unsigned int, float>();
43+
test_nan_call<unsigned long, double>();
44+
test_nan_call<unsigned long long, double>();
4545
test_nan_call<s::ushort2, s::half2>();
4646
test_nan_call<s::uint2, s::float2>();
4747
test_nan_call<s::ulong2, s::double2>();

SYCL/DeviceLib/built-ins/scalar_common.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ namespace s = sycl;
1212
int main() {
1313
// max
1414
{
15-
s::cl_float r{0};
15+
float r{0};
1616
{
17-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
17+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
1818
s::queue myQueue;
1919
myQueue.submit([&](s::handler &cgh) {
2020
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
2121
cgh.single_task<class maxF1F1>(
22-
[=]() { AccR[0] = s::max(s::cl_float{0.5f}, s::cl_float{2.3f}); });
22+
[=]() { AccR[0] = s::max(float{0.5f}, float{2.3f}); });
2323
});
2424
}
2525
assert(r == 2.3f);

SYCL/DeviceLib/built-ins/scalar_geometric.cpp

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,106 +12,104 @@ namespace s = sycl;
1212
int main() {
1313
// dot
1414
{
15-
s::cl_float r{0};
15+
float r{0};
1616
{
17-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
17+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
1818
s::queue myQueue;
1919
myQueue.submit([&](s::handler &cgh) {
2020
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
2121
cgh.single_task<class dotF1F1>(
22-
[=]() { AccR[0] = s::dot(s::cl_float{0.5}, s::cl_float{1.6}); });
22+
[=]() { AccR[0] = s::dot(float{0.5}, float{1.6}); });
2323
});
2424
}
2525
assert(r == 0.8f);
2626
}
2727

2828
// distance
2929
{
30-
s::cl_float r{0};
30+
float r{0};
3131
{
32-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
32+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
3333
s::queue myQueue;
3434
myQueue.submit([&](s::handler &cgh) {
3535
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
36-
cgh.single_task<class distanceF1>([=]() {
37-
AccR[0] = s::distance(s::cl_float{1.f}, s::cl_float{3.f});
38-
});
36+
cgh.single_task<class distanceF1>(
37+
[=]() { AccR[0] = s::distance(float{1.f}, float{3.f}); });
3938
});
4039
}
4140
assert(r == 2.f);
4241
}
4342

4443
// length
4544
{
46-
s::cl_float r{0};
45+
float r{0};
4746
{
48-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
47+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
4948
s::queue myQueue;
5049
myQueue.submit([&](s::handler &cgh) {
5150
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
5251
cgh.single_task<class lengthF1>(
53-
[=]() { AccR[0] = s::length(s::cl_float{1.f}); });
52+
[=]() { AccR[0] = s::length(float{1.f}); });
5453
});
5554
}
5655
assert(r == 1.f);
5756
}
5857

5958
// normalize
6059
{
61-
s::cl_float r{0};
60+
float r{0};
6261
{
63-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
62+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
6463
s::queue myQueue;
6564
myQueue.submit([&](s::handler &cgh) {
6665
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
6766
cgh.single_task<class normalizeF1>(
68-
[=]() { AccR[0] = s::normalize(s::cl_float{2.f}); });
67+
[=]() { AccR[0] = s::normalize(float{2.f}); });
6968
});
7069
}
7170
assert(r == 1.f);
7271
}
7372

7473
// fast_distance
7574
{
76-
s::cl_float r{0};
75+
float r{0};
7776
{
78-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
77+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
7978
s::queue myQueue;
8079
myQueue.submit([&](s::handler &cgh) {
8180
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
82-
cgh.single_task<class fast_distanceF1>([=]() {
83-
AccR[0] = s::fast_distance(s::cl_float{1.f}, s::cl_float{3.f});
84-
});
81+
cgh.single_task<class fast_distanceF1>(
82+
[=]() { AccR[0] = s::fast_distance(float{1.f}, float{3.f}); });
8583
});
8684
}
8785
assert(r == 2.f);
8886
}
8987

9088
// fast_length
9189
{
92-
s::cl_float r{0};
90+
float r{0};
9391
{
94-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
92+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
9593
s::queue myQueue;
9694
myQueue.submit([&](s::handler &cgh) {
9795
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
9896
cgh.single_task<class fast_lengthF1>(
99-
[=]() { AccR[0] = s::fast_length(s::cl_float{2.f}); });
97+
[=]() { AccR[0] = s::fast_length(float{2.f}); });
10098
});
10199
}
102100
assert(r == 2.f);
103101
}
104102

105103
// fast_normalize
106104
{
107-
s::cl_float r{0};
105+
float r{0};
108106
{
109-
s::buffer<s::cl_float, 1> BufR(&r, s::range<1>(1));
107+
s::buffer<float, 1> BufR(&r, s::range<1>(1));
110108
s::queue myQueue;
111109
myQueue.submit([&](s::handler &cgh) {
112110
auto AccR = BufR.get_access<s::access::mode::write>(cgh);
113111
cgh.single_task<class fast_normalizeF1>(
114-
[=]() { AccR[0] = s::fast_normalize(s::cl_float{2.f}); });
112+
[=]() { AccR[0] = s::fast_normalize(float{2.f}); });
115113
});
116114
}
117115

0 commit comments

Comments
 (0)