Skip to content

Commit

Permalink
Merge pull request #2074 from cwpearson/performance/mkl-gemv-release
Browse files Browse the repository at this point in the history
Async matrix release for MKL >= 2023.2 in SpMV
  • Loading branch information
lucbv authored Dec 18, 2023
2 parents e439733 + 2728071 commit b50ba54
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,16 @@ struct spmv_onemkl_wrapper<false> {
auto ev_gemv =
oneapi::mkl::sparse::gemv(exec.sycl_queue(), mkl_mode, alpha, handle,
x.data(), beta, y.data(), {ev_opt});
// MKL 2023.2 and up make this release okay async even though it takes a
// pointer to a stack variable
#if INTEL_MKL_VERSION >= 20230200
oneapi::mkl::sparse::release_matrix_handle(exec.sycl_queue(), &handle,
{ev_gemv});
#else
auto ev_release = oneapi::mkl::sparse::release_matrix_handle(
exec.sycl_queue(), &handle, {ev_gemv});
ev_release.wait();
#endif
}
};

Expand Down Expand Up @@ -768,9 +775,16 @@ struct spmv_onemkl_wrapper<true> {
reinterpret_cast<std::complex<mag_type>*>(
const_cast<scalar_type*>(x.data())),
beta, reinterpret_cast<std::complex<mag_type>*>(y.data()), {ev_opt});
// MKL 2023.2 and up make this release okay async even though it takes a
// pointer to a stack variable
#if INTEL_MKL_VERSION >= 20230200
oneapi::mkl::sparse::release_matrix_handle(exec.sycl_queue(), &handle,
{ev_gemv});
#else
auto ev_release = oneapi::mkl::sparse::release_matrix_handle(
exec.sycl_queue(), &handle, {ev_gemv});
ev_release.wait();
#endif
}
};

Expand Down

0 comments on commit b50ba54

Please sign in to comment.