Skip to content

Commit 933c642

Browse files
authored
Merge pull request #2004 from IntelPython/backport-gh-2002
Backport gh-2002
2 parents 75c21ef + fd47767 commit 933c642

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ A number of adjustments were also made to improve performance of `dpctl` reducti
5959
* Corrected uses of NumPy constructors with `tensor.usm_ndarray` inputs in test suite [gh-1968](https://github.com/IntelPython/dpctl/pull/1968)
6060
* Fixed array API namespace inspection utilities showing `complex128` as a valid dtype on devices without double precision and `device` keywords not working with `dpctl.SyclQueue` or filter strings [gh-1979](https://github.com/IntelPython/dpctl/pull/1979)
6161
* Fixed a bug in `test_sycl_device_interface.cpp` which would cause compilation to fail with Clang version 20.0 [gh-1989](https://github.com/IntelPython/dpctl/pull/1989)
62+
* Fixed memory leaks in smart-pointer-managed USM temporaries in synchronizing kernel calls [gh-2002](https://github.com/IntelPython/dpctl/pull/2002)
6263

6364
### Maintenance
6465

dpctl/tensor/libtensor/source/accumulators.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ std::size_t py_mask_positions(const dpctl::tensor::usm_ndarray &mask,
210210
sycl::event::wait(host_task_events);
211211

212212
// ensure deleter of smart pointer is invoked with GIL released
213-
shape_strides_owner.release();
213+
shape_strides_owner.reset(nullptr);
214214
}
215215
throw std::runtime_error("Unexpected error");
216216
}
@@ -231,7 +231,7 @@ std::size_t py_mask_positions(const dpctl::tensor::usm_ndarray &mask,
231231

232232
sycl::event::wait(host_task_events);
233233
// ensure deleter of smart pointer is invoked with GIL released
234-
shape_strides_owner.release();
234+
shape_strides_owner.reset(nullptr);
235235
}
236236

237237
return total_set;
@@ -367,7 +367,7 @@ std::size_t py_cumsum_1d(const dpctl::tensor::usm_ndarray &src,
367367
sycl::event::wait(host_task_events);
368368

369369
// ensure USM deleter is called with GIL released
370-
shape_strides_owner.release();
370+
shape_strides_owner.reset(nullptr);
371371
}
372372
throw std::runtime_error("Unexpected error");
373373
}
@@ -387,7 +387,7 @@ std::size_t py_cumsum_1d(const dpctl::tensor::usm_ndarray &src,
387387
sycl::event::wait(host_task_events);
388388

389389
// ensure USM deleter is called with GIL released
390-
shape_strides_owner.release();
390+
shape_strides_owner.reset(nullptr);
391391
}
392392

393393
return total;

dpctl/tensor/libtensor/source/copy_numpy_ndarray_into_usm_ndarray.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ void copy_numpy_ndarray_into_usm_ndarray(
325325
dst_offset, depends, {copy_shape_ev});
326326

327327
// invoke USM deleter in smart pointer while GIL is held
328-
shape_strides_owner.release();
328+
shape_strides_owner.reset(nullptr);
329329
}
330330

331331
return;

0 commit comments

Comments
 (0)