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

Commit 8aafdab

Browse files
committed
[SYCL] Adds regression test for reduction resource leak
Select variants of reductions currently leak additional resources, such as auxiliary buffers. This commit adds a regression test to ensure this leak does not resurface. Signed-off-by: Steffen Larsen <[email protected]>
1 parent a4baf32 commit 8aafdab

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// REQUIRES: level_zero
2+
// RUN: env ZE_DEBUG=4 %GPU_RUN_PLACEHOLDER %t.out 2>&1 | FileCheck --implicit-check-not %s "LEAK"
3+
4+
// Tests that additional resources required by discard_write reductions od not
5+
// leak.
6+
7+
#include <CL/sycl.hpp>
8+
9+
using namespace cl::sycl;
10+
11+
int main() {
12+
queue Q;
13+
14+
nd_range<1> NDRange(range<1>{49 * 5}, range<1>{49});
15+
std::plus<> BOp;
16+
17+
buffer<int, 1> OutBuf(1);
18+
buffer<int, 1> InBuf(49 * 5);
19+
Q.submit([&](handler &CGH) {
20+
auto In = InBuf.get_access<access::mode::read>(CGH);
21+
auto Out = OutBuf.get_access<access::mode::discard_write>(CGH);
22+
auto Redu = ext::oneapi::reduction(Out, 0, BOp);
23+
CGH.parallel_for<class DiscardSum>(
24+
NDRange, Redu, [=](nd_item<1> NDIt, auto &Sum) {
25+
Sum.combine(In[NDIt.get_global_linear_id()]);
26+
});
27+
});
28+
return 0;
29+
}

0 commit comments

Comments
 (0)