llvm
8456b01e - [SYCL] Fix memory leak for sub-devices (#20370)

Commit
206 days ago
[SYCL] Fix memory leak for sub-devices (#20370) Current `device_impl` implementation assumes shared ownership and manages the handle via `urRetain`/`urRelease` in constructor/destructor. Whenever we get temporary device handles via `urDeviceGet`/`urDevicePartition` (which implicitly return device handle with `refcount == 1`) and wrap those handles in `device_impl`, we have to release temporary handles at the end of scope to avoid memory leak. It's done here for devices: https://github.com/intel/llvm/blob/6b29cf120c267118dc8ad737e54e8b844bfb4e06/sycl/source/detail/platform_impl.cpp#L560-L563 Same needs to be done when we create sub-devices. But currently we were missing release calls for temporary handles after creating `device_impl` objects wrapping those handles. This PR fixes that issue by releasing temporary handles at the end of the scope.
Author
Parents
Loading