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

Commit f5bdd8c

Browse files
committed
Add USM test case
Signed-off-by: Steffen Larsen <[email protected]>
1 parent b0a4e76 commit f5bdd8c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// REQUIRES: level_zero, level_zero_dev_kit
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out
3+
// RUN: env SYCL_DEVICE_FILTER=level_zero ZE_DEBUG=4 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
4+
//
5+
// CHECK-NOT: LEAK
6+
7+
// Tests that additional resources required by USM reductions do not leak.
8+
9+
#include <CL/sycl.hpp>
10+
11+
using namespace cl::sycl;
12+
13+
int main() {
14+
queue Q;
15+
device Dev = Q.get_device();
16+
context Ctx = Q.get_context();
17+
18+
nd_range<1> NDRange(range<1>{49 * 5}, range<1>{49});
19+
std::plus<> BOp;
20+
21+
int *Out = malloc_shared<int>(1, Dev, Ctx);
22+
int *In = malloc_shared<int>(49 * 5, Dev, Ctx);
23+
Q.submit([&](handler &CGH) {
24+
auto Redu = ext::oneapi::reduction(Out, 0, BOp);
25+
CGH.parallel_for<class USMSum>(
26+
NDRange, Redu, [=](nd_item<1> NDIt, auto &Sum) {
27+
Sum.combine(In[NDIt.get_global_linear_id()]);
28+
});
29+
}).wait();
30+
return 0;
31+
}

0 commit comments

Comments
 (0)