Skip to content

Commit

Permalink
more WIP with compile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nmm0 committed Jul 9, 2024
1 parent a53f991 commit 0a9eba8
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 43 deletions.
1 change: 1 addition & 0 deletions core/src/Kokkos_View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ template <class, class...>
class ViewMapping;
}
#include <impl/Kokkos_ViewMapping.hpp>
#include <View/Kokkos_ViewUtility.hpp>
#include <Kokkos_MinMax.hpp>

// Class to provide a uniform type
Expand Down
68 changes: 68 additions & 0 deletions core/src/View/Kokkos_ViewUtility.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

//@HEADER
// ************************************************************************
//
// Kokkos v. 4.0
// Copyright (2022) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
// See https://kokkos.org/LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//@HEADER

#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
#include <Kokkos_Macros.hpp>
static_assert(false,
"Including non-public Kokkos header files is not allowed.");
#endif
#ifndef KOKKOS_VIEW_UTILITY_HPP
#define KOKKOS_VIEW_UTILITY_HPP

#include <impl/Kokkos_ViewCtor.hpp>

namespace Kokkos {
/** \brief Create View allocation parameter bundle from argument list.
*
* Valid argument list members are:
* 1) label as a "string" or std::string
* 2) memory space instance of the View::memory_space type
* 3) execution space instance compatible with the View::memory_space
* 4) Kokkos::WithoutInitializing to bypass initialization
* 4) Kokkos::AllowPadding to allow allocation to pad dimensions for memory
* alignment
*/
template <class... Args>
inline Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>
view_alloc(Args const&... args) {
using return_type =
Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>;

static_assert(!return_type::has_pointer,
"Cannot give pointer-to-memory for view allocation");

return return_type(args...);
}

template <class... Args>
KOKKOS_INLINE_FUNCTION
Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>
view_wrap(Args const&... args) {
using return_type =
Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>;

static_assert(!return_type::has_memory_space &&
!return_type::has_execution_space &&
!return_type::has_label && return_type::has_pointer,
"Must only give pointer-to-memory for view wrapping");

return return_type(args...);
}

} /* namespace Kokkos */

#endif // KOKKOS_VIEW_UTILITY_HPP
44 changes: 1 addition & 43 deletions core/src/View/Kokkos_View_legacy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static_assert(false,
#include <View/MDSpan/Kokkos_MDSpan_Accessor.hpp>
#endif
#include <View/Kokkos_ViewTraits.hpp>
#include <View/Kokkos_ViewUtility.hpp>
#include <Kokkos_MinMax.hpp>

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -214,49 +215,6 @@ constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst,
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------

namespace Kokkos {
/** \brief Create View allocation parameter bundle from argument list.
*
* Valid argument list members are:
* 1) label as a "string" or std::string
* 2) memory space instance of the View::memory_space type
* 3) execution space instance compatible with the View::memory_space
* 4) Kokkos::WithoutInitializing to bypass initialization
* 4) Kokkos::AllowPadding to allow allocation to pad dimensions for memory
* alignment
*/
template <class... Args>
inline Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>
view_alloc(Args const&... args) {
using return_type =
Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>;

static_assert(!return_type::has_pointer,
"Cannot give pointer-to-memory for view allocation");

return return_type(args...);
}

template <class... Args>
KOKKOS_INLINE_FUNCTION
Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>
view_wrap(Args const&... args) {
using return_type =
Impl::ViewCtorProp<typename Impl::ViewCtorProp<void, Args>::type...>;

static_assert(!return_type::has_memory_space &&
!return_type::has_execution_space &&
!return_type::has_label && return_type::has_pointer,
"Must only give pointer-to-memory for view wrapping");

return return_type(args...);
}

} /* namespace Kokkos */

//----------------------------------------------------------------------------
//----------------------------------------------------------------------------

namespace Kokkos {

template <class DataType, class... Properties>
Expand Down
1 change: 1 addition & 0 deletions core/src/View/MDSpan/Kokkos_MDSpan_Accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static_assert(false,
#define KOKKOS_MDSPAN_ACCESSOR_HPP

#include <Kokkos_Macros.hpp>
#include "Kokkos_MDSpan_Header.hpp"
#include <Kokkos_Concepts.hpp>
#include <Kokkos_Core_fwd.hpp>
#include <desul/atomics.hpp>
Expand Down

0 comments on commit 0a9eba8

Please sign in to comment.