Skip to content

Commit

Permalink
Remove redundant RangePolicy constructor (kokkos#6841)
Browse files Browse the repository at this point in the history
* Remove redundant RangePolicy constructor

* Disable test case for Cuda <11.2 completely
  • Loading branch information
masterleinad committed Feb 28, 2024
1 parent 058c3a0 commit 04a5334
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
18 changes: 0 additions & 18 deletions core/src/Kokkos_ExecPolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,6 @@ class RangePolicy : public Impl::PolicyTraits<Properties...> {
m_granularity(0),
m_granularity_mask(0) {}

/** \brief Total range */
template <typename IndexType1, typename IndexType2,
std::enable_if_t<(std::is_convertible_v<IndexType1, member_type> &&
std::is_convertible_v<IndexType2, member_type>),
bool> = false>
inline RangePolicy(const typename traits::execution_space& work_space,
const IndexType1 work_begin, const IndexType2 work_end)
: m_space(work_space),
m_begin(work_begin),
m_end(work_end),
m_granularity(0),
m_granularity_mask(0) {
check_conversion_safety(work_begin);
check_conversion_safety(work_end);
check_bounds_validity();
set_auto_chunk_size();
}

/** \brief Total range */
template <typename IndexType1, typename IndexType2,
std::enable_if_t<(std::is_convertible_v<IndexType1, member_type> &&
Expand Down
11 changes: 8 additions & 3 deletions core/unit_test/TestRangePolicyCTAD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <Kokkos_Core.hpp>
#include "Kokkos_Core_fwd.hpp"

#if !defined(KOKKOS_COMPILER_NVCC) || KOKKOS_COMPILER_NVCC >= 1120

namespace {

template <class... Args>
Expand Down Expand Up @@ -54,7 +56,6 @@ struct TestRangePolicyCTAD {

// RangePolicy(index_type, index_type)

#if !defined(KOKKOS_COMPILER_NVCC) || KOKKOS_COMPILER_NVCC >= 1120
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, i64, i64);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, i64, i32);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, i32, i64);
Expand All @@ -69,19 +70,23 @@ struct TestRangePolicyCTAD {

// RangePolicy(execution_space, index_type, index_type)

// none (ambiguous deduction for template arguments)
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, des, i64, i64);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, des, i32, i32);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, nes, i64, i64);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, nes, i32, i32);

// RangePolicy(execution_space, index_type, index_type, Args...)

KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, des, i64, i64, cs);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, des, i32, i32, cs);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, nes, i64, i64, cs);
KOKKOS_TEST_RANGE_POLICY(Kokkos::RangePolicy<>, nes, i32, i32, cs);
#endif
}; // TestRangePolicyCTAD struct

// To eliminate maybe_unused warning on some compilers
const Kokkos::DefaultExecutionSpace des =
TestRangePolicyCTAD::ImplicitlyConvertibleToDefaultExecutionSpace();

} // namespace

#endif

0 comments on commit 04a5334

Please sign in to comment.