Skip to content

Commit

Permalink
[sycl] use non-deprecated MKL call only after v2024
Browse files Browse the repository at this point in the history
Somehow the 'correct' version of the MKL calls lead to a segfault if version < 2024, even though they already deprecated the old call in v2023...
  • Loading branch information
MarcelKoch committed Nov 18, 2024
1 parent 7e6391d commit b0f81df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions benchmark/utils/dpcpp_linops.dp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ class OnemklBase : public gko::LinOp {
mat_handle_ = handle_manager<oneapi::mkl::sparse::matrix_handle>(
create_mat_handle(),
[exec](oneapi::mkl::sparse::matrix_handle_t mat_handle) {
oneapi::mkl::sparse::release_matrix_handle(*exec->get_queue(),
&mat_handle);
oneapi::mkl::sparse::release_matrix_handle(
#if INTEL_MKL_VERSION >= 20240000
*exec->get_queue(),
#endif
&mat_handle);
});
}

Expand Down Expand Up @@ -107,8 +110,10 @@ class OnemklCsr
this->set_size(csr_->get_size());

oneapi::mkl::sparse::set_csr_data(
*(this->get_device_exec()->get_queue()), this->get_mat_handle(),
static_cast<int>(this->get_size()[0]),
#if INTEL_MKL_VERSION >= 20240000
*(this->get_device_exec()->get_queue()),
#endif
this->get_mat_handle(), static_cast<int>(this->get_size()[0]),
static_cast<int>(this->get_size()[1]),
oneapi::mkl::index_base::zero, csr_->get_row_ptrs(),
csr_->get_col_idxs(), csr_->get_values());
Expand Down
12 changes: 9 additions & 3 deletions dpcpp/matrix/csr_kernels.dp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,10 @@ bool try_general_sparselib_spmv(std::shared_ptr<const DpcppExecutor> exec,
oneapi::mkl::sparse::matrix_handle_t mat_handle;
oneapi::mkl::sparse::init_matrix_handle(&mat_handle);
oneapi::mkl::sparse::set_csr_data(
*exec->get_queue(), mat_handle, IndexType(a->get_size()[0]),
#if INTEL_MKL_VERSION >= 20240000
*exec->get_queue(),
#endif
mat_handle, IndexType(a->get_size()[0]),
IndexType(a->get_size()[1]), oneapi::mkl::index_base::zero,
const_cast<IndexType*>(a->get_const_row_ptrs()),
const_cast<IndexType*>(a->get_const_col_idxs()),
Expand All @@ -1417,8 +1420,11 @@ bool try_general_sparselib_spmv(std::shared_ptr<const DpcppExecutor> exec,
const_cast<ValueType*>(b->get_const_values()), b->get_size()[1],
b->get_stride(), host_beta, c->get_values(), c->get_stride());
}
oneapi::mkl::sparse::release_matrix_handle(*exec->get_queue(),
&mat_handle);
oneapi::mkl::sparse::release_matrix_handle(
#if INTEL_MKL_VERSION >= 20240000
*exec->get_queue(),
#endif
&mat_handle);
}
return try_sparselib;
}
Expand Down

0 comments on commit b0f81df

Please sign in to comment.