oneapi-src / oneapi-src/unified-runtime
L0 adapter leaks events when no output event is given
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 57
- Forks
- 120
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 1
Description
It seems that the L0 adapter does not correctly release "internal" events, i.e. events that are used by enqueued commands when there are no output event given the the API call. To illustrate this, the following SYCL code leaks an event:
#include <sycl/sycl.hpp>
int main() {
sycl::queue Queue{{sycl::property::queue::in_order()}};
sycl::ext::oneapi::experimental::single_task(Queue, []() {});
Queue.wait();
return 0;
}
When run with UR_L0_LEAKS_DEBUG=1 the output is:
Check balance of create/destroy calls
----------------------------------------------------------
zeContextCreate = 1 \---> zeContextDestroy = 1
zeCommandQueueCreate = 0 \---> zeCommandQueueDestroy = 0
zeModuleCreate = 1 \---> zeModuleDestroy = 1
zeKernelCreate = 1 \---> zeKernelDestroy = 1
zeEventPoolCreate = 1 \---> zeEventPoolDestroy = 1
zeCommandListCreateImmediate = 2 |
zeCommandListCreate = 0 \---> zeCommandListDestroy = 2
zeEventCreate = 1 \---> zeEventDestroy = 0 ---> LEAK = 1
zeFenceCreate = 0 \---> zeFenceDestroy = 0
zeImageCreate = 0 \---> zeImageDestroy = 0
zeSamplerCreate = 0 \---> zeSamplerDestroy = 0
zeMemAllocDevice = 1 |
zeMemAllocHost = 1 |
zeMemAllocShared = 2 \---> zeMemFree = 4
terminate called after throwing an instance of 'sycl::_V1::exception'
what(): Native API failed. Native API returns: 11 (UR_RESULT_ERROR_INVALID_MEM_OBJECT)
which shows exactly one event creation and zero releases, corresponding to the internal event for the kernel enqueue. Note that this seems to affect most (if not all) enqueue functions that have an optional output event.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the L0 adapter paths used by the supplied SYCL in_order queue example, focusing on enqueue functions with optional output events. Run the example with UR_L0_LEAKS_DEBUG=1 and verify that internal events are released when no output event is supplied, with no event leak reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100