-
Notifications
You must be signed in to change notification settings - Fork 794
Open
Labels
Description
Describe the bug
The sycl::stream class leaks multiple backend objects if the launch it is used in throws an exception. This can be illustrated with:
#include <sycl/sycl.hpp>
using namespace sycl;
int main() {
queue q = queue();
try {
const int N = 1;
q.submit([&](handler &cgh) {
sycl::stream kernelout(128, 64, cgh);
cgh.parallel_for<class test_kernel>(
nd_range<3>(range<3>{1, 1, N}, range<3>{1, 1, 16}),
[=](nd_item<3> itm) { kernelout << 1; });
}).wait();
return 1;
} catch (exception &E) {
return E.code() != errc::nd_range;
}
}Compile and run:
$ clang++ -fsycl test.cpp -o test.out
$ UR_L0_LEAKS_DEBUG=1 ./test.out
Check balance of create/destroy calls
----------------------------------------------------------
zeContextCreate = 1 \---> zeContextDestroy = 0 ---> LEAK = 1
zeCommandQueueCreate = 0 \---> zeCommandQueueDestroy = 0
zeModuleCreate = 1 \---> zeModuleDestroy = 0 ---> LEAK = 1
zeKernelCreate = 1 \---> zeKernelDestroy = 0 ---> LEAK = 1
zeEventPoolCreate = 1 \---> zeEventPoolDestroy = 0 ---> LEAK = 1
zeCommandListCreateImmediate = 2 |
zeCommandListCreate = 0 \---> zeCommandListDestroy = 0 ---> LEAK = 2
zeEventCreate = 1 \---> zeEventDestroy = 0 ---> LEAK = 1
zeFenceCreate = 0 \---> zeFenceDestroy = 0
zeImageCreate = 0 \---> zeImageDestroy = 0
zeSamplerCreate = 0 \---> zeSamplerDestroy = 0
zeMemAllocDevice = 2 |
zeMemAllocHost = 1 |
zeMemAllocShared = 2 \---> zeMemFree = 4 ---> LEAK = 1
To reproduce
- Include a code snippet that is as short as possible
- Specify the command which should be used to compile the program
- Specify the command which should be used to launch the program
- Indicate what is wrong and what was expected
Environment
- OS: [e.g Windows/Linux]
- Target device and vendor: [e.g. Intel GPU]
- DPC++ version: [e.g. commit hash or output of
clang++ --version] - Dependencies version: [e.g. the output of
sycl-ls --verbose]
Additional context
No response