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

Commit 59b0171

Browse files
[SYCL] Do not use cl_* types in some tests (#1490)
`cl_*` types are defined by SYCL spec as interoperability interface with OpenCL. There is no need to use them in most of SYCL tests. This change is mostly motivated by the fact that those `cl_*` type aliases were moved from `sycl` into `sycl::opencl` namespace: we simply want to avoid tests breakage when we align the implementation with the spec.
1 parent 6810175 commit 59b0171

File tree

6 files changed

+90
-92
lines changed

6 files changed

+90
-92
lines changed

SYCL/AOT/Inputs/aot.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ void simple_vadd(const std::array<T, N> &VA, const std::array<T, N> &VB,
5151

5252
int main() {
5353
const size_t array_size = 4;
54-
std::array<sycl::cl_int, array_size> A = {{1, 2, 3, 4}}, B = {{1, 2, 3, 4}},
55-
C;
56-
std::array<sycl::cl_float, array_size> D = {{1.f, 2.f, 3.f, 4.f}},
57-
E = {{1.f, 2.f, 3.f, 4.f}}, F;
54+
std::array<int, array_size> A = {{1, 2, 3, 4}}, B = {{1, 2, 3, 4}}, C;
55+
std::array<float, array_size> D = {{1.f, 2.f, 3.f, 4.f}},
56+
E = {{1.f, 2.f, 3.f, 4.f}}, F;
5857
simple_vadd(A, B, C);
5958
simple_vadd(D, E, F);
6059
for (unsigned int i = 0; i < array_size; i++) {

SYCL/Basic/device_event.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ int test_strideN(size_t stride) {
8080
myQueue.submit([&](handler &cgh) {
8181
auto out_ptr = out_buf.get_access<access::mode::write>(cgh);
8282
#ifdef USE_DEPRECATED_LOCAL_ACC
83-
accessor<sycl::cl_int, 1, access::mode::read_write, access::target::local>
83+
accessor<int, 1, access::mode::read_write, access::target::local>
8484
local_acc(range<1>(16), cgh);
8585
#else
86-
local_accessor<sycl::cl_int, 1> local_acc(range<1>(16), cgh);
86+
local_accessor<int, 1> local_acc(range<1>(16), cgh);
8787
#endif
8888

8989
// Create work-groups with 16 work items in each group.

SYCL/Basic/swizzle_op.cpp

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ using namespace sycl;
1818

1919
int main() {
2020
{
21-
sycl::cl_float results[3] = {0};
21+
float results[3] = {0};
2222
{
23-
buffer<sycl::cl_float, 1> b(results, range<1>(3));
23+
buffer<float, 1> b(results, range<1>(3));
2424
queue myQueue;
2525
myQueue.submit([&](handler &cgh) {
2626
auto B = b.get_access<access::mode::write>(cgh);
2727
cgh.single_task<class test_1>([=]() {
28-
sycl::cl_float2 ab = {4, 2};
29-
sycl::cl_float c = ab.x() * ab.y();
28+
float2 ab = {4, 2};
29+
float c = ab.x() * ab.y();
3030
B[0] = ab.x();
3131
B[1] = ab.y();
3232
B[2] = c;
@@ -39,15 +39,15 @@ int main() {
3939
}
4040

4141
{
42-
sycl::cl_float results[3] = {0};
42+
float results[3] = {0};
4343
{
44-
buffer<sycl::cl_float, 1> b(results, range<1>(3));
44+
buffer<float, 1> b(results, range<1>(3));
4545
queue myQueue;
4646
myQueue.submit([&](handler &cgh) {
4747
auto B = b.get_access<access::mode::write>(cgh);
4848
cgh.single_task<class test_2>([=]() {
49-
sycl::cl_float2 ab = {4, 2};
50-
sycl::cl_float c = ab.x() * 2;
49+
float2 ab = {4, 2};
50+
float c = ab.x() * 2;
5151
B[0] = ab.x();
5252
B[1] = ab.y();
5353
B[2] = c;
@@ -60,15 +60,15 @@ int main() {
6060
}
6161

6262
{
63-
sycl::cl_float results[3] = {0};
63+
float results[3] = {0};
6464
{
65-
buffer<sycl::cl_float, 1> b(results, range<1>(3));
65+
buffer<float, 1> b(results, range<1>(3));
6666
queue myQueue;
6767
myQueue.submit([&](handler &cgh) {
6868
auto B = b.get_access<access::mode::write>(cgh);
6969
cgh.single_task<class test_3>([=]() {
70-
sycl::cl_float2 ab = {4, 2};
71-
sycl::cl_float c = 4 * ab.y();
70+
float2 ab = {4, 2};
71+
float c = 4 * ab.y();
7272
B[0] = ab.x();
7373
B[1] = ab.y();
7474
B[2] = c;
@@ -81,15 +81,15 @@ int main() {
8181
}
8282

8383
{
84-
sycl::cl_float results[4] = {0};
84+
float results[4] = {0};
8585
{
86-
buffer<sycl::cl_float, 1> b(results, range<1>(4));
86+
buffer<float, 1> b(results, range<1>(4));
8787
queue myQueue;
8888
myQueue.submit([&](handler &cgh) {
8989
auto B = b.get_access<access::mode::write>(cgh);
9090
cgh.single_task<class test_4>([=]() {
91-
sycl::cl_float2 ab = {4, 2};
92-
sycl::cl_float2 c = {0, 0};
91+
float2 ab = {4, 2};
92+
float2 c = {0, 0};
9393
c.x() = ab.x() * ab.y();
9494
B[0] = ab.x();
9595
B[1] = ab.y();
@@ -105,15 +105,15 @@ int main() {
105105
}
106106

107107
{
108-
sycl::cl_float results[4] = {0};
108+
float results[4] = {0};
109109
{
110-
buffer<sycl::cl_float, 1> b(results, range<1>(4));
110+
buffer<float, 1> b(results, range<1>(4));
111111
queue myQueue;
112112
myQueue.submit([&](handler &cgh) {
113113
auto B = b.get_access<access::mode::write>(cgh);
114114
cgh.single_task<class test_5>([=]() {
115-
sycl::cl_float2 ab = {4, 2};
116-
sycl::cl_float2 c = {0, 0};
115+
float2 ab = {4, 2};
116+
float2 c = {0, 0};
117117
c.x() = 4 * ab.y();
118118
B[0] = ab.x();
119119
B[1] = ab.y();
@@ -129,15 +129,15 @@ int main() {
129129
}
130130

131131
{
132-
sycl::cl_float results[4] = {0};
132+
float results[4] = {0};
133133
{
134-
buffer<sycl::cl_float, 1> b(results, range<1>(4));
134+
buffer<float, 1> b(results, range<1>(4));
135135
queue myQueue;
136136
myQueue.submit([&](handler &cgh) {
137137
auto B = b.get_access<access::mode::write>(cgh);
138138
cgh.single_task<class test_6>([=]() {
139-
sycl::cl_float2 ab = {4, 2};
140-
sycl::cl_float2 c = {0, 0};
139+
float2 ab = {4, 2};
140+
float2 c = {0, 0};
141141
c.x() = ab.x() * 2;
142142
B[0] = ab.x();
143143
B[1] = ab.y();
@@ -153,21 +153,21 @@ int main() {
153153
}
154154

155155
{
156-
sycl::cl_float results[6] = {0};
156+
float results[6] = {0};
157157
{
158-
buffer<sycl::cl_float, 1> b(results, range<1>(6));
158+
buffer<float, 1> b(results, range<1>(6));
159159
queue myQueue;
160160
myQueue.submit([&](handler &cgh) {
161161
auto B = b.get_access<access::mode::write>(cgh);
162162
cgh.single_task<class test_7>([=]() {
163-
sycl::uchar4 abc = {4, 2, 1, 0};
163+
uchar4 abc = {4, 2, 1, 0};
164164

165-
sycl::uchar4 c_each;
165+
uchar4 c_each;
166166
c_each.x() = abc.x();
167167
c_each.y() = abc.y();
168168
c_each.z() = abc.z();
169169

170-
sycl::uchar4 c_full;
170+
uchar4 c_full;
171171
c_full = abc;
172172

173173
B[0] = c_each.x();
@@ -188,24 +188,24 @@ int main() {
188188
}
189189

190190
{
191-
sycl::cl_float results[4] = {0};
191+
float results[4] = {0};
192192
{
193-
buffer<sycl::cl_float, 1> b(results, range<1>(4));
193+
buffer<float, 1> b(results, range<1>(4));
194194
queue myQueue;
195195
myQueue.submit([&](handler &cgh) {
196196
auto B = b.get_access<access::mode::write>(cgh);
197197
cgh.single_task<class test_8>([=]() {
198-
sycl::uchar4 cba;
199-
sycl::uchar x = 1;
200-
sycl::uchar y = 2;
201-
sycl::uchar z = 3;
202-
sycl::uchar w = 4;
198+
uchar4 cba;
199+
unsigned char x = 1;
200+
unsigned char y = 2;
201+
unsigned char z = 3;
202+
unsigned char w = 4;
203203
cba.x() = x;
204204
cba.y() = y;
205205
cba.z() = z;
206206
cba.w() = w;
207207

208-
sycl::uchar4 abc = {1, 2, 3, 4};
208+
uchar4 abc = {1, 2, 3, 4};
209209
abc.x() = cba.s0();
210210
abc.y() = cba.s1();
211211
abc.z() = cba.s2();
@@ -228,16 +228,16 @@ int main() {
228228
}
229229

230230
{
231-
sycl::cl_uint results[4] = {0};
231+
unsigned int results[4] = {0};
232232
{
233-
buffer<sycl::cl_uint, 1> b(results, range<1>(4));
233+
buffer<unsigned int, 1> b(results, range<1>(4));
234234
queue myQueue;
235235
myQueue.submit([&](handler &cgh) {
236236
auto B = b.get_access<access::mode::write>(cgh);
237237
cgh.single_task<class test_9>([=]() {
238-
sycl::uchar4 vec;
239-
sycl::uint add = 254;
240-
sycl::uchar factor = 2;
238+
uchar4 vec;
239+
unsigned int add = 254;
240+
unsigned char factor = 2;
241241
vec.x() = 2;
242242
vec.y() = 4;
243243
vec.z() = 6;
@@ -259,13 +259,12 @@ int main() {
259259
{
260260
int FF[8] = {1, 1, 1, 0, 1, 1, 1, 0};
261261
{
262-
buffer<sycl::int3, 1> b((sycl::int3 *)FF, range<1>(2));
262+
buffer<int3, 1> b((int3 *)FF, range<1>(2));
263263
queue myQueue;
264264
myQueue.submit([&](handler &cgh) {
265265
auto B = b.get_access<access::mode::read_write>(cgh);
266-
cgh.parallel_for<class test_10>(sycl::range<1>{2}, [=](sycl::id<1> ID) {
267-
B[ID] = sycl::int3{ID[0]} / B[ID];
268-
});
266+
cgh.parallel_for<class test_10>(
267+
range<1>{2}, [=](id<1> ID) { B[ID] = int3{ID[0]} / B[ID]; });
269268
});
270269
}
271270
assert(FF[0] == 0);
@@ -276,15 +275,15 @@ int main() {
276275
assert(FF[6] == 1);
277276
}
278277
{
279-
sycl::int3 result = {0, 0, 0};
278+
int3 result = {0, 0, 0};
280279
{
281-
buffer<sycl::int3, 1> b(&result, range<1>(1));
280+
buffer<int3, 1> b(&result, range<1>(1));
282281
queue myQueue;
283282
myQueue.submit([&](handler &cgh) {
284283
auto B = b.get_access<access::mode::write>(cgh);
285284
cgh.single_task<class test_11>([=]() {
286-
sycl::int3 testVec1 = {2, 2, 2};
287-
sycl::int3 testVec2 = {1, 1, 1};
285+
int3 testVec1 = {2, 2, 2};
286+
int3 testVec2 = {1, 1, 1};
288287
B[0] = testVec1 / testVec2;
289288
});
290289
});

SYCL/KernelParams/non-standard-layout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ using namespace sycl;
1111
struct F1 {};
1212
struct F2 {};
1313
struct F : F1, F2 {
14-
sycl::cl_char x;
14+
char x;
1515
};
1616

1717
bool test0() {

SYCL/Regression/fp16-with-unnamed-lambda.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int main() {
2323
if (!D.has(sycl::aspect::fp16))
2424
return 0; // Skip the test if halfs are not supported
2525

26-
sycl::buffer<sycl::cl_half> Buf(1);
26+
sycl::buffer<sycl::half> Buf(1);
2727

2828
Q.submit([&](sycl::handler &CGH) {
2929
auto Acc = Buf.get_access<sycl::access::mode::write>(CGH);

0 commit comments

Comments
 (0)