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

Commit 446adc0

Browse files
authored
[SYCL] Removed handler::codeplay_host_task (#428)
Signed-off-by: mdimakov <[email protected]>
1 parent b360fac commit 446adc0

File tree

3 files changed

+24
-63
lines changed

3 files changed

+24
-63
lines changed

SYCL/Basic/host-task-dependency.cpp

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace S = cl::sycl;
2121

22-
template <typename T, bool B> class NameGen;
22+
template <typename T> class NameGen;
2323

2424
struct Context {
2525
std::atomic_bool Flag;
@@ -31,7 +31,6 @@ struct Context {
3131
std::condition_variable CV;
3232
};
3333

34-
template <bool UseSYCL2020HostTask>
3534
S::event HostTask_CopyBuf1ToBuf2(Context *Ctx) {
3635
S::event Event = Ctx->Queue.submit([&](S::handler &CGH) {
3736
S::accessor<int, 1, S::access::mode::read, S::access::target::host_buffer>
@@ -53,15 +52,12 @@ S::event HostTask_CopyBuf1ToBuf2(Context *Ctx) {
5352
}
5453
};
5554

56-
if constexpr (UseSYCL2020HostTask)
57-
CGH.host_task(CopierHostTask);
58-
else
59-
CGH.codeplay_host_task(CopierHostTask);
55+
CGH.host_task(CopierHostTask);
6056
});
6157
return Event;
6258
}
6359

64-
template <bool UseSYCL2020HostTask> void Thread1Fn(Context *Ctx) {
60+
void Thread1Fn(Context *Ctx) {
6561
// 0. initialize resulting buffer with apriori wrong result
6662
{
6763
S::accessor<int, 1, S::access::mode::write, S::access::target::host_buffer>
@@ -98,11 +94,11 @@ template <bool UseSYCL2020HostTask> void Thread1Fn(Context *Ctx) {
9894
GeneratorAcc[Idx] = Idx;
9995
};
10096

101-
CGH.single_task<NameGen<class Gen, UseSYCL2020HostTask>>(GeneratorKernel);
97+
CGH.single_task<NameGen<class Gen>>(GeneratorKernel);
10298
});
10399

104100
// 2. submit host task writing from buf 1 to buf 2
105-
S::event HostTaskEvent = HostTask_CopyBuf1ToBuf2<UseSYCL2020HostTask>(Ctx);
101+
S::event HostTaskEvent = HostTask_CopyBuf1ToBuf2(Ctx);
106102

107103
// 3. submit simple task to move data between two buffers
108104
Ctx->Queue.submit([&](S::handler &CGH) {
@@ -119,7 +115,7 @@ template <bool UseSYCL2020HostTask> void Thread1Fn(Context *Ctx) {
119115
DstAcc[Idx] = SrcAcc[Idx];
120116
};
121117

122-
CGH.single_task<NameGen<class Copier, UseSYCL2020HostTask>>(CopierKernel);
118+
CGH.single_task<NameGen<class Copier>>(CopierKernel);
123119
});
124120

125121
// 4. check data in buffer #3
@@ -148,7 +144,7 @@ void Thread2Fn(Context *Ctx) {
148144
assert(Ctx->Flag.load());
149145
}
150146

151-
template <bool UseSYCL2020HostTask> void test() {
147+
void test() {
152148
auto EH = [](S::exception_list EL) {
153149
for (const std::exception_ptr &E : EL) {
154150
throw E;
@@ -160,8 +156,7 @@ template <bool UseSYCL2020HostTask> void test() {
160156
Context Ctx{{false}, Queue, {10}, {10}, {10}, {}, {}};
161157

162158
// 0. setup: thread 1 T1: exec smth; thread 2 T2: waits; init flag F = false
163-
auto A1 =
164-
std::async(std::launch::async, Thread1Fn<UseSYCL2020HostTask>, &Ctx);
159+
auto A1 = std::async(std::launch::async, Thread1Fn, &Ctx);
165160
auto A2 = std::async(std::launch::async, Thread2Fn, &Ctx);
166161

167162
A1.get();
@@ -186,8 +181,7 @@ template <bool UseSYCL2020HostTask> void test() {
186181
}
187182

188183
int main() {
189-
test<true>();
190-
test<false>();
184+
test();
191185

192186
return 0;
193187
}
@@ -203,16 +197,6 @@ int main() {
203197
// CHECK: Copier
204198
// CHECK:---> piEnqueueKernelLaunch(
205199

206-
// CHECK:---> piKernelCreate(
207-
// CHECK: NameGen
208-
// CHECK:---> piEnqueueKernelLaunch(
209-
// prepare for host task
210-
// CHECK:---> piEnqueueMemBuffer{{Map|Read}}(
211-
// launch of Copier kernel
212-
// CHECK:---> piKernelCreate(
213-
// CHECK: Copier
214-
// CHECK:---> piEnqueueKernelLaunch(
215-
216200
// TODO need to check for piEventsWait as "wait on dependencies of host task".
217201
// At the same time this piEventsWait may occur anywhere after
218202
// piEnqueueMemBufferMap ("prepare for host task").

SYCL/HostInteropTask/host-task-dependency2.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static auto EH = [](exception_list EL) {
2424

2525
// Host-task depending on another host-task via handler::depends_on() only
2626
// should not hang
27-
template <bool UseSYCL2020HostTask> void test(queue &Q, size_t Count) {
27+
void test(queue &Q, size_t Count) {
2828
static constexpr size_t BufferSize = 10 * 1024;
2929

3030
buffer<int, 1> B0{range<1>{BufferSize}};
@@ -48,10 +48,7 @@ template <bool UseSYCL2020HostTask> void test(queue &Q, size_t Count) {
4848
Acc1[0] = 2 * Idx;
4949
Acc2[0] = 3 * Idx;
5050
};
51-
if constexpr (UseSYCL2020HostTask)
52-
CGH.host_task(Func);
53-
else
54-
CGH.codeplay_host_task(Func);
51+
CGH.host_task(Func);
5552
});
5653

5754
// This host task is going to depend on blocked empty node of the first
@@ -66,10 +63,7 @@ template <bool UseSYCL2020HostTask> void test(queue &Q, size_t Count) {
6663
Acc2[1] = 1 * Idx;
6764
Acc3[1] = 2 * Idx;
6865
};
69-
if constexpr (UseSYCL2020HostTask)
70-
CGH.host_task(Func);
71-
else
72-
CGH.codeplay_host_task(Func);
66+
CGH.host_task(Func);
7367
});
7468

7569
// This host-task only depends on the second host-task via
@@ -87,10 +81,7 @@ template <bool UseSYCL2020HostTask> void test(queue &Q, size_t Count) {
8781
Acc4[2] = 1 * Idx;
8882
Acc5[2] = 2 * Idx;
8983
};
90-
if constexpr (UseSYCL2020HostTask)
91-
CGH.host_task(Func);
92-
else
93-
CGH.codeplay_host_task(Func);
84+
CGH.host_task(Func);
9485
});
9586
}
9687

@@ -103,7 +94,6 @@ int main(int Argc, const char *Argv[]) {
10394
Count = std::stoi(Argv[1]);
10495

10596
queue Q(EH);
106-
test<true>(Q, Count);
107-
test<false>(Q, Count);
97+
test(Q, Count);
10898
return 0;
10999
}

SYCL/HostInteropTask/host-task.cpp

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,27 @@ static auto EH = [](exception_list EL) {
3030
template <typename T, bool B> class NameGen;
3131

3232
// Check that a single host-task with a buffer will work
33-
template <bool UseSYCL2020HostTask> void test1(queue &Q) {
33+
void test1(queue &Q) {
3434
buffer<int, 1> Buffer{BUFFER_SIZE};
3535

3636
Q.submit([&](handler &CGH) {
3737
auto Acc = Buffer.get_access<mode::write>(CGH);
38-
if constexpr (UseSYCL2020HostTask)
39-
CGH.host_task([=] { /* A no-op */ });
40-
else
41-
CGH.codeplay_host_task([=] { /* A no-op */ });
38+
CGH.host_task([=] { /* A no-op */ });
4239
});
4340

4441
Q.wait_and_throw();
4542
}
4643

4744
// Check that a host task after the kernel (deps via buffer) will work
48-
template <bool UseSYCL2020HostTask> void test2(queue &Q) {
45+
void test2(queue &Q) {
4946
buffer<int, 1> Buffer1{BUFFER_SIZE};
5047
buffer<int, 1> Buffer2{BUFFER_SIZE};
5148

5249
Q.submit([&](handler &CGH) {
5350
auto Acc = Buffer1.template get_access<mode::write>(CGH);
5451

5552
auto Kernel = [=](item<1> Id) { Acc[Id] = 123; };
56-
CGH.parallel_for<NameGen<class Test6Init, UseSYCL2020HostTask>>(
57-
Acc.get_count(), Kernel);
53+
CGH.parallel_for<NameGen<class Test6Init, true>>(Acc.get_count(), Kernel);
5854
});
5955

6056
Q.submit([&](handler &CGH) {
@@ -65,10 +61,7 @@ template <bool UseSYCL2020HostTask> void test2(queue &Q) {
6561
for (size_t Idx = 0; Idx < AccDst.get_count(); ++Idx)
6662
AccDst[Idx] = AccSrc[Idx];
6763
};
68-
if constexpr (UseSYCL2020HostTask)
69-
CGH.host_task(Func);
70-
else
71-
CGH.codeplay_host_task(Func);
64+
CGH.host_task(Func);
7265
});
7366

7467
{
@@ -85,7 +78,7 @@ template <bool UseSYCL2020HostTask> void test2(queue &Q) {
8578

8679
// Host-task depending on another host-task via both buffers and
8780
// handler::depends_on() should not hang
88-
template <bool UseSYCL2020HostTask> void test3(queue &Q) {
81+
void test3(queue &Q) {
8982
static constexpr size_t BufferSize = 10 * 1024;
9083

9184
buffer<int, 1> B0{range<1>{BufferSize}};
@@ -134,10 +127,7 @@ template <bool UseSYCL2020HostTask> void test3(queue &Q) {
134127
X ^= reinterpret_cast<uint64_t>(&Acc8[Idx + 8]);
135128
X ^= reinterpret_cast<uint64_t>(&Acc9[Idx + 9]);
136129
};
137-
if constexpr (UseSYCL2020HostTask)
138-
CGH.host_task(Func);
139-
else
140-
CGH.codeplay_host_task(Func);
130+
CGH.host_task(Func);
141131
});
142132

143133
Deps = {E};
@@ -161,16 +151,13 @@ int main(int Argc, const char *Argv[]) {
161151
queue Q(EH);
162152
switch (TestIdx) {
163153
case 1:
164-
test1<true>(Q);
165-
test1<false>(Q);
154+
test1(Q);
166155
break;
167156
case 2:
168-
test2<true>(Q);
169-
test2<false>(Q);
157+
test2(Q);
170158
break;
171159
case 3:
172-
test3<true>(Q);
173-
test3<false>(Q);
160+
test3(Q);
174161
break;
175162
default:
176163
return 1;

0 commit comments

Comments
 (0)