diff --git a/SYCL/Basic/host-task-dependency.cpp b/SYCL/Basic/host-task-dependency.cpp index 961d1f921c..1a6e174d00 100644 --- a/SYCL/Basic/host-task-dependency.cpp +++ b/SYCL/Basic/host-task-dependency.cpp @@ -19,7 +19,7 @@ namespace S = cl::sycl; -template class NameGen; +template class NameGen; struct Context { std::atomic_bool Flag; @@ -31,7 +31,6 @@ struct Context { std::condition_variable CV; }; -template S::event HostTask_CopyBuf1ToBuf2(Context *Ctx) { S::event Event = Ctx->Queue.submit([&](S::handler &CGH) { S::accessor @@ -53,15 +52,12 @@ S::event HostTask_CopyBuf1ToBuf2(Context *Ctx) { } }; - if constexpr (UseSYCL2020HostTask) - CGH.host_task(CopierHostTask); - else - CGH.codeplay_host_task(CopierHostTask); + CGH.host_task(CopierHostTask); }); return Event; } -template void Thread1Fn(Context *Ctx) { +void Thread1Fn(Context *Ctx) { // 0. initialize resulting buffer with apriori wrong result { S::accessor @@ -98,11 +94,11 @@ template void Thread1Fn(Context *Ctx) { GeneratorAcc[Idx] = Idx; }; - CGH.single_task>(GeneratorKernel); + CGH.single_task>(GeneratorKernel); }); // 2. submit host task writing from buf 1 to buf 2 - S::event HostTaskEvent = HostTask_CopyBuf1ToBuf2(Ctx); + S::event HostTaskEvent = HostTask_CopyBuf1ToBuf2(Ctx); // 3. submit simple task to move data between two buffers Ctx->Queue.submit([&](S::handler &CGH) { @@ -119,7 +115,7 @@ template void Thread1Fn(Context *Ctx) { DstAcc[Idx] = SrcAcc[Idx]; }; - CGH.single_task>(CopierKernel); + CGH.single_task>(CopierKernel); }); // 4. check data in buffer #3 @@ -148,7 +144,7 @@ void Thread2Fn(Context *Ctx) { assert(Ctx->Flag.load()); } -template void test() { +void test() { auto EH = [](S::exception_list EL) { for (const std::exception_ptr &E : EL) { throw E; @@ -160,8 +156,7 @@ template void test() { Context Ctx{{false}, Queue, {10}, {10}, {10}, {}, {}}; // 0. setup: thread 1 T1: exec smth; thread 2 T2: waits; init flag F = false - auto A1 = - std::async(std::launch::async, Thread1Fn, &Ctx); + auto A1 = std::async(std::launch::async, Thread1Fn, &Ctx); auto A2 = std::async(std::launch::async, Thread2Fn, &Ctx); A1.get(); @@ -186,8 +181,7 @@ template void test() { } int main() { - test(); - test(); + test(); return 0; } @@ -203,16 +197,6 @@ int main() { // CHECK: Copier // CHECK:---> piEnqueueKernelLaunch( -// CHECK:---> piKernelCreate( -// CHECK: NameGen -// CHECK:---> piEnqueueKernelLaunch( -// prepare for host task -// CHECK:---> piEnqueueMemBuffer{{Map|Read}}( -// launch of Copier kernel -// CHECK:---> piKernelCreate( -// CHECK: Copier -// CHECK:---> piEnqueueKernelLaunch( - // TODO need to check for piEventsWait as "wait on dependencies of host task". // At the same time this piEventsWait may occur anywhere after // piEnqueueMemBufferMap ("prepare for host task"). diff --git a/SYCL/HostInteropTask/host-task-dependency2.cpp b/SYCL/HostInteropTask/host-task-dependency2.cpp index bde5991a05..72ad4cf229 100644 --- a/SYCL/HostInteropTask/host-task-dependency2.cpp +++ b/SYCL/HostInteropTask/host-task-dependency2.cpp @@ -24,7 +24,7 @@ static auto EH = [](exception_list EL) { // Host-task depending on another host-task via handler::depends_on() only // should not hang -template void test(queue &Q, size_t Count) { +void test(queue &Q, size_t Count) { static constexpr size_t BufferSize = 10 * 1024; buffer B0{range<1>{BufferSize}}; @@ -48,10 +48,7 @@ template void test(queue &Q, size_t Count) { Acc1[0] = 2 * Idx; Acc2[0] = 3 * Idx; }; - if constexpr (UseSYCL2020HostTask) - CGH.host_task(Func); - else - CGH.codeplay_host_task(Func); + CGH.host_task(Func); }); // This host task is going to depend on blocked empty node of the first @@ -66,10 +63,7 @@ template void test(queue &Q, size_t Count) { Acc2[1] = 1 * Idx; Acc3[1] = 2 * Idx; }; - if constexpr (UseSYCL2020HostTask) - CGH.host_task(Func); - else - CGH.codeplay_host_task(Func); + CGH.host_task(Func); }); // This host-task only depends on the second host-task via @@ -87,10 +81,7 @@ template void test(queue &Q, size_t Count) { Acc4[2] = 1 * Idx; Acc5[2] = 2 * Idx; }; - if constexpr (UseSYCL2020HostTask) - CGH.host_task(Func); - else - CGH.codeplay_host_task(Func); + CGH.host_task(Func); }); } @@ -103,7 +94,6 @@ int main(int Argc, const char *Argv[]) { Count = std::stoi(Argv[1]); queue Q(EH); - test(Q, Count); - test(Q, Count); + test(Q, Count); return 0; } diff --git a/SYCL/HostInteropTask/host-task.cpp b/SYCL/HostInteropTask/host-task.cpp index 6a86a6cd94..d9823f7e9e 100644 --- a/SYCL/HostInteropTask/host-task.cpp +++ b/SYCL/HostInteropTask/host-task.cpp @@ -30,22 +30,19 @@ static auto EH = [](exception_list EL) { template class NameGen; // Check that a single host-task with a buffer will work -template void test1(queue &Q) { +void test1(queue &Q) { buffer Buffer{BUFFER_SIZE}; Q.submit([&](handler &CGH) { auto Acc = Buffer.get_access(CGH); - if constexpr (UseSYCL2020HostTask) - CGH.host_task([=] { /* A no-op */ }); - else - CGH.codeplay_host_task([=] { /* A no-op */ }); + CGH.host_task([=] { /* A no-op */ }); }); Q.wait_and_throw(); } // Check that a host task after the kernel (deps via buffer) will work -template void test2(queue &Q) { +void test2(queue &Q) { buffer Buffer1{BUFFER_SIZE}; buffer Buffer2{BUFFER_SIZE}; @@ -53,8 +50,7 @@ template void test2(queue &Q) { auto Acc = Buffer1.template get_access(CGH); auto Kernel = [=](item<1> Id) { Acc[Id] = 123; }; - CGH.parallel_for>( - Acc.get_count(), Kernel); + CGH.parallel_for>(Acc.get_count(), Kernel); }); Q.submit([&](handler &CGH) { @@ -65,10 +61,7 @@ template void test2(queue &Q) { for (size_t Idx = 0; Idx < AccDst.get_count(); ++Idx) AccDst[Idx] = AccSrc[Idx]; }; - if constexpr (UseSYCL2020HostTask) - CGH.host_task(Func); - else - CGH.codeplay_host_task(Func); + CGH.host_task(Func); }); { @@ -85,7 +78,7 @@ template void test2(queue &Q) { // Host-task depending on another host-task via both buffers and // handler::depends_on() should not hang -template void test3(queue &Q) { +void test3(queue &Q) { static constexpr size_t BufferSize = 10 * 1024; buffer B0{range<1>{BufferSize}}; @@ -134,10 +127,7 @@ template void test3(queue &Q) { X ^= reinterpret_cast(&Acc8[Idx + 8]); X ^= reinterpret_cast(&Acc9[Idx + 9]); }; - if constexpr (UseSYCL2020HostTask) - CGH.host_task(Func); - else - CGH.codeplay_host_task(Func); + CGH.host_task(Func); }); Deps = {E}; @@ -161,16 +151,13 @@ int main(int Argc, const char *Argv[]) { queue Q(EH); switch (TestIdx) { case 1: - test1(Q); - test1(Q); + test1(Q); break; case 2: - test2(Q); - test2(Q); + test2(Q); break; case 3: - test3(Q); - test3(Q); + test3(Q); break; default: return 1;