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

Update rocsparse algo defaults #2245

Merged
merged 3 commits into from
Jun 13, 2024
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
7 changes: 0 additions & 7 deletions sparse/src/KokkosSparse_spmv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,6 @@ void spmv(const ExecutionSpace& space, Handle* handle, const char mode[],
YVector_Internal y_i(y);

bool useNative = is_spmv_algorithm_native(handle->get_algorithm());
// Also use the native algorithm if SPMV_FAST_SETUP was selected and
// rocSPARSE is the possible TPL to use. Native is faster in this case.
#ifdef KOKKOSKERNELS_ENABLE_TPL_ROCSPARSE
if (handle->get_algorithm() == SPMV_FAST_SETUP &&
std::is_same_v<ExecutionSpace, Kokkos::HIP>)
useNative = true;
#endif

// Now call the proper implementation depending on isBSR and the rank of X/Y
if constexpr (!isBSR) {
Expand Down
10 changes: 9 additions & 1 deletion sparse/tpls/KokkosSparse_spmv_tpl_spec_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,15 @@ void spmv_rocsparse(const Kokkos::HIP& exec, Handle* handle, const char mode[],
&vecY, y.extent_int(0), y_data,
rocsparse_compute_type<typename YVector::non_const_value_type>()));

rocsparse_spmv_alg alg = rocsparse_spmv_alg_default;
// Default to using the "stream" algorithm which has almost no setup cost,
// and performs well for reasonably balanced matrices
rocsparse_spmv_alg alg = rocsparse_spmv_alg_csr_stream;
if (handle->get_algorithm() == SPMV_MERGE_PATH) {
// Only use the "adaptive" algorithm if the user has indicated that the
// matrix is very imbalanced, by asking for merge path. This algorithm
// has fairly expensive setup
alg = rocsparse_spmv_alg_csr_adaptive;
}

KokkosSparse::Impl::RocSparse_CRS_SpMV_Data* subhandle;
if (handle->tpl_rank1) {
Expand Down
Loading