Skip to content

Commit c91a330

Browse files
committed
[SYCL][E2E] Fix target in host-task-two-queues
This commit fixes the target for accessors used in a host_task from implicit target::device to explicit target::host_task. Additionally, this PR removes the S = sycl alias and replaces the use of the old access::mode enum with the newer access_mode enum. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 64928c5 commit c91a330

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

sycl/test-e2e/HostInteropTask/host-task-two-queues.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,48 @@
55
#include <sycl/detail/core.hpp>
66
#include <vector>
77

8-
namespace S = sycl;
9-
108
#define WIDTH 5
119
#define HEIGHT 5
1210

1311
void test() {
14-
auto EH = [](S::exception_list EL) {
12+
auto EH = [](sycl::exception_list EL) {
1513
for (const std::exception_ptr &E : EL) {
1614
throw E;
1715
}
1816
};
1917

20-
S::queue Q1(EH);
21-
S::queue Q2(EH);
18+
sycl::queue Q1(EH);
19+
sycl::queue Q2(EH);
2220

2321
std::vector<int> DataA(WIDTH * HEIGHT, 2);
2422
std::vector<int> DataB(WIDTH * HEIGHT, 3);
2523
std::vector<int> DataC(WIDTH * HEIGHT, 1);
2624

27-
S::buffer<int, 2> BufA{DataA.data(), S::range<2>{WIDTH, HEIGHT}};
28-
S::buffer<int, 2> BufB{DataB.data(), S::range<2>{WIDTH, HEIGHT}};
29-
S::buffer<int, 2> BufC{DataC.data(), S::range<2>{WIDTH, HEIGHT}};
25+
sycl::buffer<int, 2> BufA{DataA.data(), sycl::range<2>{WIDTH, HEIGHT}};
26+
sycl::buffer<int, 2> BufB{DataB.data(), sycl::range<2>{WIDTH, HEIGHT}};
27+
sycl::buffer<int, 2> BufC{DataC.data(), sycl::range<2>{WIDTH, HEIGHT}};
3028

31-
auto CG1 = [&](S::handler &CGH) {
32-
auto AccA = BufA.get_access<S::access::mode::read>(CGH);
33-
auto AccB = BufB.get_access<S::access::mode::read>(CGH);
34-
auto AccC = BufC.get_access<S::access::mode::read_write>(CGH);
35-
auto Kernel = [=](S::nd_item<2> Item) {
29+
auto CG1 = [&](sycl::handler &CGH) {
30+
auto AccA = BufA.get_access<sycl::access_mode::read>(CGH);
31+
auto AccB = BufB.get_access<sycl::access_mode::read>(CGH);
32+
auto AccC = BufC.get_access<sycl::access_mode::read_write>(CGH);
33+
auto Kernel = [=](sycl::nd_item<2> Item) {
3634
size_t W = Item.get_global_id(0);
3735
size_t H = Item.get_global_id(1);
3836
AccC[W][H] += AccA[W][H] * AccB[W][H];
3937
};
40-
CGH.parallel_for<class K1>(S::nd_range<2>({WIDTH, HEIGHT}, {1, 1}), Kernel);
38+
CGH.parallel_for<class K1>(sycl::nd_range<2>({WIDTH, HEIGHT}, {1, 1}),
39+
Kernel);
4140
};
4241

43-
auto CG2 = [&](S::handler &CGH) {
44-
auto AccA = BufA.get_access<sycl::access::mode::read>(CGH);
45-
auto AccB = BufB.get_access<sycl::access::mode::read>(CGH);
46-
auto AccC = BufC.get_access<sycl::access::mode::read_write>(CGH);
42+
auto CG2 = [&](sycl::handler &CGH) {
43+
auto AccA =
44+
BufA.get_access<sycl::access_mode::read, sycl::target::host_task>(CGH);
45+
auto AccB =
46+
BufB.get_access<sycl::access_mode::read, sycl::target::host_task>(CGH);
47+
auto AccC =
48+
BufC.get_access<sycl::access_mode::read_write, sycl::target::host_task>(
49+
CGH);
4750

4851
CGH.host_task([=] {
4952
for (size_t I = 0; I < WIDTH; ++I)

0 commit comments

Comments
 (0)