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

Commit 1a137e5

Browse files
authored
[SYCL] Test for event destruction (#574)
Signed-off-by: mdimakov <[email protected]>
1 parent db83430 commit 1a137e5

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

SYCL/Regression/event_destruction.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
3+
// RUN: %HOST_RUN_PLACEHOLDER %t.out
4+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
5+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
6+
7+
//==--------------- event_destruction.cpp - SYCL event test ----------------==//
8+
//
9+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
10+
// See https://llvm.org/LICENSE.txt for license information.
11+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12+
//
13+
//===----------------------------------------------------------------------===//
14+
#include <CL/sycl.hpp>
15+
#include <iostream>
16+
17+
const size_t ITERS = 100000;
18+
19+
// The test checks that that event destruction does not lead to stack overflow
20+
21+
int main() {
22+
cl::sycl::default_selector S;
23+
cl::sycl::queue Q(S);
24+
cl::sycl::buffer<int, 1> Buf(3000);
25+
for (size_t Idx = 0; Idx < ITERS; ++Idx) {
26+
auto Event = Q.submit([&](cl::sycl::handler &cgh) {
27+
auto Acc = Buf.get_access<cl::sycl::access::mode::write>(cgh);
28+
cgh.single_task([=]() {
29+
for (size_t I = 0; I < 2000; I++) {
30+
Acc[I] = I * I + 2000;
31+
}
32+
});
33+
});
34+
Event.wait();
35+
}
36+
}

0 commit comments

Comments
 (0)