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

Commit 9497780

Browse files
authored
Update several tests to use sycl/sycl.hpp header (#444)
1 parent e4bfaa8 commit 9497780

File tree

7 files changed

+51
-49
lines changed

7 files changed

+51
-49
lines changed

SYCL/Basic/buffer/buffer.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17-
#include <CL/sycl.hpp>
17+
#include <sycl/sycl.hpp>
18+
1819
#include <cassert>
1920
#include <memory>
2021

21-
using namespace cl::sycl;
22+
using namespace sycl;
2223

2324
int main() {
2425
int data = 5;
@@ -506,7 +507,7 @@ int main() {
506507
{
507508
size_t size = 32;
508509
const size_t dims = 1;
509-
cl::sycl::range<dims> r(size);
510+
sycl::range<dims> r(size);
510511

511512
std::shared_ptr<bool> bool_shrd(new bool[size],
512513
[](bool *data) { delete[] data; });
@@ -522,18 +523,18 @@ int main() {
522523
int_vector.reserve(size);
523524
double_vector.reserve(size);
524525

525-
cl::sycl::queue Queue;
526+
sycl::queue Queue;
526527
std::mutex m;
527528
{
528-
cl::sycl::buffer<bool, dims> buf_bool_shrd(
529+
sycl::buffer<bool, dims> buf_bool_shrd(
529530
bool_shrd, r,
530-
cl::sycl::property_list{cl::sycl::property::buffer::use_mutex(m)});
531-
cl::sycl::buffer<int, dims> buf_int_shrd(
531+
sycl::property_list{sycl::property::buffer::use_mutex(m)});
532+
sycl::buffer<int, dims> buf_int_shrd(
532533
int_shrd, r,
533-
cl::sycl::property_list{cl::sycl::property::buffer::use_mutex(m)});
534-
cl::sycl::buffer<double, dims> buf_double_shrd(
534+
sycl::property_list{sycl::property::buffer::use_mutex(m)});
535+
sycl::buffer<double, dims> buf_double_shrd(
535536
double_shrd, r,
536-
cl::sycl::property_list{cl::sycl::property::buffer::use_mutex(m)});
537+
sycl::property_list{sycl::property::buffer::use_mutex(m)});
537538
m.lock();
538539
std::fill(bool_shrd.get(), (bool_shrd.get() + size), bool());
539540
std::fill(int_shrd.get(), (int_shrd.get() + size), int());
@@ -547,14 +548,14 @@ int main() {
547548
buf_int_shrd.set_write_back(true);
548549
buf_double_shrd.set_write_back(true);
549550

550-
Queue.submit([&](cl::sycl::handler &cgh) {
551+
Queue.submit([&](sycl::handler &cgh) {
551552
auto Accessor_bool =
552-
buf_bool_shrd.get_access<cl::sycl::access::mode::write>(cgh);
553+
buf_bool_shrd.get_access<sycl::access::mode::write>(cgh);
553554
auto Accessor_int =
554-
buf_int_shrd.get_access<cl::sycl::access::mode::write>(cgh);
555+
buf_int_shrd.get_access<sycl::access::mode::write>(cgh);
555556
auto Accessor_double =
556-
buf_double_shrd.get_access<cl::sycl::access::mode::write>(cgh);
557-
cgh.parallel_for<class FillBuffer>(r, [=](cl::sycl::id<1> WIid) {
557+
buf_double_shrd.get_access<sycl::access::mode::write>(cgh);
558+
cgh.parallel_for<class FillBuffer>(r, [=](sycl::id<1> WIid) {
558559
Accessor_bool[WIid] = true;
559560
Accessor_int[WIid] = 3;
560561
Accessor_double[WIid] = 7.5;
@@ -650,20 +651,18 @@ int main() {
650651
{
651652
std::allocator<float8> buf_alloc;
652653
std::shared_ptr<float8> data(new float8[8], [](float8 *p) { delete[] p; });
653-
cl::sycl::buffer<float8, 1, std::allocator<float8>> b(
654-
data, cl::sycl::range<1>(8), buf_alloc);
654+
sycl::buffer<float8, 1, std::allocator<float8>> b(data, sycl::range<1>(8),
655+
buf_alloc);
655656
}
656657

657658
{
658659
constexpr int Size = 6;
659-
cl::sycl::buffer<char, 1> Buf_1(Size);
660-
cl::sycl::buffer<char, 1> Buf_2(Size / 2);
660+
sycl::buffer<char, 1> Buf_1(Size);
661+
sycl::buffer<char, 1> Buf_2(Size / 2);
661662

662663
{
663-
auto AccA =
664-
Buf_1.get_access<cl::sycl::access::mode::read_write>(Size / 2);
665-
auto AccB =
666-
Buf_2.get_access<cl::sycl::access::mode::read_write>(Size / 2);
664+
auto AccA = Buf_1.get_access<sycl::access::mode::read_write>(Size / 2);
665+
auto AccB = Buf_2.get_access<sycl::access::mode::read_write>(Size / 2);
667666
assert(AccA.get_size() == AccB.get_size());
668667
assert(AccA.get_range() == AccB.get_range());
669668
assert(AccA.get_count() == AccB.get_count());

SYCL/Basic/free_function_queries/free_function_queries.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===------------------------------------------------------------------------===//
1414

15-
#include <CL/sycl.hpp>
15+
#include <sycl/sycl.hpp>
1616

1717
#include <cassert>
1818
#include <iostream>
@@ -31,7 +31,7 @@ int main() {
3131
sycl::buffer<int> buf(data, sycl::range<1>(n));
3232
sycl::buffer<int> results_buf(results, sycl::range<1>(checks_number));
3333
sycl::queue q;
34-
q.submit([&](cl::sycl::handler &cgh) {
34+
q.submit([&](sycl::handler &cgh) {
3535
sycl::accessor<int, 1, sycl::access::mode::write,
3636
sycl::access::target::global_buffer>
3737
acc(buf.get_access<sycl::access::mode::write>(cgh));
@@ -65,7 +65,7 @@ int main() {
6565
sycl::buffer<int> buf(data, sycl::range<1>(n));
6666
sycl::buffer<int> results_buf(results, sycl::range<1>(checks_number));
6767
sycl::queue q;
68-
q.submit([&](cl::sycl::handler &cgh) {
68+
q.submit([&](sycl::handler &cgh) {
6969
sycl::accessor<int, 1, sycl::access::mode::write,
7070
sycl::access::target::global_buffer>
7171
acc(buf.get_access<sycl::access::mode::write>(cgh));
@@ -100,7 +100,7 @@ int main() {
100100
sycl::buffer<int> results_buf(results, sycl::range<1>(checks_number));
101101
sycl::queue q;
102102
sycl::id<1> offset(1);
103-
q.submit([&](cl::sycl::handler &cgh) {
103+
q.submit([&](sycl::handler &cgh) {
104104
sycl::accessor<int, 1, sycl::access::mode::write,
105105
sycl::access::target::global_buffer>
106106
acc(buf.get_access<sycl::access::mode::write>(cgh));
@@ -134,7 +134,7 @@ int main() {
134134
sycl::buffer<int> results_buf(results, sycl::range<1>(checks_number));
135135
sycl::queue q;
136136
sycl::nd_range<1> NDR(sycl::range<1>{n}, sycl::range<1>{2});
137-
q.submit([&](cl::sycl::handler &cgh) {
137+
q.submit([&](sycl::handler &cgh) {
138138
sycl::accessor<int, 1, sycl::access::mode::write,
139139
sycl::access::target::global_buffer>
140140
acc(buf.get_access<sycl::access::mode::write>(cgh));

SYCL/Basic/image/srgba-read.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// UNSUPPORTED: rocm_nvidia
88
// UNSUPPORTED: rocm_amd
99

10-
#include <CL/sycl.hpp>
10+
#include <sycl/sycl.hpp>
1111

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

1414
using accessorPixelT = sycl::float4;
1515
using dataPixelT = uint32_t;

SYCL/ESIMD/mandelbrot/mandelbrot_spec.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
// RUN: %GPU_RUN_PLACEHOLDER %t.out %T/output_spec.ppm %S/golden_hw.ppm 512 -2.09798 -1.19798 0.004 4.0
1313

1414
#include "esimd_test_utils.hpp"
15-
#include <CL/sycl.hpp>
15+
16+
#include <sycl/ext/intel/experimental/esimd.hpp>
17+
#include <sycl/sycl.hpp>
18+
1619
#include <array>
1720
#include <iostream>
1821
#include <memory>
19-
#include <sycl/ext/intel/experimental/esimd.hpp>
2022

21-
using namespace cl::sycl;
23+
using namespace sycl;
2224
using namespace sycl::ext::intel::experimental::esimd;
2325

2426
#ifdef _SIM_MODE_
@@ -95,17 +97,17 @@ int main(int argc, char *argv[]) {
9597
unsigned char *buf = new unsigned char[img_size];
9698

9799
try {
98-
cl::sycl::image<2> imgOutput((unsigned int *)buf, image_channel_order::rgba,
99-
image_channel_type::unsigned_int8,
100-
range<2>{WIDTH, HEIGHT});
100+
sycl::image<2> imgOutput((unsigned int *)buf, image_channel_order::rgba,
101+
image_channel_type::unsigned_int8,
102+
range<2>{WIDTH, HEIGHT});
101103

102104
// We need that many workitems
103105
uint range_width = WIDTH / 8;
104106
uint range_height = HEIGHT / 2;
105-
cl::sycl::range<2> GlobalRange{range_width, range_height};
107+
sycl::range<2> GlobalRange{range_width, range_height};
106108

107109
// Number of workitems in a workgroup
108-
cl::sycl::range<2> LocalRange{1, 1};
110+
sycl::range<2> LocalRange{1, 1};
109111

110112
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
111113

@@ -125,7 +127,7 @@ int main(int argc, char *argv[]) {
125127
<< ", yoff = " << yoff << ", scale = " << scale
126128
<< ", thrs = " << thrs << "\n";
127129
}
128-
cl::sycl::program prg(q.get_context());
130+
sycl::program prg(q.get_context());
129131
sycl::ext::oneapi::experimental::spec_constant<int, CrunchConst>
130132
crunch_const = prg.set_spec_constant<CrunchConst>(crunch);
131133
sycl::ext::oneapi::experimental::spec_constant<float, XoffConst>
@@ -136,11 +138,12 @@ int main(int argc, char *argv[]) {
136138
scale_const = prg.set_spec_constant<ScaleConst>(scale);
137139
sycl::ext::oneapi::experimental::spec_constant<float, ThrsConst>
138140
thrs_const = prg.set_spec_constant<ThrsConst>(thrs);
141+
139142
prg.build_with_kernel_type<Test>();
140143

141-
auto e = q.submit([&](cl::sycl::handler &cgh) {
144+
auto e = q.submit([&](sycl::handler &cgh) {
142145
auto accOutput =
143-
imgOutput.get_access<uint4, cl::sycl::access::mode::write>(cgh);
146+
imgOutput.get_access<uint4, sycl::access::mode::write>(cgh);
144147

145148
cgh.parallel_for<Test>(prg.get_kernel<Test>(), GlobalRange * LocalRange,
146149
[=](item<2> it) SYCL_ESIMD_KERNEL {
@@ -153,7 +156,7 @@ int main(int argc, char *argv[]) {
153156
});
154157
});
155158
e.wait();
156-
} catch (cl::sycl::exception const &e) {
159+
} catch (sycl::exception const &e) {
157160
std::cout << "SYCL exception caught: " << e.what() << '\n';
158161
delete[] buf;
159162
return e.get_cl_code();

SYCL/GroupAlgorithm/SYCL2020/shift_left_right.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "helpers.hpp"
10-
#include <CL/sycl.hpp>
10+
#include <sycl/sycl.hpp>
1111
template <typename T, int N> class sycl_subgr;
1212

13-
using namespace cl::sycl;
13+
using namespace sycl;
1414

1515
// TODO remove this workaround when clang will support correct generation of
1616
// half typename in integration header

SYCL/Sampler/normalized-mirror-nearest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
*/
1818

1919
#include "common.hpp"
20-
#include <CL/sycl.hpp>
20+
#include <sycl/sycl.hpp>
2121

22-
using namespace cl::sycl;
22+
using namespace sycl;
2323

2424
// pixel data-type for RGBA operations (which is the minimum image type)
2525
using pixelT = sycl::uint4;

SYCL/SubGroup/reduce.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "helper.hpp"
10-
#include <CL/sycl.hpp>
10+
#include <sycl/sycl.hpp>
1111

1212
template <typename... Ts> class sycl_subgr;
1313

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

1616
template <typename SpecializationKernelName, typename T, class BinaryOperation>
1717
void check_op(queue &Queue, T init, BinaryOperation op, bool skip_init = false,
@@ -67,7 +67,7 @@ void check_op(queue &Queue, T init, BinaryOperation op, bool skip_init = false,
6767
template <typename SpecializationKernelName, typename T>
6868
void check(queue &Queue, size_t G = 256, size_t L = 64) {
6969
// limit data range for half to avoid rounding issues
70-
if (std::is_same<T, cl::sycl::half>::value) {
70+
if (std::is_same<T, sycl::half>::value) {
7171
G = 64;
7272
L = 32;
7373
}

0 commit comments

Comments
 (0)