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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ This release is compatible with NumPy 2.5.
* Fixed `dpnp.tensor.top_k` aborting for `k=0` by returning empty result arrays without launching a zero-sized kernel [#3022](https://github.com/IntelPython/dpnp/pull/3022)
* Fixed comparison functions (`dpnp.equal`, `dpnp.not_equal`, `dpnp.less`, `dpnp.less_equal`, `dpnp.greater`, `dpnp.greater_equal`) and `dpnp.divide` raising `OverflowError` when comparing an integer array against a Python integer scalar outside the array dtype's range [#3017](https://github.com/IntelPython/dpnp/pull/3017)
* Fixed a crash in boolean-mask advanced indexing (`dpnp.ndarray` get/set item) when the selection is empty (e.g. a scalar `False` index that injects a length-0 axis) [#3019](https://github.com/IntelPython/dpnp/pull/3019)
* Released the GIL before the remaining blocking OneMKL BLAS and LAPACK calls to prevent host tasks contention, completing the work started in [#2850](https://github.com/IntelPython/dpnp/pull/2850) [#3027](https://github.com/IntelPython/dpnp/pull/3027)


### Security

Expand Down
7 changes: 7 additions & 0 deletions dpnp/backend/extensions/blas/dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@

#include <stdexcept>

#include <pybind11/pybind11.h>

#include "dot_common.hpp"

namespace dpnp::extensions::blas
{
namespace mkl_blas = oneapi::mkl::blas;
namespace type_utils = dpnp::tensor::type_utils;
namespace py = pybind11;

template <typename T>
static sycl::event dot_impl(sycl::queue &exec_q,
Expand All @@ -58,6 +61,10 @@ static sycl::event dot_impl(sycl::queue &exec_q,

sycl::event dot_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

dot_event = mkl_blas::column_major::dot(exec_q,
n, // size of the input vectors
x, // Pointer to vector x.
Expand Down
7 changes: 7 additions & 0 deletions dpnp/backend/extensions/blas/dotc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@

#include <stdexcept>

#include <pybind11/pybind11.h>

#include "dot_common.hpp"

namespace dpnp::extensions::blas
{
namespace mkl_blas = oneapi::mkl::blas;
namespace type_utils = dpnp::tensor::type_utils;
namespace py = pybind11;

template <typename T>
static sycl::event dotc_impl(sycl::queue &exec_q,
Expand All @@ -58,6 +61,10 @@ static sycl::event dotc_impl(sycl::queue &exec_q,

sycl::event dotc_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

dotc_event =
mkl_blas::column_major::dotc(exec_q,
n, // size of the input vectors
Expand Down
7 changes: 7 additions & 0 deletions dpnp/backend/extensions/blas/dotu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@

#include <stdexcept>

#include <pybind11/pybind11.h>

#include "dot_common.hpp"

namespace dpnp::extensions::blas
{
namespace mkl_blas = oneapi::mkl::blas;
namespace type_utils = dpnp::tensor::type_utils;
namespace py = pybind11;

template <typename T>
static sycl::event dotu_impl(sycl::queue &exec_q,
Expand All @@ -58,6 +61,10 @@ static sycl::event dotu_impl(sycl::queue &exec_q,

sycl::event dotu_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

dotu_event =
mkl_blas::column_major::dotu(exec_q,
n, // size of the input vectors
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/blas/gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ static sycl::event gemm_impl(sycl::queue &exec_q,
c, ldc, deps);
}
};
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

gemm_event = gemm_func(
exec_q,
transA, // Defines the transpose operation for matrix A:
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/blas/gemm_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ static sycl::event gemm_batch_impl(sycl::queue &exec_q,
strideb, beta, c, ldc, stridec, batch_size, deps);
}
};
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

gemm_batch_event = gemm_batch_func(
exec_q,
transA, // Defines the transpose operation for matrix A:
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/geqrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ static sycl::event geqrf_impl(sycl::queue &exec_q,

sycl::event geqrf_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

geqrf_event = mkl_lapack::geqrf(
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/geqrf_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ static sycl::event geqrf_batch_impl(sycl::queue &exec_q,

sycl::event geqrf_batch_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

geqrf_batch_event = mkl_lapack::geqrf_batch(
Expand Down
8 changes: 8 additions & 0 deletions dpnp/backend/extensions/lapack/gesv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ static sycl::event gesv_impl(sycl::queue &exec_q,
#if defined(USE_ONEMATH)
sycl::event getrf_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

getrf_event = mkl_lapack::getrf(
exec_q,
n, // The order of the square matrix A (0 ≤ n).
Expand Down Expand Up @@ -169,6 +173,10 @@ static sycl::event gesv_impl(sycl::queue &exec_q,
}
#else
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

comp_event = mkl_lapack::gesv(
exec_q,
n, // The order of the square matrix A
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/gesvd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ static sycl::event gesvd_impl(sycl::queue &exec_q,

sycl::event gesvd_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

gesvd_event = mkl_lapack::gesvd(
exec_q,
jobu, // Character specifying how to compute the matrix U:
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/getrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ static sycl::event getrf_impl(sycl::queue &exec_q,

sycl::event getrf_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

getrf_event = mkl_lapack::getrf(
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/getrf_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ static sycl::event getrf_batch_impl(sycl::queue &exec_q,

sycl::event getrf_batch_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

getrf_batch_event = mkl_lapack::getrf_batch(
Expand Down
5 changes: 5 additions & 0 deletions dpnp/backend/extensions/lapack/heevd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

namespace dpnp::extensions::lapack
{
namespace py = pybind11;
namespace mkl_lapack = oneapi::mkl::lapack;
namespace type_utils = dpnp::tensor::type_utils;

Expand Down Expand Up @@ -73,6 +74,10 @@ static sycl::event heevd_impl(sycl::queue &exec_q,

sycl::event heevd_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

heevd_event = mkl_lapack::heevd(
exec_q,
jobz, // 'jobz == job::vec' means eigenvalues and eigenvectors are
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/orgqr_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ static sycl::event orgqr_batch_impl(sycl::queue &exec_q,

sycl::event orgqr_batch_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

orgqr_batch_event = mkl_lapack::orgqr_batch(
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/potrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ static sycl::event potrf_impl(sycl::queue &exec_q,

sycl::event potrf_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

potrf_event = mkl_lapack::potrf(
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/potrf_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ static sycl::event potrf_batch_impl(sycl::queue &exec_q,

sycl::event potrf_batch_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

potrf_batch_event = mkl_lapack::potrf_batch(
Expand Down
5 changes: 5 additions & 0 deletions dpnp/backend/extensions/lapack/syevd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

namespace dpnp::extensions::lapack
{
namespace py = pybind11;
namespace mkl_lapack = oneapi::mkl::lapack;
namespace type_utils = dpnp::tensor::type_utils;

Expand Down Expand Up @@ -73,6 +74,10 @@ static sycl::event syevd_impl(sycl::queue &exec_q,

sycl::event syevd_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

syevd_event = mkl_lapack::syevd(
exec_q,
jobz, // 'jobz == job::vec' means eigenvalues and eigenvectors are
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/ungqr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ static sycl::event ungqr_impl(sycl::queue &exec_q,

sycl::event ungqr_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

ungqr_event = mkl_lapack::ungqr(
Expand Down
4 changes: 4 additions & 0 deletions dpnp/backend/extensions/lapack/ungqr_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ static sycl::event ungqr_batch_impl(sycl::queue &exec_q,

sycl::event ungqr_batch_event;
try {
// Release GIL to avoid serialization of host task submissions
// to the same queue in OneMKL
py::gil_scoped_release lock{};

scratchpad = sycl::malloc_device<T>(scratchpad_size, exec_q);

ungqr_batch_event = mkl_lapack::ungqr_batch(
Expand Down
Loading
Loading