Skip to content

Commit

Permalink
Make HIP constructor explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
tcclevenger committed Jul 25, 2024
1 parent 0e20c0c commit bd6ca2f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/src/HIP/Kokkos_HIP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,19 @@ class HIP {
using scratch_memory_space = ScratchMemorySpace<HIP>;

HIP();
HIP(hipStream_t stream,
Impl::ManageStream manage_stream = Impl::ManageStream::no);

explicit HIP(hipStream_t stream) : HIP(stream, Impl::ManageStream::no) {}

#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
template <typename T = void>
KOKKOS_DEPRECATED_WITH_COMMENT(
"HIP execution space should be constructed explicitly.")
HIP(hipStream_t stream)
: HIP(stream) {}
#endif

HIP(hipStream_t stream, Impl::ManageStream manage_stream);

KOKKOS_DEPRECATED HIP(hipStream_t stream, bool manage_stream);

//@}
Expand Down
6 changes: 6 additions & 0 deletions core/unit_test/TestExecutionSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ constexpr bool test_execspace_explicit() {
#ifdef KOKKOS_ENABLE_CUDA
static_assert(std::is_convertible_v<cudaStream_t, Kokkos::Cuda>);
#endif
#ifdef KOKKOS_ENABLE_HIP
static_assert(std::is_convertible_v<hipStream_t, Kokkos::HIP>);
#endif

#else

Expand All @@ -68,6 +71,9 @@ constexpr bool test_execspace_explicit() {
#ifdef KOKKOS_ENABLE_CUDA
static_assert(!std::is_convertible_v<cudaStream_t, Kokkos::Cuda>);
#endif
#ifdef KOKKOS_ENABLE_HIP
static_assert(!std::is_convertible_v<hipStream_t, Kokkos::HIP>);
#endif

#endif
return true;
Expand Down

0 comments on commit bd6ca2f

Please sign in to comment.