Skip to content

Commit 0000eb3

Browse files
aelovikov-intelbb-sycl
authored andcommitted
[NFC][SYCL] Remove explict "cl::" namespace references (intel#1116)
Part of eliminating "cl" namespace according to the SYCL 2020 specification.
1 parent 6dedd40 commit 0000eb3

File tree

527 files changed

+2465
-2417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

527 files changed

+2465
-2417
lines changed

SYCL/AOT/Inputs/aot.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,37 @@
1111
#include <array>
1212
#include <iostream>
1313

14-
constexpr cl::sycl::access::mode sycl_read = cl::sycl::access::mode::read;
15-
constexpr cl::sycl::access::mode sycl_write = cl::sycl::access::mode::write;
14+
constexpr sycl::access::mode sycl_read = sycl::access::mode::read;
15+
constexpr sycl::access::mode sycl_write = sycl::access::mode::write;
1616

1717
template <typename T> class SimpleVadd;
1818

1919
template <typename T, size_t N>
2020
void simple_vadd(const std::array<T, N> &VA, const std::array<T, N> &VB,
2121
std::array<T, N> &VC) {
22-
cl::sycl::queue deviceQueue([](cl::sycl::exception_list ExceptionList) {
22+
sycl::queue deviceQueue([](sycl::exception_list ExceptionList) {
2323
for (std::exception_ptr ExceptionPtr : ExceptionList) {
2424
try {
2525
std::rethrow_exception(ExceptionPtr);
26-
} catch (cl::sycl::exception &E) {
26+
} catch (sycl::exception &E) {
2727
std::cerr << E.what();
2828
} catch (...) {
2929
std::cerr << "Unknown async exception was caught." << std::endl;
3030
}
3131
}
3232
});
3333

34-
cl::sycl::range<1> numOfItems{N};
35-
cl::sycl::buffer<T, 1> bufferA(VA.data(), numOfItems);
36-
cl::sycl::buffer<T, 1> bufferB(VB.data(), numOfItems);
37-
cl::sycl::buffer<T, 1> bufferC(VC.data(), numOfItems);
34+
sycl::range<1> numOfItems{N};
35+
sycl::buffer<T, 1> bufferA(VA.data(), numOfItems);
36+
sycl::buffer<T, 1> bufferB(VB.data(), numOfItems);
37+
sycl::buffer<T, 1> bufferC(VC.data(), numOfItems);
3838

39-
deviceQueue.submit([&](cl::sycl::handler &cgh) {
39+
deviceQueue.submit([&](sycl::handler &cgh) {
4040
auto accessorA = bufferA.template get_access<sycl_read>(cgh);
4141
auto accessorB = bufferB.template get_access<sycl_read>(cgh);
4242
auto accessorC = bufferC.template get_access<sycl_write>(cgh);
4343

44-
cgh.parallel_for<class SimpleVadd<T>>(numOfItems,
45-
[=](cl::sycl::id<1> wiID) {
44+
cgh.parallel_for<class SimpleVadd<T>>(numOfItems, [=](sycl::id<1> wiID) {
4645
accessorC[wiID] = accessorA[wiID] + accessorB[wiID];
4746
});
4847
});
@@ -52,10 +51,10 @@ void simple_vadd(const std::array<T, N> &VA, const std::array<T, N> &VB,
5251

5352
int main() {
5453
const size_t array_size = 4;
55-
std::array<cl::sycl::cl_int, array_size> A = {{1, 2, 3, 4}},
56-
B = {{1, 2, 3, 4}}, C;
57-
std::array<cl::sycl::cl_float, array_size> D = {{1.f, 2.f, 3.f, 4.f}},
58-
E = {{1.f, 2.f, 3.f, 4.f}}, F;
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;
5958
simple_vadd(A, B, C);
6059
simple_vadd(D, E, F);
6160
for (unsigned int i = 0; i < array_size; i++) {

SYCL/Assert/Inputs/kernels_in_file2.cpp

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

99
#include <cassert>
1010

11-
using namespace cl::sycl;
12-
using namespace cl::sycl::access;
11+
using namespace sycl;
12+
using namespace sycl::access;
1313

1414
int calculus(int X) {
1515
assert(X && "this message from calculus");
@@ -21,25 +21,25 @@ void check_nil(int value) { assert(value && "this message from file2"); }
2121
static constexpr size_t BUFFER_SIZE = 4;
2222

2323
void enqueueKernel_1_fromFile2(queue *Q) {
24-
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
25-
cl::sycl::buffer<int, 1> Buf(numOfItems);
24+
sycl::range<1> numOfItems{BUFFER_SIZE};
25+
sycl::buffer<int, 1> Buf(numOfItems);
2626

2727
Q->submit([&](handler &CGH) {
2828
auto Acc = Buf.template get_access<mode::read_write>(CGH);
2929

3030
CGH.parallel_for<class kernel1_from_separate_file>(
31-
numOfItems, [=](cl::sycl::id<1> wiID) { check_nil(Acc[wiID]); });
31+
numOfItems, [=](sycl::id<1> wiID) { check_nil(Acc[wiID]); });
3232
});
3333
}
3434

3535
void enqueueKernel_2_fromFile2(queue *Q) {
36-
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
37-
cl::sycl::buffer<int, 1> Buf(numOfItems);
36+
sycl::range<1> numOfItems{BUFFER_SIZE};
37+
sycl::buffer<int, 1> Buf(numOfItems);
3838

3939
Q->submit([&](handler &CGH) {
4040
auto Acc = Buf.template get_access<mode::read_write>(CGH);
4141

4242
CGH.parallel_for<class kernel2_from_separate_file>(
43-
numOfItems, [=](cl::sycl::id<1> wiID) { check_nil(Acc[wiID]); });
43+
numOfItems, [=](sycl::id<1> wiID) { check_nil(Acc[wiID]); });
4444
});
4545
}

SYCL/Assert/assert_in_kernels.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --check-prefix=CHECK-ACC --input-file %t.txt
1212
//
1313
// CHECK-NOT: One shouldn't see this message
14-
// CHECK: {{.*}}assert_in_kernels.hpp:26: void kernelFunc2(int *, int): {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
14+
// CHECK: {{.*}}assert_in_kernels.hpp:25: void kernelFunc2(int *, int): {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
1515
// CHECK-SAME: Assertion `Buf[wiID] == 0 && "from assert statement"` failed.
1616
// CHECK-NOT: test aborts earlier, one shouldn't see this message
1717
// CHECK-NOT: The test ended.
1818
//
19-
// CHECK-ACC-NOT: {{.*}}assert_in_kernels.hpp:26: void kernelFunc2(int *, int): {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
19+
// CHECK-ACC-NOT: {{.*}}assert_in_kernels.hpp:25: void kernelFunc2(int *, int): {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
2020
// CHECK-ACC: The test ended.
2121

2222
#include "assert_in_kernels.hpp"

SYCL/Assert/assert_in_kernels.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include <iostream>
33
#include <sycl/sycl.hpp>
44

5-
using namespace cl::sycl;
6-
using namespace cl::sycl::access;
5+
using namespace sycl;
6+
using namespace sycl::access;
77

88
void kernelFunc1(int *Buf, int wiID) {
99
Buf[wiID] = 9;
@@ -15,8 +15,7 @@ void assertTest1(queue &Q, buffer<int, 1> &Buf) {
1515
auto Acc = Buf.template get_access<mode::read_write>(CGH);
1616

1717
CGH.parallel_for<class Kernel_1>(
18-
Buf.get_range(),
19-
[=](cl::sycl::id<1> wiID) { kernelFunc1(&Acc[0], wiID); });
18+
Buf.get_range(), [=](sycl::id<1> wiID) { kernelFunc1(&Acc[0], wiID); });
2019
});
2120
}
2221

@@ -31,8 +30,7 @@ void assertTest2(queue &Q, buffer<int, 1> &Buf) {
3130
auto Acc = Buf.template get_access<mode::read_write>(CGH);
3231

3332
CGH.parallel_for<class Kernel_2>(
34-
Buf.get_range(),
35-
[=](cl::sycl::id<1> wiID) { kernelFunc2(&Acc[0], wiID); });
33+
Buf.get_range(), [=](sycl::id<1> wiID) { kernelFunc2(&Acc[0], wiID); });
3634
});
3735
}
3836

@@ -47,15 +45,14 @@ void assertTest3(queue &Q, buffer<int, 1> &Buf) {
4745
auto Acc = Buf.template get_access<mode::read_write>(CGH);
4846

4947
CGH.parallel_for<class Kernel_3>(
50-
Buf.get_range(),
51-
[=](cl::sycl::id<1> wiID) { kernelFunc3(&Acc[0], wiID); });
48+
Buf.get_range(), [=](sycl::id<1> wiID) { kernelFunc3(&Acc[0], wiID); });
5249
});
5350
}
5451

5552
int main(int Argc, const char *Argv[]) {
5653
std::array<int, 4> Vec = {1, 2, 3, 4};
57-
cl::sycl::range<1> numOfItems{Vec.size()};
58-
cl::sycl::buffer<int, 1> Buf(Vec.data(), numOfItems);
54+
sycl::range<1> numOfItems{Vec.size()};
55+
sycl::buffer<int, 1> Buf(Vec.data(), numOfItems);
5956

6057
queue Q;
6158
assertTest1(Q, Buf);

SYCL/Assert/assert_in_kernels_win.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// CHECK-NOT: One shouldn't see this message
1313
// FIXME Windows version prints '(null)' instead of '<unknown func>' once in a
1414
// while for some insane reason.
15-
// CHECK: {{.*}}assert_in_kernels.hpp:26: {{<unknown func>|(null)}}: {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
15+
// CHECK: {{.*}}assert_in_kernels.hpp:25: {{<unknown func>|(null)}}: {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
1616
// CHECK-SAME: Assertion `Buf[wiID] == 0 && "from assert statement"` failed.
1717
// CHECK-NOT: test aborts earlier, one shouldn't see this message
1818
// CHECK-NOT: The test ended.
1919
//
20-
// CHECK-ACC-NOT: {{.*}}assert_in_kernels.hpp:26: {{<unknown func>|(null)}}: {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
20+
// CHECK-ACC-NOT: {{.*}}assert_in_kernels.hpp:25: {{<unknown func>|(null)}}: {{.*}} [{{[0,2]}},0,0], {{.*}} [0,0,0]
2121
// CHECK-ACC: The test ended.
2222

2323
#include "assert_in_kernels.hpp"

SYCL/Assert/assert_in_multiple_tus.hpp

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

1111
#include <cassert>
1212

13-
using namespace cl::sycl;
14-
using namespace cl::sycl::access;
13+
using namespace sycl;
14+
using namespace sycl::access;
1515

1616
static constexpr size_t BUFFER_SIZE = 16;
1717

@@ -22,15 +22,15 @@ int checkFunction() {
2222
}
2323

2424
void enqueueKernel_1_fromFile1(queue *Q) {
25-
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
26-
cl::sycl::buffer<int, 1> Buf(numOfItems);
25+
sycl::range<1> numOfItems{BUFFER_SIZE};
26+
sycl::buffer<int, 1> Buf(numOfItems);
2727

2828
Q->submit([&](handler &CGH) {
2929
auto Acc = Buf.template get_access<mode::read_write>(CGH);
3030

3131
CGH.parallel_for<class Kernel_1>(
32-
cl::sycl::nd_range(Buf.get_range(), cl::sycl::range<1>(4)),
33-
[=](cl::sycl::id<1> wiID) {
32+
sycl::nd_range(Buf.get_range(), sycl::range<1>(4)),
33+
[=](sycl::id<1> wiID) {
3434
int X = 0;
3535
if (wiID == 5)
3636
X = checkFunction();

SYCL/Assert/assert_in_one_kernel.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include <iostream>
33
#include <sycl/sycl.hpp>
44

5-
using namespace cl::sycl;
6-
using namespace cl::sycl::access;
5+
using namespace sycl;
6+
using namespace sycl::access;
77

88
void kernelFunc(int *Buf, int wiID) {
99
Buf[wiID] = 0;
@@ -12,8 +12,8 @@ void kernelFunc(int *Buf, int wiID) {
1212

1313
void assertTest() {
1414
std::array<int, 4> Vec = {1, 2, 3, 4};
15-
cl::sycl::range<1> numOfItems{Vec.size()};
16-
cl::sycl::buffer<int, 1> Buf(Vec.data(), numOfItems);
15+
sycl::range<1> numOfItems{Vec.size()};
16+
sycl::buffer<int, 1> Buf(Vec.data(), numOfItems);
1717

1818
queue Q;
1919
Q.submit([&](handler &CGH) {

SYCL/Assert/assert_in_simultaneous_kernels.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include <sycl/sycl.hpp>
55
#include <thread>
66

7-
using namespace cl::sycl;
8-
using namespace cl::sycl::access;
7+
using namespace sycl;
8+
using namespace sycl::access;
99

1010
static constexpr size_t NUM_THREADS = 4;
1111
static constexpr size_t RANGE_SIZE = 1024;

SYCL/Assert/assert_in_simultaneously_multiple_tus.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@
3838

3939
#include <cassert>
4040

41-
using namespace cl::sycl;
42-
using namespace cl::sycl::access;
41+
using namespace sycl;
42+
using namespace sycl::access;
4343

4444
static constexpr size_t NUM_THREADS = 4;
4545
static constexpr size_t BUFFER_SIZE = 10;
4646

4747
template <class kernel_name> void enqueueKernel(queue *Q) {
48-
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
49-
cl::sycl::buffer<int, 1> Buf(numOfItems);
48+
sycl::range<1> numOfItems{BUFFER_SIZE};
49+
sycl::buffer<int, 1> Buf(numOfItems);
5050

5151
Q->submit([&](handler &CGH) {
5252
auto Acc = Buf.template get_access<mode::read_write>(CGH);
5353

54-
CGH.parallel_for<kernel_name>(numOfItems, [=](cl::sycl::id<1> wiID) {
54+
CGH.parallel_for<kernel_name>(numOfItems, [=](sycl::id<1> wiID) {
5555
Acc[wiID] = 0;
5656
if (wiID == 5)
5757
assert(false && "this message from file1");

SYCL/BFloat16/bfloat16_type.hpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <cmath>
55

6-
using namespace cl::sycl;
6+
using namespace sycl;
77

88
constexpr size_t N = 100;
99

@@ -20,7 +20,7 @@ void verify_conv_implicit(queue &q, buffer<float, 1> &a, range<1> &r,
2020
q.submit([&](handler &cgh) {
2121
auto A = a.get_access<access::mode::read_write>(cgh);
2222
cgh.parallel_for<class calc_conv>(r, [=](id<1> index) {
23-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
23+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
2424
A[index] = AVal;
2525
});
2626
});
@@ -34,8 +34,8 @@ void verify_conv_explicit(queue &q, buffer<float, 1> &a, range<1> &r,
3434
auto A = a.get_access<access::mode::read_write>(cgh);
3535
cgh.parallel_for<class calc_conv_impl>(r, [=](id<1> index) {
3636
uint16_t AVal =
37-
cl::sycl::ext::oneapi::experimental::bfloat16::from_float(A[index]);
38-
A[index] = cl::sycl::ext::oneapi::experimental::bfloat16::to_float(AVal);
37+
sycl::ext::oneapi::experimental::bfloat16::from_float(A[index]);
38+
A[index] = sycl::ext::oneapi::experimental::bfloat16::to_float(AVal);
3939
});
4040
});
4141

@@ -51,9 +51,9 @@ void verify_add(queue &q, buffer<float, 1> &a, buffer<float, 1> &b, range<1> &r,
5151
auto B = b.get_access<access::mode::read>(cgh);
5252
auto C = c.get_access<access::mode::write>(cgh);
5353
cgh.parallel_for<class calc_add_expl>(r, [=](id<1> index) {
54-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
55-
cl::sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
56-
cl::sycl::ext::oneapi::experimental::bfloat16 CVal = AVal + BVal;
54+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
55+
sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
56+
sycl::ext::oneapi::experimental::bfloat16 CVal = AVal + BVal;
5757
C[index] = CVal;
5858
});
5959
});
@@ -70,9 +70,9 @@ void verify_sub(queue &q, buffer<float, 1> &a, buffer<float, 1> &b, range<1> &r,
7070
auto B = b.get_access<access::mode::read>(cgh);
7171
auto C = c.get_access<access::mode::write>(cgh);
7272
cgh.parallel_for<class calc_sub>(r, [=](id<1> index) {
73-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
74-
cl::sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
75-
cl::sycl::ext::oneapi::experimental::bfloat16 CVal = AVal - BVal;
73+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
74+
sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
75+
sycl::ext::oneapi::experimental::bfloat16 CVal = AVal - BVal;
7676
C[index] = CVal;
7777
});
7878
});
@@ -87,8 +87,8 @@ void verify_minus(queue &q, buffer<float, 1> &a, range<1> &r, const float ref) {
8787
auto A = a.get_access<access::mode::read>(cgh);
8888
auto C = c.get_access<access::mode::write>(cgh);
8989
cgh.parallel_for<class calc_minus>(r, [=](id<1> index) {
90-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
91-
cl::sycl::ext::oneapi::experimental::bfloat16 CVal = -AVal;
90+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
91+
sycl::ext::oneapi::experimental::bfloat16 CVal = -AVal;
9292
C[index] = CVal;
9393
});
9494
});
@@ -105,9 +105,9 @@ void verify_mul(queue &q, buffer<float, 1> &a, buffer<float, 1> &b, range<1> &r,
105105
auto B = b.get_access<access::mode::read>(cgh);
106106
auto C = c.get_access<access::mode::write>(cgh);
107107
cgh.parallel_for<class calc_mul>(r, [=](id<1> index) {
108-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
109-
cl::sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
110-
cl::sycl::ext::oneapi::experimental::bfloat16 CVal = AVal * BVal;
108+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
109+
sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
110+
sycl::ext::oneapi::experimental::bfloat16 CVal = AVal * BVal;
111111
C[index] = CVal;
112112
});
113113
});
@@ -124,9 +124,9 @@ void verify_div(queue &q, buffer<float, 1> &a, buffer<float, 1> &b, range<1> &r,
124124
auto B = b.get_access<access::mode::read>(cgh);
125125
auto C = c.get_access<access::mode::write>(cgh);
126126
cgh.parallel_for<class calc_div>(r, [=](id<1> index) {
127-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
128-
cl::sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
129-
cl::sycl::ext::oneapi::experimental::bfloat16 CVal = AVal / BVal;
127+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
128+
sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
129+
sycl::ext::oneapi::experimental::bfloat16 CVal = AVal / BVal;
130130
C[index] = CVal;
131131
});
132132
});
@@ -143,12 +143,12 @@ void verify_logic(queue &q, buffer<float, 1> &a, buffer<float, 1> &b,
143143
auto B = b.get_access<access::mode::read>(cgh);
144144
auto C = c.get_access<access::mode::write>(cgh);
145145
cgh.parallel_for<class logic>(r, [=](id<1> index) {
146-
cl::sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
147-
cl::sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
146+
sycl::ext::oneapi::experimental::bfloat16 AVal{A[index]};
147+
sycl::ext::oneapi::experimental::bfloat16 BVal{B[index]};
148148
if (AVal) {
149149
if (AVal > BVal || AVal >= BVal || AVal < BVal || AVal <= BVal ||
150150
!BVal) {
151-
cl::sycl::ext::oneapi::experimental::bfloat16 CVal =
151+
sycl::ext::oneapi::experimental::bfloat16 CVal =
152152
AVal != BVal ? AVal : BVal;
153153
CVal--;
154154
CVal++;

SYCL/Basic/access_to_subset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414
#include <sycl/sycl.hpp>
1515

16-
using namespace cl::sycl;
16+
using namespace sycl;
1717
using acc_w = accessor<int, 2, access::mode::write, access::target::device>;
1818

1919
int main() {

0 commit comments

Comments
 (0)