From 129f7b9a322dfe415aaade6ee996f19f9069a5ca Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 13 Apr 2026 21:14:30 +0200 Subject: [PATCH 1/3] Release GIL before calling mkl_lapack::orgqr() --- dpnp/backend/extensions/lapack/orgqr.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dpnp/backend/extensions/lapack/orgqr.cpp b/dpnp/backend/extensions/lapack/orgqr.cpp index e421b9dd791a..7dde2371414c 100644 --- a/dpnp/backend/extensions/lapack/orgqr.cpp +++ b/dpnp/backend/extensions/lapack/orgqr.cpp @@ -87,8 +87,17 @@ static sycl::event orgqr_impl(sycl::queue &exec_q, sycl::event orgqr_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(scratchpad_size, exec_q); + // mkl_lapack::orgqr() is done through GPU-to-Host reverse offload: + // exec_q.submit([&](sycl::handler& cgh) { + // cgh.depends_on(depends); + // cgh.host_task([=]() { orgqr_host(...); }); + // }).wait(); orgqr_event = mkl_lapack::orgqr( exec_q, m, // The number of rows in the matrix; (0 ≤ m). From 9f17f5cf90abd3d469867f99f49e94cf448b5771 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 13 Apr 2026 21:31:22 +0200 Subject: [PATCH 2/3] Populate the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8aaae542ec5..af011332b450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum * Resolved an issue with strides calculation in `dpnp.diagonal` to return correct values for empty diagonals [#2814](https://github.com/IntelPython/dpnp/pull/2814) * Fixed test tolerance issues for float16 intermediate precision that became visible when testing against conda-forge's NumPy [#2828](https://github.com/IntelPython/dpnp/pull/2828) * Ensured device aware dtype handling in `dpnp.identity` and `dpnp.gradient` [#2835](https://github.com/IntelPython/dpnp/pull/2835) +* Resolved deadlock in `dpnp.linalg.qr` by releasing GIL before OneMKL `orgqr` call to prevent host tasks contention [#2850](https://github.com/IntelPython/dpnp/pull/2850) ### Security From 91bd264c72a36f1b95eb4f976c98ddf230c2d4b2 Mon Sep 17 00:00:00 2001 From: Anton <100830759+antonwolfy@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:47:07 +0200 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: vlad-perevezentsev --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af011332b450..b83ab7b8dd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,7 +84,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum * Resolved an issue with strides calculation in `dpnp.diagonal` to return correct values for empty diagonals [#2814](https://github.com/IntelPython/dpnp/pull/2814) * Fixed test tolerance issues for float16 intermediate precision that became visible when testing against conda-forge's NumPy [#2828](https://github.com/IntelPython/dpnp/pull/2828) * Ensured device aware dtype handling in `dpnp.identity` and `dpnp.gradient` [#2835](https://github.com/IntelPython/dpnp/pull/2835) -* Resolved deadlock in `dpnp.linalg.qr` by releasing GIL before OneMKL `orgqr` call to prevent host tasks contention [#2850](https://github.com/IntelPython/dpnp/pull/2850) +* Resolved a deadlock in `dpnp.linalg.qr` by releasing the GIL before OneMKL `orgqr` call to prevent host tasks contention [#2850](https://github.com/IntelPython/dpnp/pull/2850) ### Security