Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions dpnp/backend/extensions/lapack/gesv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ static sycl::event gesv_impl(sycl::queue &exec_q,
is_exception_caught = true;
gesv_utils::handle_lapack_exc(exec_q, lda, a, scratchpad_size,
scratchpad, ipiv, e, error_msg);
} catch (oneapi::mkl::computation_error const &e) {
// TODO: remove this catch when gh-642(oneMath) is fixed
// Workaround for oneMath interfaces
// oneapi::mkl::computation_error is thrown instead of
// oneapi::mkl::lapack::computation_error.
if (scratchpad != nullptr)
sycl_free_noexcept(scratchpad, exec_q);
if (ipiv != nullptr)
sycl_free_noexcept(ipiv, exec_q);
throw LinAlgError("The input coefficient matrix is singular.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why is it handled in another way comparing to oneapi::mkl::lapack::computation_error above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above we handle all exceptions in oneapi::mkl::lapack::exception class by defining a specific exception using the value of info() method.
In this case if the input matrix is singular, the exception oneapi::mkl::computation_error is thrown.

Also info method is not available in oneapi::mkl::exception: class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the main reason is that we can't use gesv_utils::handle_lapack_exc here, because oneapi::mkl::computation_error doesn't expose info() method.

} catch (sycl::exception const &e) {
is_exception_caught = true;
error_msg << "Unexpected SYCL exception caught during getrf() or "
Expand Down
9 changes: 9 additions & 0 deletions dpnp/backend/extensions/lapack/getrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ static sycl::event getrf_impl(sycl::queue &exec_q,
"call:\nreason: "
<< e.what() << "\ninfo: " << e.info();
}
} catch (oneapi::mkl::computation_error const &e) {
// TODO: remove this catch when gh-642(oneMath) is fixed
// Workaround for oneMath interfaces
// oneapi::mkl::computation_error is thrown instead of
// oneapi::mkl::lapack::computation_error.
is_exception_caught = false;
// computation_error means the input matrix is singular
// dev_info must be set to any positive value.
dev_info[0] = 2;
} catch (sycl::exception const &e) {
is_exception_caught = true;
error_msg << "Unexpected SYCL exception caught during getrf() call:\n"
Expand Down
Loading