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 f564a3d commit 02466ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/src/HIP/Kokkos_HIP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ 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 @@ -62,6 +62,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 @@ -74,6 +77,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 02466ab

Please sign in to comment.