Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions SYCL/Regression/reduction_resource_leak.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// REQUIRES: level_zero
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env ZE_DEBUG=4 %GPU_RUN_PLACEHOLDER %t.out 2>&1 | FileCheck --implicit-check-not "LEAK" %s

// Tests that additional resources required by discard_write reductions od not
// leak.

#include <CL/sycl.hpp>

using namespace cl::sycl;

int main() {
queue Q;

nd_range<1> NDRange(range<1>{49 * 5}, range<1>{49});
std::plus<> BOp;

buffer<int, 1> OutBuf(1);
buffer<int, 1> InBuf(49 * 5);
Q.submit([&](handler &CGH) {
auto In = InBuf.get_access<access::mode::read>(CGH);
auto Out = OutBuf.get_access<access::mode::discard_write>(CGH);
auto Redu = ext::oneapi::reduction(Out, 0, BOp);
CGH.parallel_for<class DiscardSum>(
NDRange, Redu, [=](nd_item<1> NDIt, auto &Sum) {
Sum.combine(In[NDIt.get_global_linear_id()]);
});
});
return 0;
}