Skip to content

Commit

Permalink
kokkos#6805: move dimension_from_extent
Browse files Browse the repository at this point in the history
  • Loading branch information
nmm0 committed May 15, 2024
1 parent dafaf2d commit fba7595
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 0 additions & 8 deletions core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ struct DataTypeFromExtents {
using type = typename ::Kokkos::Impl::ViewDataType<T, dimension_type>::type;
};

/// Convert from a mdspan extent to a Kokkos extent, inserting 0s for static
/// extents
template <class Extents>
KOKKOS_INLINE_FUNCTION auto dimension_from_extent(const Extents &e,
std::size_t r) noexcept {
return Extents::static_extent(r) == dynamic_extent ? e.extent(r) : 0;
}

template <class Extents, class VM, std::size_t... Indices>
constexpr KOKKOS_INLINE_FUNCTION auto extents_from_view_mapping_impl(
const VM &view_mapping, std::index_sequence<Indices...>) {
Expand Down
8 changes: 8 additions & 0 deletions core/src/View/MDSpan/Kokkos_MDSpan_Layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ struct ViewOffsetFromExtents {
Kokkos::Impl::ViewOffset<typename data_analysis::dimension, array_layout>;
};

/// Convert from a mdspan extent to a Kokkos extent, inserting 0s for static
/// extents
template <class Extents>
KOKKOS_INLINE_FUNCTION auto dimension_from_extent(const Extents &e,
std::size_t r) noexcept {
return Extents::static_extent(r) == dynamic_extent ? e.extent(r) : 0;
}

template <class ArrayLayout, class MDSpanType>
KOKKOS_INLINE_FUNCTION auto array_layout_from_mapping(
const typename MDSpanType::mapping_type &mapping) {
Expand Down

0 comments on commit fba7595

Please sign in to comment.