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

Commit db050ff

Browse files
[SYCL] E2E test for Level Zero device-scope events (#456)
Signed-off-by: Sergey V Maslov <sergey.v.maslov@intel.com>
1 parent 9c1b5e2 commit db050ff

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// REQUIRES: gpu, level_zero
2+
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
4+
// RUN: env SYCL_PI_LEVEL_ZERO_DEVICE_SCOPE_EVENTS=1 SYCL_PI_TRACE=2 ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
5+
6+
// Checks that with L0 device-scope events enabled the only host-visible L0
7+
// event created is at the end of all kernels submission, when host waits for
8+
// the last kernel's event.
9+
//
10+
// CHECK-LABEL: Submitted all kernels
11+
// CHECK: ---> piEventsWait(
12+
// CHECK-NEXT: <unknown> : 1
13+
// CHECK: ZE ---> zeEventCreate(ZeEventPool, &ZeEventDesc, &ZeHostVisibleEvent)
14+
// CHECK: ZE ---> zeCommandListAppendWaitOnEvents(CommandList->first, 1, &ZeEvent)
15+
// CHECK-NEXT: ZE ---> zeCommandListAppendSignalEvent(CommandList->first,
16+
// ZeHostVisibleEvent)
17+
// CHECK: Completed all kernels
18+
19+
#include <CL/sycl.hpp>
20+
21+
int main(int argc, char **argv) {
22+
cl::sycl::gpu_selector device_selector;
23+
cl::sycl::queue queue(device_selector);
24+
25+
int N = (argc >= 2 ? std::atoi(argv[1]) : 100);
26+
std::cout << N << " kernels" << std::endl;
27+
28+
cl::sycl::event e; // completed event
29+
for (int i = 0; i < N; i++) {
30+
e = queue.submit([&](cl::sycl::handler &h) {
31+
h.depends_on(e);
32+
h.single_task<class kernel>([=] {});
33+
});
34+
} // for
35+
36+
std::cout << "Submitted all kernels" << std::endl;
37+
e.wait(); // Waits for the last kernel to complete.
38+
std::cout << "Completed all kernels" << std::endl;
39+
return 0;
40+
}

0 commit comments

Comments
 (0)