Skip to content

Commit 26e17dd

Browse files
authored
Merge branch 'master' into impl-bartlett
2 parents 3955e32 + 1b0ce60 commit 26e17dd

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

dpnp/backend/extensions/lapack/gesv.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ static sycl::event gesv_impl(sycl::queue &exec_q,
144144
is_exception_caught = true;
145145
gesv_utils::handle_lapack_exc(exec_q, lda, a, scratchpad_size,
146146
scratchpad, ipiv, e, error_msg);
147+
} catch (oneapi::mkl::computation_error const &e) {
148+
// TODO: remove this catch when gh-642(oneMath) is fixed
149+
// Workaround for oneMath interfaces
150+
// oneapi::mkl::computation_error is thrown instead of
151+
// oneapi::mkl::lapack::computation_error.
152+
if (scratchpad != nullptr)
153+
sycl_free_noexcept(scratchpad, exec_q);
154+
if (ipiv != nullptr)
155+
sycl_free_noexcept(ipiv, exec_q);
156+
throw LinAlgError("The input coefficient matrix is singular.");
147157
} catch (sycl::exception const &e) {
148158
is_exception_caught = true;
149159
error_msg << "Unexpected SYCL exception caught during getrf() or "

dpnp/backend/extensions/lapack/getrf.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ static sycl::event getrf_impl(sycl::queue &exec_q,
120120
"call:\nreason: "
121121
<< e.what() << "\ninfo: " << e.info();
122122
}
123+
} catch (oneapi::mkl::computation_error const &e) {
124+
// TODO: remove this catch when gh-642(oneMath) is fixed
125+
// Workaround for oneMath interfaces
126+
// oneapi::mkl::computation_error is thrown instead of
127+
// oneapi::mkl::lapack::computation_error.
128+
is_exception_caught = false;
129+
// computation_error means the input matrix is singular
130+
// dev_info must be set to any positive value.
131+
dev_info[0] = 2;
123132
} catch (sycl::exception const &e) {
124133
is_exception_caught = true;
125134
error_msg << "Unexpected SYCL exception caught during getrf() call:\n"

0 commit comments

Comments
 (0)