Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROCm 6 deprecation fixes for rocsparse #2050

Merged
merged 3 commits into from
Dec 18, 2023
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
6 changes: 5 additions & 1 deletion sparse/src/KokkosSparse_Utils_rocsparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
#include <sstream>

#ifdef KOKKOSKERNELS_ENABLE_TPL_ROCSPARSE
#if __has_include(<rocm-core/rocm_version.h>)
#include <rocm-core/rocm_version.h>
#else
#include <rocm_version.h>
#include "rocsparse/rocsparse.h"
#endif
#include <rocsparse/rocsparse.h>

namespace KokkosSparse {
namespace Impl {
Expand Down
40 changes: 39 additions & 1 deletion sparse/tpls/KokkosSparse_spmv_bsrmatrix_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,46 @@ void spmv_block_impl_rocsparse(
rocsparse_mat_info info;
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_create_mat_info(&info));

// *_ex* functions deprecated in introduced in 6+
#if KOKKOSSPARSE_IMPL_ROCM_VERSION >= 60000
if constexpr (std::is_same_v<value_type, float>) {
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_sbsrmv_analysis(
handle, dir, trans, mb, nb, nnzb, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_sbsrmv(
handle, dir, trans, mb, nb, nnzb, alpha_, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info, x_, beta_, y_));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_bsrsv_clear(handle, info));
} else if constexpr (std::is_same_v<value_type, double>) {
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_dbsrmv_analysis(
handle, dir, trans, mb, nb, nnzb, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_dbsrmv(
handle, dir, trans, mb, nb, nnzb, alpha_, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info, x_, beta_, y_));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_bsrsv_clear(handle, info));
} else if constexpr (std::is_same_v<value_type, Kokkos::complex<float>>) {
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_cbsrmv_analysis(
handle, dir, trans, mb, nb, nnzb, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_cbsrmv(
handle, dir, trans, mb, nb, nnzb, alpha_, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info, x_, beta_, y_));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_bsrsv_clear(handle, info));
} else if constexpr (std::is_same_v<value_type, Kokkos::complex<double>>) {
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_zbsrmv_analysis(
handle, dir, trans, mb, nb, nnzb, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_zbsrmv(
handle, dir, trans, mb, nb, nnzb, alpha_, descr, bsr_val, bsr_row_ptr,
bsr_col_ind, block_dim, info, x_, beta_, y_));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_bsrsv_clear(handle, info));
} else {
static_assert(KokkosKernels::Impl::always_false_v<value_type>,
"unsupported value type for rocsparse_*bsrmv");
}
// *_ex* functions introduced in 5.4.0
#if KOKKOSSPARSE_IMPL_ROCM_VERSION < 50400
#elif KOKKOSSPARSE_IMPL_ROCM_VERSION < 50400
if constexpr (std::is_same_v<value_type, float>) {
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_sbsrmv(
handle, dir, trans, mb, nb, nnzb, alpha_, descr, bsr_val, bsr_row_ptr,
Expand Down
14 changes: 11 additions & 3 deletions sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ KOKKOSSPARSE_SPMV_CUSPARSE(Kokkos::complex<float>, int64_t, size_t,

// rocSPARSE
#if defined(KOKKOSKERNELS_ENABLE_TPL_ROCSPARSE)
#include <rocsparse/rocsparse.h>
#include <rocm_version.h>
#include "KokkosSparse_Utils_rocsparse.hpp"

namespace KokkosSparse {
Expand Down Expand Up @@ -443,7 +441,17 @@ void spmv_rocsparse(const Kokkos::HIP& exec,
alg = rocsparse_spmv_alg_csr_stream;
}

#if KOKKOSSPARSE_IMPL_ROCM_VERSION >= 50400
#if KOKKOSSPARSE_IMPL_ROCM_VERSION >= 60000
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(
rocsparse_spmv(handle, myRocsparseOperation, &alpha, Aspmat, vecX, &beta,
vecY, compute_type, alg, rocsparse_spmv_stage_buffer_size,
&buffer_size, tmp_buffer));
KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&tmp_buffer, buffer_size));
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(
rocsparse_spmv(handle, myRocsparseOperation, &alpha, Aspmat, vecX, &beta,
vecY, compute_type, alg, rocsparse_spmv_stage_compute,
&buffer_size, tmp_buffer));
#elif KOKKOSSPARSE_IMPL_ROCM_VERSION >= 50400
KOKKOS_ROCSPARSE_SAFE_CALL_IMPL(rocsparse_spmv_ex(
handle, myRocsparseOperation, &alpha, Aspmat, vecX, &beta, vecY,
compute_type, alg, rocsparse_spmv_stage_auto, &buffer_size, tmp_buffer));
Expand Down