Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

* Fixed `flags[key]` of `dpnp.ndarray` and `dpnp.tensor.usm_ndarray` to raise `KeyError` for an unknown key [#3141](https://github.com/IntelPython/dpnp/pull/3141)
* Released the GIL around the oneMKL VM calls in the VM extension, which deadlocked on an in-order queue of a CPU device [#3156](https://github.com/IntelPython/dpnp/pull/3156)

### Security

Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/abs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event abs_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::abs(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/acos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event acos_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::acos(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/acosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event acosh_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::acosh(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ static sycl::event add_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::add(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ static sycl::event arg_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::arg(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/asin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event asin_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::asin(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/asinh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event asinh_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::asinh(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/atan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event atan_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::atan(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/atan2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static sycl::event atan2_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::atan2(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/atanh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event atanh_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::atanh(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/cbrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event cbrt_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::cbrt(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/ceil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event ceil_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::ceil(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
12 changes: 10 additions & 2 deletions dpnp/libtensor/extensions/vm/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ namespace ext_ns = ext::common;
namespace py = pybind11;
namespace td_ns = dpnp::tensor::type_dispatch;

namespace dpnp::extensions::vm::py_internal
namespace dpnp::extensions::vm
{
// Releases the GIL around a oneMKL VM call. On a CPU device VM waits on its
// `depends` and computes on the calling thread, so holding the GIL can
// deadlock with host tasks that need it (e.g. on an in-order queue).
using vm_gil_release = py::gil_scoped_release;

namespace py_internal
{
template <typename output_typesT, typename contig_dispatchT>
bool need_to_call_unary_ufunc(sycl::queue &exec_q,
Expand Down Expand Up @@ -487,4 +494,5 @@ bool need_to_call_binary_ufunc(sycl::queue &exec_q,
__name__##_ContigFactory>( \
contig_dispatch_vector); \
};
} // namespace dpnp::extensions::vm::py_internal
} // namespace py_internal
} // namespace dpnp::extensions::vm
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/conj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ static sycl::event conj_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::conj(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/copysign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static sycl::event copysign_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::copysign(
exec_q,
n, // number of elements to be calculated
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/cos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event cos_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::cos(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/cosh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event cosh_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::cosh(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/div.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ static sycl::event div_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::div(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/erf_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ using ew_cmn_ns::unary_contig_impl_fn_ptr_t;
using resTy = typename OutputType<T>::value_type; \
resTy *y = reinterpret_cast<resTy *>(out_y); \
\
vm_gil_release lock{}; \
\
return mkl_vm::__name__( \
exec_q, n, /* number of elements to be calculated*/ \
a, /* pointer `a` containing input vector of size n*/ \
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event exp_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::exp(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/exp2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event exp2_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::exp2(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/expm1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event expm1_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::expm1(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/floor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event floor_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::floor(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/fmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static sycl::event fmax_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::fmax(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/fmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static sycl::event fmin_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::fmin(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/fmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static sycl::event fmod_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::fmod(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/hypot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ static sycl::event hypot_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::hypot(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/i0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event i0_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::i0(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event inv_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::inv(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/ln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event ln_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::ln(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/log10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event log10_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::log10(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/log1p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event log1p_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::log1p(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/log2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event log2_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::log2(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/modf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ static sycl::event modf_contig_impl(sycl::queue &exec_q,
fractT *y = reinterpret_cast<fractT *>(out_y);
intT *z = reinterpret_cast<intT *>(out_z);

vm_gil_release lock{};

return mkl_vm::modf(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ static sycl::event mul_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::mul(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/nextafter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ static sycl::event
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::nextafter(
exec_q,
n, // number of elements to be calculated
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ static sycl::event pow_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T1, T2>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::pow(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing 1st input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/rint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event rint_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::rint(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/sin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event sin_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::sin(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/sinh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event sinh_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::sinh(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/sqr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ static sycl::event sqr_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::sqr(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
2 changes: 2 additions & 0 deletions dpnp/libtensor/extensions/vm/sqrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ static sycl::event sqrt_contig_impl(sycl::queue &exec_q,
using resTy = typename OutputType<T>::value_type;
resTy *y = reinterpret_cast<resTy *>(out_y);

vm_gil_release lock{};

return mkl_vm::sqrt(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
Expand Down
Loading
Loading