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

Commit a7873d0

Browse files
committed
[SYCL] Add test for checking that context is destroyed after expected exception
This patch adds new regression test for checking that memory leak in SYCL context is gone after throwing some expected exception
1 parent 91fd21d commit a7873d0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// REQUIRES: gpu
2+
3+
// RUN: %clangxx -fsycl %s -o %t.out
4+
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
5+
6+
#include <CL/sycl.hpp>
7+
8+
int main() {
9+
const auto GlobalRange = 1;
10+
const auto LocalRange = 2;
11+
12+
sycl::queue myQueue{sycl::cpu_selector{}, [](sycl::exception_list elist) {
13+
for (auto e : elist)
14+
std::rethrow_exception(e);
15+
}};
16+
17+
try {
18+
myQueue.parallel_for<class myclass>(
19+
sycl::nd_range<1>{sycl::range<1>(GlobalRange),
20+
sycl::range<1>(LocalRange)},
21+
[=](sycl::nd_item<1> idx) {});
22+
myQueue.wait_and_throw();
23+
assert(false && "Expected exception was not caught");
24+
} catch (sycl::exception &e) {
25+
}
26+
27+
return 0;
28+
}
29+
30+
// CHECK:---> piContextRelease

0 commit comments

Comments
 (0)