Skip to content

Commit 8343912

Browse files
Make sure to free USM allocation for a temporary
1 parent b196e73 commit 8343912

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/pybind11/onemkl_gemv/sycl_gemm/_onemkl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ py::object py_dot_blocking(sycl::queue q,
497497
reinterpret_cast<const T *>(v2_typeless_ptr), 1, res_usm, depends);
498498
T res_v{};
499499
q.copy<T>(res_usm, &res_v, 1, {dot_ev}).wait_and_throw();
500+
sycl::free(res_usm, q);
500501
res = py::float_(res_v);
501502
}
502503
else if (v1_typenum == UAR_FLOAT) {
@@ -507,6 +508,7 @@ py::object py_dot_blocking(sycl::queue q,
507508
reinterpret_cast<const T *>(v2_typeless_ptr), 1, res_usm, depends);
508509
T res_v(0);
509510
q.copy<T>(res_usm, &res_v, 1, {dot_ev}).wait_and_throw();
511+
sycl::free(res_usm, q);
510512
res = py::float_(res_v);
511513
}
512514
else if (v1_typenum == UAR_CDOUBLE) {
@@ -517,6 +519,7 @@ py::object py_dot_blocking(sycl::queue q,
517519
reinterpret_cast<const T *>(v2_typeless_ptr), 1, res_usm, depends);
518520
T res_v{};
519521
q.copy<T>(res_usm, &res_v, 1, {dotc_ev}).wait_and_throw();
522+
sycl::free(res_usm, q);
520523
res = py::cast(res_v);
521524
}
522525
else if (v1_typenum == UAR_CFLOAT) {
@@ -527,6 +530,7 @@ py::object py_dot_blocking(sycl::queue q,
527530
reinterpret_cast<const T *>(v2_typeless_ptr), 1, res_usm, depends);
528531
T res_v{};
529532
q.copy<T>(res_usm, &res_v, 1, {dotc_ev}).wait_and_throw();
533+
sycl::free(res_usm, q);
530534
res = py::cast(res_v);
531535
}
532536
else {

0 commit comments

Comments
 (0)