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

Fix issues with SpMV using tensor cores #1194

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#ifndef KOKKOSSPARSE_IMPL_SPMV_TENSOR_CORE_DEF_HPP_
#define KOKKOSSPARSE_IMPL_SPMV_TENSOR_CORE_DEF_HPP_

#if defined(KOKKOS_ENABLE_CUDA) && \
#if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__) && \
(defined(KOKKOS_ARCH_VOLTA) || defined(KOKKOS_ARCH_AMPERE))

#include <type_traits>
Expand Down
9 changes: 6 additions & 3 deletions src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@

#include "KokkosSparse_BsrMatrix.hpp"
#include "KokkosKernels_Controls.hpp"
#if !defined(KOKKOSKERNELS_ETI_ONLY) || KOKKOSKERNELS_IMPL_COMPILE_LIBRARY
#if !defined(KOKKOSKERNELS_ETI_ONLY) || \
KOKKOSKERNELS_IMPL_COMPILE_LIBRARY && defined(__CUDA_ARCH__)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there should be parentheses around the || expression, since we want "old condition && compiling for cuda device"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, good point, I'll do that

#include <KokkosSparse_spmv_bsrmatrix_impl.hpp>
#endif

Expand Down Expand Up @@ -136,7 +137,9 @@ struct SPMV_BSRMATRIX<AT, AO, AD, AM, AS, XT, XL, XD, XM, YT, YL, YD, YM,
}
}

#if defined(KOKKOS_ARCH_AMPERE)
// If not compiling with the cuda compiler, no need to try
// to compile the wmma functions...
#if defined(KOKKOS_ARCH_AMPERE) && defined(__CUDA_ARCH__)
typedef typename XVector::non_const_value_type XScalar;
typedef typename AMatrix::non_const_value_type AScalar;
typedef Kokkos::Experimental::half_t Half;
Expand Down Expand Up @@ -173,7 +176,7 @@ struct SPMV_BSRMATRIX<AT, AO, AD, AM, AS, XT, XL, XD, XM, YT, YL, YD, YM,
4>::dispatch(alpha, A, x, beta, y);
}

#elif defined(KOKKOS_ARCH_VOLTA)
#elif defined(KOKKOS_ARCH_VOLTA) && defined(__CUDA_ARCH__)
/* Volta has float += half * half
use it for all matrices
*/
Expand Down