Open
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.