8000 L0 adapter leaks events when no output event is given · Issue #1947 · oneapi-src/unified-runtime · GitHub
[go: up one dir, main page]

Skip to content
L0 adapter leaks events when no output event is given #1947
Open
@steffenlarsen

Description

@steffenlarsen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglevel-zeroL0 adapter specific issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0