Skip to content

OneDNN with Level Zero GPU runtime leaks memory #4989

@jkasprza

Description

@jkasprza

Summary

When running OneDNN with Level Zero GPU runtime and enabling Level Zero validation layers memory leaks are detected. Originally this issue was observed during OpenVINO inference, but I was able to reproduce it with benchdnn.

Version

OneDNN githash: 470e87e

Steps to reproduce

  1. Build OneDNN with L0 GPU runtime -DDNNL_GPU_RUNTIME=ZE -DONEDNN_BUILD_GRAPH=OFF
  2. Setup environment variables to enable L0 validation layers with leak detector
ZE_ENABLE_VALIDATION_LAYER=1
ZEL_ENABLE_BASIC_LEAK_CHECKER=1
  1. Run any GPU primitive with benchdnn. For example:
benchdnn --matmul --engine=gpu --stag=abc --dtag=abc --wtag=cab --dt=f32 --bia-dt=f32 --bia_mask=4 --attr-scratchpad=user 1x30x512:1x512x37

Observed behavior

Benchdnn executes primitive and finishes successfully but leaks are detected.

ZE_ENABLE_VALIDATION_LAYER=1 ZEL_ENABLE_BASIC_LEAK_CHECKER=1 ./benchdnn --matmul --engine=gpu --stag=abc --dtag=abc --wtag=cab --dt=f32 --bia-dt=f32 --bia_mask=4 --attr-scratchpad=user 1x30x512:1x512x37
0:PASSED (134 ms) __REPRO: --matmul --engine=gpu --stag=abc --wtag=cab --dtag=abc --bia-dt=f32 --bia_mask=4 --attr-scratchpad=user 1x30x512:1x512x37
============================================================
= Implementation statistics (--summary=no-impl to disable) =
============================================================
| jit:gemm:any : 1 (100%)                                  |
============================================================
tests:1 passed:1 skipped:0 mistrusted:0 unimplemented:0 invalid_arguments:0 failed:0 listed:0
total: 0.14s; create_pd: 0.02s (13%); create_prim: 0.00s (0%); fill: 0.00s (2%); execute: 0.00s (1%); compute_ref: 0.00s (0%); compare: 0.00s (0%);
Check balance of create/destroy calls
----------------------------------------------------------
               zeContextCreate = 1     \--->              zeContextDestroy = 0     ---> LEAK = 1
          zeCommandQueueCreate = 0     \--->         zeCommandQueueDestroy = 0
                zeModuleCreate = 2     \--->               zeModuleDestroy = 1     ---> LEAK = 1
                zeKernelCreate = 2     \--->               zeKernelDestroy = 1     ---> LEAK = 1
             zeEventPoolCreate = 0     \--->            zeEventPoolDestroy = 0
  zeCommandListCreateImmediate = 2     |
           zeCommandListCreate = 0     \--->          zeCommandListDestroy = 2
                 zeEventCreate = 0     |
   zexCounterBasedEventCreate2 = 0     \--->                zeEventDestroy = 0
                 zeFenceCreate = 0     \--->                zeFenceDestroy = 0
                 zeImageCreate = 0     |
          zeImageViewCreateExt = 0     \--->                zeImageDestroy = 0
               zeSamplerCreate = 0     \--->              zeSamplerDestroy = 0
              zeMemAllocDevice = 4     |
                zeMemAllocHost = 8     |
              zeMemAllocShared = 0     \--->                     zeMemFree = 12
                                       \--->                  zeMemFreeExt = 0

Expected behavior

OneDNN should correctly handle and free all owned resources.

Metadata

Metadata

Assignees

Labels

bugA confirmed library bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions