Skip to content

Commit

Permalink
Merge pull request #5807 from dalg24/all_t
Browse files Browse the repository at this point in the history
Make `ALL_t` a "public" type `Kokkos::Impl:: -> Kokkos::`
  • Loading branch information
dalg24 committed Jan 25, 2023
2 parents 94d9c9e + ddefe61 commit 84a336a
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 351 deletions.
3 changes: 1 addition & 2 deletions containers/src/Kokkos_OffsetView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,8 +1251,7 @@ shift_input(const T arg, const int64_t offset) {
}

KOKKOS_INLINE_FUNCTION
Kokkos::Impl::ALL_t shift_input(const Kokkos::Impl::ALL_t arg,
const int64_t /*offset*/) {
Kokkos::ALL_t shift_input(const Kokkos::ALL_t arg, const int64_t /*offset*/) {
return arg;
}

Expand Down
2 changes: 1 addition & 1 deletion containers/src/Kokkos_ScatterView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void args_to_array(size_t* array, int pos, T dim0, Dims... dims) {
subview where the index specified is the largest-stride one. */
template <typename Layout, int rank, typename V, typename... Args>
struct Slice {
using next = Slice<Layout, rank - 1, V, Kokkos::Impl::ALL_t, Args...>;
using next = Slice<Layout, rank - 1, V, Kokkos::ALL_t, Args...>;
using value_type = typename next::value_type;

static value_type get(V const& src, const size_t i, Args... args) {
Expand Down
69 changes: 30 additions & 39 deletions core/src/Kokkos_CopyViews.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 2> {
} else {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 2, Kokkos::Impl::ALL_t, p_type>;
CommonSubview<DstType, SrcType, 2, ALL_t, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1);
view_copy(exec_space..., common_subview.dst_sub,
common_subview.src_sub);
Expand All @@ -883,7 +883,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 2> {
if (dst.extent(1) == src.extent(1)) {
p_type ext0(0, std::min(dst.extent(0), src.extent(0)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 2, p_type, Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 2, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
common_subview.src_sub);
Expand Down Expand Up @@ -915,8 +915,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 3> {
if (dst.extent(2) == src.extent(2)) {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 3, Kokkos::Impl::ALL_t, p_type,
Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 3, ALL_t, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1,
Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -925,8 +924,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 3> {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 3, Kokkos::Impl::ALL_t, p_type,
p_type>;
CommonSubview<DstType, SrcType, 3, ALL_t, p_type, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2);
view_copy(exec_space..., common_subview.dst_sub,
common_subview.src_sub);
Expand All @@ -935,8 +933,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 3> {
if (dst.extent(2) == src.extent(2)) {
p_type ext0(0, std::min(dst.extent(0), src.extent(0)));
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
using sv_adapter_type = CommonSubview<DstType, SrcType, 3, p_type,
p_type, Kokkos::Impl::ALL_t>;
using sv_adapter_type =
CommonSubview<DstType, SrcType, 3, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, ext1, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
common_subview.src_sub);
Expand Down Expand Up @@ -970,8 +968,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 4> {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 4, Kokkos::Impl::ALL_t, p_type,
p_type, Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 4, ALL_t, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2,
Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -981,8 +978,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 4> {
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
p_type ext3(0, std::min(dst.extent(3), src.extent(3)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 4, Kokkos::Impl::ALL_t, p_type,
p_type, p_type>;
CommonSubview<DstType, SrcType, 4, ALL_t, p_type, p_type, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3);
view_copy(exec_space..., common_subview.dst_sub,
common_subview.src_sub);
Expand All @@ -993,8 +989,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 4> {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 4, p_type, p_type, p_type,
Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 4, p_type, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, ext1, ext2, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
common_subview.src_sub);
Expand Down Expand Up @@ -1029,9 +1024,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 5> {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
p_type ext3(0, std::min(dst.extent(3), src.extent(3)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 5, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, Kokkos::Impl::ALL_t>;
using sv_adapter_type = CommonSubview<DstType, SrcType, 5, ALL_t,
p_type, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1041,9 +1035,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 5> {
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
p_type ext3(0, std::min(dst.extent(3), src.extent(3)));
p_type ext4(0, std::min(dst.extent(4), src.extent(4)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 5, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type>;
using sv_adapter_type = CommonSubview<DstType, SrcType, 5, ALL_t,
p_type, p_type, p_type, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1055,9 +1048,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 5> {
p_type ext1(0, std::min(dst.extent(1), src.extent(1)));
p_type ext2(0, std::min(dst.extent(2), src.extent(2)));
p_type ext3(0, std::min(dst.extent(3), src.extent(3)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 5, p_type, p_type, p_type, p_type,
Kokkos::Impl::ALL_t>;
using sv_adapter_type = CommonSubview<DstType, SrcType, 5, p_type,
p_type, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, ext1, ext2, ext3,
Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand Down Expand Up @@ -1095,8 +1087,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 6> {
p_type ext3(0, std::min(dst.extent(3), src.extent(3)));
p_type ext4(0, std::min(dst.extent(4), src.extent(4)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 6, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type, Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 6, ALL_t, p_type, p_type, p_type,
p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1108,8 +1100,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 6> {
p_type ext4(0, std::min(dst.extent(4), src.extent(4)));
p_type ext5(0, std::min(dst.extent(5), src.extent(5)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 6, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type, p_type>;
CommonSubview<DstType, SrcType, 6, ALL_t, p_type, p_type, p_type,
p_type, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4, ext5);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1125,7 +1117,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 6> {

using sv_adapter_type =
CommonSubview<DstType, SrcType, 6, p_type, p_type, p_type, p_type,
p_type, Kokkos::Impl::ALL_t>;
p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, ext1, ext2, ext3, ext4,
Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand Down Expand Up @@ -1169,8 +1161,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 7> {
p_type ext4(0, std::min(dst.extent(4), src.extent(4)));
p_type ext5(0, std::min(dst.extent(5), src.extent(5)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 7, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type, p_type, Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 7, ALL_t, p_type, p_type, p_type,
p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4, ext5, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1183,8 +1175,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 7> {
p_type ext5(0, std::min(dst.extent(5), src.extent(5)));
p_type ext6(0, std::min(dst.extent(6), src.extent(6)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 7, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type, p_type, p_type>;
CommonSubview<DstType, SrcType, 7, ALL_t, p_type, p_type, p_type,
p_type, p_type, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4, ext5, ext6);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1200,7 +1192,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 7> {
p_type ext5(0, std::min(dst.extent(5), src.extent(5)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 7, p_type, p_type, p_type, p_type,
p_type, p_type, Kokkos::Impl::ALL_t>;
p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, ext1, ext2, ext3, ext4,
ext5, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand Down Expand Up @@ -1245,9 +1237,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 8> {
p_type ext5(0, std::min(dst.extent(5), src.extent(5)));
p_type ext6(0, std::min(dst.extent(6), src.extent(6)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 8, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type, p_type, p_type,
Kokkos::Impl::ALL_t>;
CommonSubview<DstType, SrcType, 8, ALL_t, p_type, p_type, p_type,
p_type, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4, ext5, ext6, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1261,8 +1252,8 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 8> {
p_type ext6(0, std::min(dst.extent(6), src.extent(6)));
p_type ext7(0, std::min(dst.extent(7), src.extent(7)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 8, Kokkos::Impl::ALL_t, p_type,
p_type, p_type, p_type, p_type, p_type, p_type>;
CommonSubview<DstType, SrcType, 8, ALL_t, p_type, p_type, p_type,
p_type, p_type, p_type, p_type>;
sv_adapter_type common_subview(dst, src, Kokkos::ALL, ext1, ext2, ext3,
ext4, ext5, ext6, ext7);
view_copy(exec_space..., common_subview.dst_sub,
Expand All @@ -1279,7 +1270,7 @@ struct ViewRemap<DstType, SrcType, ExecSpace, 8> {
p_type ext6(0, std::min(dst.extent(6), src.extent(6)));
using sv_adapter_type =
CommonSubview<DstType, SrcType, 8, p_type, p_type, p_type, p_type,
p_type, p_type, p_type, Kokkos::Impl::ALL_t>;
p_type, p_type, p_type, ALL_t>;
sv_adapter_type common_subview(dst, src, ext0, ext1, ext2, ext3, ext4,
ext5, ext6, Kokkos::ALL);
view_copy(exec_space..., common_subview.dst_sub,
Expand Down
12 changes: 3 additions & 9 deletions core/src/Kokkos_View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,17 +494,11 @@ constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst,

namespace Kokkos {

namespace {
inline constexpr Kokkos::ALL_t ALL{};

constexpr Kokkos::Impl::ALL_t ALL = Kokkos::Impl::ALL_t();
inline constexpr Kokkos::Impl::WithoutInitializing_t WithoutInitializing{};

constexpr Kokkos::Impl::WithoutInitializing_t WithoutInitializing =
Kokkos::Impl::WithoutInitializing_t();

constexpr Kokkos::Impl::AllowPadding_t AllowPadding =
Kokkos::Impl::AllowPadding_t();

} // namespace
inline constexpr Kokkos::Impl::AllowPadding_t AllowPadding{};

/** \brief Create View allocation parameter bundle from argument list.
*
Expand Down
22 changes: 11 additions & 11 deletions core/src/impl/Kokkos_ViewMapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ struct ViewDimensionAssignable<ViewDimension<DstArgs...>,
//----------------------------------------------------------------------------

namespace Kokkos {
namespace Impl {

struct ALL_t {
KOKKOS_INLINE_FUNCTION
Expand All @@ -296,15 +295,20 @@ struct ALL_t {
constexpr bool operator==(const ALL_t&) const { return true; }
};

#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
namespace Impl {
using ALL_t KOKKOS_DEPRECATED_WITH_COMMENT("Use Kokkos::ALL_t instead!") =
Kokkos::ALL_t;
} // namespace Impl
#endif
} // namespace Kokkos

namespace Kokkos {
namespace Impl {

template <class T>
struct is_integral_extent_type {
enum : bool { value = std::is_same<T, Kokkos::Impl::ALL_t>::value ? 1 : 0 };
enum : bool { value = std::is_same<T, ALL_t>::value ? 1 : 0 };
};

template <class iType>
Expand Down Expand Up @@ -353,8 +357,7 @@ struct SubviewLegalArgsCompileTime<Kokkos::LayoutLeft, Kokkos::LayoutLeft,
value = (((CurrentArg == RankDest - 1) &&
(Kokkos::Impl::is_integral_extent_type<Arg>::value)) ||
((CurrentArg >= RankDest) && (std::is_integral<Arg>::value)) ||
((CurrentArg < RankDest) &&
(std::is_same<Arg, Kokkos::Impl::ALL_t>::value)) ||
((CurrentArg < RankDest) && (std::is_same<Arg, ALL_t>::value)) ||
((CurrentArg == 0) &&
(Kokkos::Impl::is_integral_extent_type<Arg>::value))) &&
(SubviewLegalArgsCompileTime<Kokkos::LayoutLeft, Kokkos::LayoutLeft,
Expand Down Expand Up @@ -385,7 +388,7 @@ struct SubviewLegalArgsCompileTime<Kokkos::LayoutRight, Kokkos::LayoutRight,
((CurrentArg < RankSrc - RankDest) &&
(std::is_integral<Arg>::value)) ||
((CurrentArg >= RankSrc - RankDest) &&
(std::is_same<Arg, Kokkos::Impl::ALL_t>::value))) &&
(std::is_same<Arg, ALL_t>::value))) &&
(SubviewLegalArgsCompileTime<Kokkos::LayoutRight,
Kokkos::LayoutRight, RankDest, RankSrc,
CurrentArg + 1, SubViewArgs...>::value)
Expand All @@ -396,8 +399,7 @@ template <int RankDest, int RankSrc, int CurrentArg, class Arg>
struct SubviewLegalArgsCompileTime<Kokkos::LayoutRight, Kokkos::LayoutRight,
RankDest, RankSrc, CurrentArg, Arg> {
enum {
value = ((CurrentArg == RankSrc - 1) &&
(std::is_same<Arg, Kokkos::Impl::ALL_t>::value))
value = ((CurrentArg == RankSrc - 1) && (std::is_same<Arg, ALL_t>::value))
};
};

Expand Down Expand Up @@ -463,8 +465,7 @@ struct SubviewExtents {
KOKKOS_FORCEINLINE_FUNCTION bool set(unsigned domain_rank,
unsigned range_rank,
const ViewDimension<DimArgs...>& dim,
const Kokkos::Impl::ALL_t,
Args... args) {
ALL_t, Args... args) {
m_begin[domain_rank] = 0;
m_length[range_rank] = dim.extent(domain_rank);
m_index[range_rank] = domain_rank;
Expand Down Expand Up @@ -559,8 +560,7 @@ struct SubviewExtents {
// std::pair range
template <size_t... DimArgs, class... Args>
void error(char* buf, int buf_len, unsigned domain_rank, unsigned range_rank,
const ViewDimension<DimArgs...>& dim, const Kokkos::Impl::ALL_t,
Args... args) const {
const ViewDimension<DimArgs...>& dim, ALL_t, Args... args) const {
const int n = std::min(buf_len, snprintf(buf, buf_len, " Kokkos::ALL %c",
int(sizeof...(Args) ? ',' : ')')));

Expand Down
Loading

0 comments on commit 84a336a

Please sign in to comment.